After completing this tutorial, you will be able to give weapons and equipment items to AI entities and to the player.
You will also be able to carry the inventory of the player from one mission to another, as well as give the player specific items at the start of a level.
Editing Equipment Packs
On the Game menu, click Edit Equipment-Packs:
Using the drop-down list, select one of the Equipment-Packs:
Player_Default is loaded by default unless specified otherwise through Flowgraph (Inventory:EquipPackAdd).
Or, create a new pack by clicking Add:
You can then add equipment from the Available Equipment list into the Used Equipment list, or remove equipment by using the << and >> buttons.
As ammo/weapons/accessories are added/removed from the build, the EquipmentPack Editor will automatically notify of changes and update available equipment accordingly.
Since CRYENGINE 3.5, the Equipment Pack tool also has the ability to sort Accessories/Attachments for Weapons.
In the above example you can see several accessories are ticked, this means they are equipped on the weapon by default when loading this Equipment Pack. Only one accessory can be selected to be the default per-category (as defined in the Weapon script).
This means the Pistol will start with PistolBulletAmmo, the Rifle will start with no accessories and the Shotgun will start with ShotgunSolidAmmo. If we wanted the Flashlight on the pistol by default, we'd check the box next to it in the 'bottom' category.
There is a fairly large overlap between Weapon scripts and Equipment packs which should be kept in mind. Ammunition amounts can be defined in the Accessory XML, in the Weapon XML or in the Equipment Pack.
Typically the 'greater' value will be accepted but kept within the limitations. If your maximum ammo capacity for PistolBullet is 54 and you put 200 in the Equipment pack you'd still only get 54. If you put 10 in the Equipment pack and 12 in the Weapon script, you'd have 22 ammo.
AI Equipment Packs
To assign a specific Equipment pack to an AI, simply reference the Equipment Pack name in the EquipmentPack field of the AI Properties.
Remember, if you're dealing with many AI/Equipment Packs, AI Entity Archetypes can be used.
You can also access the Equipment Pack editor by clicking the EquipmentPack "..." button in the properties of a character with a weapon.
Note that AI have an unlimited amount of ammunition so you don't need to specify the number of bullets for their Equipment packs.
Saving Players Equipment Over Multiple Levels
During some point in the game you may want to load a new level, but also carry over the players weapons and items over to the next level.
In the following picture we have a setup where on the completion or failure of MissionObjective5 we will save the player's inventory, fade out the screen and then trigger the next level.
Then once the next level has been loaded, we will restore the saved inventory, fade in and then activate the mission MissionObjective1.
Giving the Player Individual Weapons and Items
In the example below, the player would receive a RocketLauncher at the beginning of the level, then when they passed through the AreaTrigger, they would receive 2 additional Rockets: