Automatically Equip Loadout Weapon

airoll

Member
Hello, I want to set a default loadout for a character and automatically equip that weapon once the scene runs. However, I noticed that in the new integration between UIS/UCC, the character does not automatically equip the a weapon in the loadout. I tried this both in my own scene, and verified that in the demo scene, if we have a assault rifle (or other items), it doesn't attempt to equip any of them when the scene starts.

Do I have to manually call Equip() in order to equip a weapon from the loadout now? It's unclear to me because lines 571-576 in CharacterInventoryBridge would have me believe that it should equip an item, but nothing actually gets equipped. If I do have to manually call Equip(), is there a hook I can use to know when the loadout has been added into the (Main) Default item collection?
 
Since the big integration update you can add items directly to the Equippable (Slots) Item Collection at edit mode and they will be equipped on start.

Loadout Items simply get set to the Default Item Collection
 
As a follow up here, if I want the character to start with a weapon and ammo for that weapon, I would put the weapon in Equippable Slots and the ammo in Loadout. But if the character dies and we despawn all the items via RemoveAllOnDeath, then how would we equip the starting weapon?

Also, separately, if I have an item that is already in an Equippable collection, how would I instantly reload the weapon at the start of the game / when the character dies and respawns?
 
Last edited:
For the Ammo, if you are using the AmmoData attribute, you could set an amount of ammo directly on the Item itself. This will pre-load the ammo.

As for reequiping the weapons after RemoveAllOnDeath, that's a bit more complicated.
You will need a seperate custom component that does that for you.
You'll need to write the code to listen to the respawn event and then add/equip the weapon back.
 
Top