# HG changeset patch
# User Wuzzy
# Date 1505951591 -3600
# Node ID 637ad254daf9efb41f1a30b53c5c7739596fbd5d
# Parent b8c041a2f98ef663dbf24d3305fe0d9ed6d63313
LuaAPI: Explain the initial ammo setting in missions
diff -r b8c041a2f98e -r 637ad254daf9 LuaAPI.wiki
--- a/LuaAPI.wiki Thu Sep 21 00:31:16 2017 +0100
+++ b/LuaAPI.wiki Thu Sep 21 00:53:11 2017 +0100
@@ -391,7 +391,8 @@
=== !SpawnAmmoCrate(x, y, ammoType [, amount]) ===
Spawns an ammo crate at the specified position with content of ammoType (see [AmmoTypes Ammo Types]). If `ammoType` is set to `amNothing`, a random weapon (out of the available weapons from the weapon scheme) will be selected. If `x` and `y` are set to 0, the crate will spawn on a random position (but always on land). The `amount` parameter specifies the amount of ammo contained in the crate. If `amount` is `nil` or `0`, the value set by `SetAmmo` is used. If `SetAmmo` has not been used for this ammo type, an ammo-type-dependent default value is used. If ´amount` is equal to or greater than `100` or greater, the amount is infinite.
-Because by default settings the number of ammo in crates is zero it has to be increased to at least one with `SetAmmo` first, see the example:
+
+Note that in Lua missions, the default number of ammo in crates is 0, so it has to be set to at least 1 with `SetAmmo` first, see the example:
Example:
@@ -933,10 +934,15 @@
==== !SetAmmo(ammoType, count, probability, delay, numberInCrate) ====
This updates the settings for a specified [AmmoTypes Ammo Type] as of count available for players, spawn probability, availability delay in turns, and the number available in crates. This is supposed to be used in the `onAmmoStoreInit()` event handler.
+In Lua missions, for **all** ammo types, the ammo count, probability, delay and number in crates is set to 0 initially. Note: This also includes skip!
+
Example:
SetAmmo(amShotgun, 9, 0, 0, 0) -- unlimited amount of shotgun ammo for players
- SetAmmo(amGrenade, 0, 0, 0, 3) -- crates should contain always three grenade
+ SetAmmo(amGrenade, 0, 0, 0, 3) -- crates should contain always three grenade
+ SetAmmo(amSkip, 9, 0, 0, 0) -- enable skip
+
+Hint: It is recommended to always enable skip in missions. Only in exceptional circumstances you should choose to not enable skip.
==== !SetAmmoDelay(ammoType, delay) ====
Changes the delay of a specified [AmmoTypes Ammo Type].