Taboen, this might help you.
From LastManStanding
Code:
function AddDefaultInventory( pawn PlayerPawn )
{
local Weapon weap;
local int i;
local inventory Inv;
local float F;
if ( PlayerPawn.IsA('Spectator') || (bRequireReady && (CountDown > 0)) )
return;
Super.AddDefaultInventory(PlayerPawn);
GiveWeapon(PlayerPawn, "Botpack.ShockRifle");
GiveWeapon(PlayerPawn, "Botpack.UT_BioRifle");
GiveWeapon(PlayerPawn, "Botpack.Ripper");
GiveWeapon(PlayerPawn, "Botpack.UT_FlakCannon");
if ( PlayerPawn.IsA('PlayerPawn') )
{
GiveWeapon(PlayerPawn, "Botpack.SniperRifle");
GiveWeapon(PlayerPawn, "Botpack.PulseGun");
GiveWeapon(PlayerPawn, "Botpack.Minigun2");
GiveWeapon(PlayerPawn, "Botpack.UT_Eightball");
PlayerPawn.SwitchToBestWeapon();
}
else
{
// randomize order for bots so they don't always use the same weapon
F = FRand();
if ( F < 0.7 )
{
GiveWeapon(PlayerPawn, "Botpack.SniperRifle");
GiveWeapon(PlayerPawn, "Botpack.PulseGun");
if ( F < 0.4 )
{
GiveWeapon(PlayerPawn, "Botpack.Minigun2");
GiveWeapon(PlayerPawn, "Botpack.UT_Eightball");
}
else
{
GiveWeapon(PlayerPawn, "Botpack.UT_Eightball");
GiveWeapon(PlayerPawn, "Botpack.Minigun2");
}
}
else
{
GiveWeapon(PlayerPawn, "Botpack.Minigun2");
GiveWeapon(PlayerPawn, "Botpack.UT_Eightball");
if ( F < 0.88 )
{
GiveWeapon(PlayerPawn, "Botpack.SniperRifle");
GiveWeapon(PlayerPawn, "Botpack.PulseGun");
}
else
{
GiveWeapon(PlayerPawn, "Botpack.PulseGun");
GiveWeapon(PlayerPawn, "Botpack.SniperRifle");
}
}
}
for ( inv=PlayerPawn.inventory; inv!=None; inv=inv.inventory )
{
weap = Weapon(inv);
if ( (weap != None) && (weap.AmmoType != None) )
weap.AmmoType.AmmoAmount = weap.AmmoType.MaxAmmo;
}
inv = Spawn(class'Armor2');
if( inv != None )
{
inv.bHeldItem = true;
inv.RespawnTime = 0.0;
inv.GiveTo(PlayerPawn);
}
}
it's old code, but i think the concept is still relevant
Bookmarks