Weapons

Just 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.
They have either the weapon prefab and the associated weaponTAG prefab
 
Ranged weapons are:
Name
Location
Associated TAG
Associated TAG location
DesertEagle
EasyGamePack\Weapons\Entities
DesertEagleTAG
EasyGamePack\Weapons
M4
EasyGamePack\Weapons\Entities
M4TAG
EasyGamePack\Weapons
 
Melee weapons are:
Name
Location
Associated TAG
Associated TAG location
Mace
EasyGamePack\Weapons\Entities
BaseballMaceTAG
EasyGamePack\Weapons
IronMace
EasyGamePack\Weapons\Entities
ironMaceTAG
EasyGamePack\Weapons
 
 

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:
  • In the case of weaponTAG the model can be a single mesh (sm2) since it has no particular functionality except the property that it can be picked-up by player.
  • In the case of weapon entity the things are a bit more complicated, since the weapon entity is the object linked to player's hands that fires projectiles, reloads with an animation, etc...(see configuring a new weapon fro more info)
 
 

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:
6.3.3. Weapons
1

Weapon

1. Weapon
<TODO>: Insert description text here...
2

AmmoCaption

2. AmmoCaption
<TODO>: Insert description text here...
3

captionTexture

3. captionTexture
<TODO>: Insert description text here...
4

ActionCommand

4. ActionCommand
<TODO>: Insert description text here...
 

Predefined Ammo TAGs

In EasyGamePack there are 2 ammoTAGs predefined and associated with the predefined weapons:
Name
Location
associated weapon
DesertEagleAmmoTAG
EasyGamePack\Weapons
DesertEagle
M4AmmoTAG
EasyGamePack\Weapons
M4