Announcement

Collapse
No announcement yet.

Adding a weapon to Pawn's default inventory

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Adding a weapon to Pawn's default inventory

    I'm currently coding something for Jailbreak. I want a Pawn to always get an extra weapon when he spawns, but only draw it when he's in jail. At the moment I'm using this in ModifyPlayer(Pawn Other):
    Code:
    if ( TagPlayer.IsInJail() )
    {
       Spawn(class'myWeapon', Other).GiveTo(Other);
       myPawn.ClientSetWeapon(class'myWeapon');
    }
    Unfortunately bots dont want to switch to that weapon. Additionally, when you spawn in jail, you are not immediately holding that weapon, which is necessairy to me.

    I need to add this weapon to the Pawn's default inventory, but I can't seem to find anything that can add the weapon. Modifying the variable class<Weapon> DefaultWeapon will replace ShieldGun with another weapon (afaik, didnt test that), the function function string GetInventoryClassOverride(string InventoryClassName) will replace a certain weapon with another.

    Does anyone know how I can add the weapon to the default inventory anyway?

    #2
    Try using the GiveWeapon() function. This will automatically spawn the weapon and give it to the Pawn.

    ex.
    Code:
    Other.GiveWeapon("XWeapons.AssaultRifle");

    Comment

    Working...
    X