Idk what exactly you want to do and in which type of actor, but this is what I often use myself to give a new weapon to a player/pawn.luluthefirst wrote:I have a question, how to give weapon to a player?
Code: Select all
local Weapon newWeapon; // The new weapon
local Pawn P; // The pawn/player in question
newWeapon = Spawn(Class'TheWeapon');
if (newWeapon != None)
{
newWeapon.bTossedOut = false;
newWeapon.Instigator = P;
newWeapon.RespawnTime = 0.0;
newWeapon.bHeldItem = true;
newWeapon.BecomeItem();
P.AddInventory(newWeapon);
newWeapon.GiveAmmo(P);
newWeapon.SetSwitchPriority(P);
newWeapon.WeaponSet(P);
}
You have to be more specific. Which function are we talking? In which class?luluthefirst wrote: and i have a problem... the super.function(PlayerPawn); don't work, the compilator say me the function doesn't exist
thank for your help.