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.
|Table of Contents|
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:
Add and remove weapons and equipment items to and from the lists by using the << and >> buttons.
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 Equipment Pack editor by clicking the EquipmentPack "..." button in the properties of a character with a weapon.
Enemies can be configured to
Note that AI have an unlimited amount of ammunition so
you don't need to specify the number of bullets for their Equipment packs.
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.
Giving the Player Individual Weapons and Items
Right-click the Flow Graph window and find the Inventory nodes:
Specify which ammo type to give and also the amount.
Specify an equipment pack to give. Opens up the Equipment Pack dialog to chose from there.
Add a specific item to the players inventory.
Check for a specific ammo type and amount in the players inventory.
Check for a specific item in the players inventory.
Trigger the player to holster / un-holster their weapon.
Check for specific items in the players hands.
Remove all ammunition from the specified entities inventory.
Remove all inventory items (including weapons) from the specified entities inventory.
Remove a specific item from the specified entities inventory.
Use this to load up a previously saved player inventory.
For an item in the players inventory to be the selected weapon.
Specify an ammo type and set an exact amount.
Same as the SetAmmo node.
Save the players inventory state to be called on later with the RestorePlayerInventory node.
Use the Add Node/Misc/Start node to give the player a SCAR In the example below, the player would receive a RocketLauncher at the beginning of the level:
When the player starts the mission, he will have the SCAR right at the beginning.
Some things to experiment with:
, then when they passed through the AreaTrigger, they would receive 2 additional Rockets:
This tutorial shows users how to set up equipment packs from within Sandbox.