Customising Ammo
by Wayne Scales

With the Customize= command we have the ability to do many things. In this tutorial I will show you how to customize the ammo of the Grenade gun.

Here is the syntax we will follow.

Syntax: Customize=CUST_AMMO, SlotOfAmmo, Ammo flags (AMMO_....), Damage, 
ShotsForBox, ShotsWithWeapon, Extra, IdTriggerGroupWhenHitEnemy, DamageForExplosion, Speed, Gravity, IdAddEffectToAmmo, IdTriggerGroupAtEnd

This goes in the level section of the script.

Field Descriptions

SlotOfAmmo field= Here you choose the ammo slot you wish to customize. Here is the list you can select from:

PISTOLS_AMMO_ITEM
UZI_AMMO_ITEM
SHOTGUN_AMMO1_ITEM (normal)
SHOTGUN_AMMO2_ITEM (wideshot)
CROSSBOW_AMMO1_ITEM (normal)
CROSSBOW_AMMO2_ITEM (explosive)
CROSSBOW_AMMO3_ITEM (poisoned)
GRENADE_GUN_AMMO1_ITEM (normal)
GRENADE_GUN_AMMO2_ITEM (power)
GRENADE_GUN_AMMO3_ITEM (lightning)
SIXSHOOTER_AMMO_ITEM

Ammo flags (AMMO_....) field
Here you can add ammo flags to make different features for different ammo. Here is the possible flags. Just type IGNORE if you don't want this feature.

AMMO_PUSH_LARA= This is a cool feature as Lara will move back when she fires her weapon, like the recoil from a shotgun. You would not use this on pistols because it wouldn't be realistic but it works well with a grenade launcher. You have to type a distance value in the Extra field for the distance of movement. The distance units are 1024 = one sector, 256 = one click.

AMMO_PUSH_TARGET= When the ammo will hit the enemy, he will be pushed (moved) like if the impact of ammo had moved him. You have to type in Extra field, the distance of movement. The distance units are 1024 = one sector, 256 = one click.

AMMO_SET_GRENADE_TIMER= To use only with greande ammo. You can change the number of seconds required to explode the grenade. The default value is 4 seconds. You have to type the number of seconds in Extra field.

Damage field
Here you can change the damage for the ammo.

Remarks: this is a normal damage, while if this ammo is also explosive you have to set the damage for explosion in the other field named DamageForExplosion (see below)

Default values:

Ammo Default MaxValue
-----------------------------------
Pistols 1 255
UZI 1 255
Revolver 21 255
ShotGun normal 3 (*6) 255
ShotGun Wide 3 (*5) 1000
GrenadeGun Normal 20 255
GrenadeGun Power 20 1000
CrossBow Normal 5 255
CrossBow Explos. 5 1000
-----------------------------------

Remarks: Some ammo have 0 damage because their damage is only for explosion, anyway you can force also a common damage for them.

* The wideshot shotgun ammo is not more powerful like people think. The damage for them is computed like a random rain of fragments where the wide property reduces the number of fragments reaching the target. Usually this number is only 5 while for normal shotgun ammo it is 6, hence the normal shotgun ammo is more powerful than wideshot ammo. The only exception is when the enemy is really big.

If you wish really powerful wideshot shotgun ammo set a value for damage in this field and it will be added to compute for damage.

ShotsForBox field
When lara picks up an ammo item she will automatically be given a number of bullets. In this field we can change that!

Here are the default values and the maximum we can add.

Ammo Default MaxForBox 
------------------------------------------------------------
PISTOLS_AMMO_ITEM Unlimited (-2) 1000
UZI_AMMO_ITEM 30 1000
SHOTGUN_AMMO1_ITEM 6 1000
SHOTGUN_AMMO2_ITEM 6 42
CROSSBOW_AMMO1_ITEM 10 1000
CROSSBOW_AMMO2_ITEM 10 255 
CROSSBOW_AMMO3_ITEM 10 255
GRENADE_GUN_AMMO1_ITEM 10 255
GRENADE_GUN_AMMO2_ITEM 4 255
GRENADE_GUN_AMMO3_ITEM 4 255
SIXSHOOTER_AMMO_ITEM 6 1000
------------------------------------------------------------

Remarks: If you want to leave this field unchanged type IGNORE 

* There are technical reasons (within the orignal tomb4 code) why some ammo has a different max value you can set. Please don't exceed the limits otherwise you'll have crashes or other problems within the TRNG engine.

