WeaponsJust like items, weapon are collectable objects that can be stored into the inventory.
But weapons are a little bit different from items.
Items can be used from inventory and are used just in "one shot", in other words once used they are lost. On the other hands weapons must be always equiped before being used, in other words they cannot be used from inventory, and once equiped, a weapon remains in player hands until it is dropped or replaced by another weapon.
Like items weapons are represented by two kind of scene objects:
Unlike items, when a weaponTAG is picked-up the weapon is automatically equiped and it replaces the currently handled weapon (see weapon handling).
Included Premade Weapons
In the starting EasyGamePack package 4 weapons are provided, 2 are ranged weapons and 2 are melee weapons.
Ranged weapons are:
Melee weapons are:
Adding a premade weapon
To add a premade weapon in your level you have to add its related weaponTAG.
When picking-up the weaponTAG the player automatically instance a weapon entity (if it not exists, i.e. it is the first time that weaponTAG is picked-up) and link the weapon to his arms.
Adding a new weapon
The procedure to create a weapon from scratch is the same you use to create an item.
You need to create:
One important thing to be take care are weapon models:
Weapon Ammo TAG
WeaponAmmoTAGs are special kind of TAGs used for reload weapon ammo.
A weaponAmmoTAG is specific for every kind of weapon. It is not stored into the inventory like other TAGs but it is used automatically when it is picked-up.
Of course the player cannot pickup a weaponAmmoTAG if he hasn't the weapon associated with that ammoTAG, in this case a message "no weapon for this ammo" is showed on the HUD.
When a weaponAmmoTAG is picked-up the corresponding weapon total ammo is increased.
Technically, when a weaponAmmoTAG is taken a SUPPLY_AMMO message is sent to the player specifying the associated weapon and number of projectiles (see the related message description).
Following are the main parameters of a weaponAmmoTAG:
Predefined Ammo TAGsIn EasyGamePack there are 2 ammoTAGs predefined and associated with the predefined weapons:
|