LuaAPI.wiki
changeset 1031 637ad254daf9
parent 1030 b8c041a2f98e
child 1032 8ce955537e1c
equal deleted inserted replaced
1030:b8c041a2f98e 1031:637ad254daf9
   389 === <tt>!SpawnHealthCrate(x, y, [, health])</tt> ===
   389 === <tt>!SpawnHealthCrate(x, y, [, health])</tt> ===
   390 Spawns a health crate at the specified position. If `x` and `y` are set to 0, the crate will spawn on a random position (but always on land). Set `health` for the initial health contained in the health crate. If not set, the default health (`HealthCaseAmount`) is used.
   390 Spawns a health crate at the specified position. If `x` and `y` are set to 0, the crate will spawn on a random position (but always on land). Set `health` for the initial health contained in the health crate. If not set, the default health (`HealthCaseAmount`) is used.
   391 
   391 
   392 === <tt>!SpawnAmmoCrate(x, y, ammoType [, amount])</tt> ===
   392 === <tt>!SpawnAmmoCrate(x, y, ammoType [, amount])</tt> ===
   393 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.
   393 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.
   394 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:
   394 
       
   395 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:
   395 
   396 
   396 Example:
   397 Example:
   397 
   398 
   398 <code language="lua">    SetAmmo(amGrenade, 0, 0, 0, 1) -- see below
   399 <code language="lua">    SetAmmo(amGrenade, 0, 0, 0, 1) -- see below
   399     SpawnAmmoCrate(0, 0, amGrenade) -- x=y=0 means random position on map</code>
   400     SpawnAmmoCrate(0, 0, amGrenade) -- x=y=0 means random position on map</code>
   931 
   932 
   932 === Ammo ===
   933 === Ammo ===
   933 ==== <tt>!SetAmmo(ammoType, count, probability, delay, numberInCrate)</tt> ====
   934 ==== <tt>!SetAmmo(ammoType, count, probability, delay, numberInCrate)</tt> ====
   934 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.
   935 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.
   935 
   936 
       
   937 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!
       
   938 
   936 Example:
   939 Example:
   937 
   940 
   938 <code language="lua">    SetAmmo(amShotgun, 9, 0, 0, 0) -- unlimited amount of shotgun ammo for players
   941 <code language="lua">    SetAmmo(amShotgun, 9, 0, 0, 0) -- unlimited amount of shotgun ammo for players
   939     SetAmmo(amGrenade, 0, 0, 0, 3) -- crates should contain always three grenade</code>
   942     SetAmmo(amGrenade, 0, 0, 0, 3) -- crates should contain always three grenade
       
   943     SetAmmo(amSkip, 9, 0, 0, 0) -- enable skip</code>
       
   944 
       
   945 Hint: It is recommended to always enable skip in missions. Only in exceptional circumstances you should choose to not enable skip.
   940 
   946 
   941 ==== <tt>!SetAmmoDelay(ammoType, delay)</tt> ====
   947 ==== <tt>!SetAmmoDelay(ammoType, delay)</tt> ====
   942 Changes the delay of a specified [AmmoTypes Ammo Type].
   948 Changes the delay of a specified [AmmoTypes Ammo Type].
   943 
   949 
   944 ==== <tt>!SetAmmoTexts(ammoType, name, caption, description)</tt> (0.9.23) ====
   950 ==== <tt>!SetAmmoTexts(ammoType, name, caption, description)</tt> (0.9.23) ====