LuaGameplay.wiki
changeset 1971 210ad26e9e94
parent 1970 c85f6f3bb16c
child 1974 3a573bba359e
equal deleted inserted replaced
1970:c85f6f3bb16c 1971:210ad26e9e94
   174 SetAmmoTexts(amBazooka, "This weapon deals double the damage than usually.")</code>
   174 SetAmmoTexts(amBazooka, "This weapon deals double the damage than usually.")</code>
   175 
   175 
   176 === <tt>!AddAmmo(gearUid, ammoType [, ammoCount])</tt> ===
   176 === <tt>!AddAmmo(gearUid, ammoType [, ammoCount])</tt> ===
   177 Adds or sets the amount of ammo to the specified hedgehog gear.
   177 Adds or sets the amount of ammo to the specified hedgehog gear.
   178 
   178 
   179 If `ammoCount` is `nil`, then X ammos of the type `ammoType` will be added to `gearUid`, where X is determined by the `numberInCrate` argument passed via `SetAmmo()` in the `onAmmoStoreInit()` [LuaEvents event handler]. Note that `numberInCrate` defaults to 0 if `SetAmmo()` was not called for the ammo type before.
   179 If `ammoCount` is `nil`, then X ammos of the type `ammoType` will be added to `gearUid`, where X equals the “number in crate” setting of the weapon scheme, or, if `onAmmoStoreInit()` is used, X equals the `numberInCrate` argument passed via `SetAmmo()` in the `onAmmoStoreInit()` [LuaEvents event handler]. Note that if you use `onAmmoStoreInit()`, `numberInCrate` defaults to 0 if `SetAmmo()` was not called for the ammo type before.
   180 
   180 
   181 If `ammoCount` is a number, the ammo will *not* be added, but instead set to `ammoCount`. A value of `0` will remove the ammo, a value of `AMMO_INFINITE` will set it to infinite.
   181 If `ammoCount` is a number, the ammo will *not* be added, but instead set to `ammoCount`. A value of `0` will remove the ammo, a value of `AMMO_INFINITE` will set it to infinite.
   182 
   182 
   183 Note: By default, ammo is per-team, so calling `AddAmmo` for a hedgehog will add/set the ammo for the whole team. The game flags `gfPerHogAmmo` and `gfSharedAmmo` change how ammo is managed in the game, so these game flags also affect `AddAmmo`.
   183 Note: By default, ammo is per-team, so calling `AddAmmo` for a hedgehog will add/set the ammo for the whole team. The game flags `gfPerHogAmmo` and `gfSharedAmmo` change how ammo is managed in the game, so these game flags also affect `AddAmmo`.
   184 
   184