* The value -1 should mean 'unlimited ammo' but really this is not possible because the -1 value is the same as the IGNORE value used in NG_Center. For this reason if you want to set number of shot for box as unlimited ammo you should type another negative number different than -1, for example -2.

ShotsWithWeapon field
When lara picks up a weapon item like a shotgun she will automatically be given a number of bullets, maybe to simulate that there was still bullets present in the shotgun. We can change the settings for this now. You could be mean and give you player no rounds with a shotgun!!!!!

Given with weapon Number Shots MaxAllowedValue
----------------------------------------------------------------
Pistols Unlimited (-2) 1000
Revolver 6 255
UZI 30 255
ShotGun 6 (normal) 42
CrossBow 10 (normal) 255
GrenadeGun 10 (normal) 255
----------------------------------------------------------------

Remarks: If you want to leave this field unchanged type IGNORE 

* There are technical reasons (within the orignal tomb4 code) why some ammo has a different max value you can set. Please don't exceed the limits otherwise you'll have crashes or other problems within the TRNG engine.

* The value -1 should mean 'unlimited ammo' but really this is not possible because the -1 value is the same as the IGNORE value used in NG_Center. For this reason if you want to set number of shot for box as unlimited ammo you should type another negative number different than -1, for example -2.

Extra field
This optional field could be used in some circumstance for special ammo. Read the AMMO_ constant descriptions to discover the possible usage of this field.

IdTriggerGroupWhenHitEnemy field

From reference:
You can perform a TriggerGroup script command when this ammo hits enemy. If you wish to use this feature you have to type the ID of TriggerGroup script command.

Remarks: If you don't want perform any trigger group type IGNORE in this field.

* When the enemy will be hit by ammo, the game engine will perform the TriggerGroup you set and it will set as 'Found item' the index of enemy hit by ammo.

If you want to perform some special ACTION stored in trigger group on hit enemy, remember to add to exported trigger the flag TGROUP_USE_FOUND_ITEM_INDEX. The action trigger you placed in trigger group will then use the index of enemy hit by ammo, instead of the moveable you had set originally in exported action trigger. Using this method you can give special functions to this ammo.

DamageForExplosion field

We can set the damage for explosive ammo in this field. Like the grenade and crossbow explosive ammo for example.

Remark: when you customize crossbow poison dart ammo, you can use this field to set the intensity of poison. The default value for poison is 1

Default value is 30 for all explosive ammo kinds.
Max value for damage is 1000.


Speed field
For the visible ammo (like grenades and crossbow darts) you can change the (horizontal) speed.

Default values: Default MaxValue
-------------------------------------------------
Grenade (all types): 128 1024
Darts (all types): 512 1024
-------------------------------------------------

Remarks: you can set different speeds for each grenade or dart type. This mean you can have, for example, a dart (like explosive) moving faster than poisoned dart.

Gravity field
For the visible ammo (like grenades and crossbow darts) you can change the gravity.

Default values: Default MaxValue
------------------------------------------------
Grenade (all types) 3 255
Darts (all types) 0 255
------------------------------------------------

Remarks: The gravity is not simply a vertical (down) speed but it is an acceleration value used to increase the vertical speed.

* For darts gravity was not foreseen, but you can use it if you wish.

IdAddEffectToAmmo field
This setting works only for visible ammo (grenade and dart). If you wish you can set a special effect using an AddEffect script command and then type in this field its id to attach that effect to this ammo everytime it will be used. For example if you create an AddEffect to add a blue mist wake and then type the id in this field, the ammo will have a blue mist wake.

IdTriggerGroupAtEnd field
This setting works only for visible ammo (grenade and dart). This field works in a similar way to the previously described field 'IdTriggerGroupWhenHitEnemy' but in this case it's not important if the ammo hits more or less of the enemy. The TriggerGroup where you typed the id will be performed when the ammo hits anything at all - enemies, wall, floor, statics etc.

In this TriggerGroup the 'found enemy index' will be the index of current ammo. If you place in the triggergroup some ACTION you can force the performance of this action on ammo item (in final position) using the constant TGROUP_USE_FOUND_ITEM_INDEX.

Here is a script I have put together.

Customize= CUST_AMMO,GRENADE_GUN_AMMO1_ITEM,AMMO_PUSH_LARA,0,7,
IGNORE,IGNORE,IGNORE,IGNORE,IGNORE,IGNORE,IGNORE,IGNORE


This is for my mission so i don't need some of the other fields so i just type IGNORE.