LuaAPI.wiki
changeset 1033 ea42a17739d0
parent 1032 8ce955537e1c
child 1038 30a9877bf8e8
equal deleted inserted replaced
1032:8ce955537e1c 1033:ea42a17739d0
   388 
   388 
   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, or if `SetAmmo` has not been used, it falls back to the weapon scheme's value. If ´amount` is equal to or greater than `100` or greater, the amount is infinite.
   394 
   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 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:
   396 
   396 
   397 Example:
   397 Example:
   398 
   398 
   399 <code language="lua">    SetAmmo(amGrenade, 0, 0, 0, 1) -- see below
   399 <code language="lua">    SetAmmo(amGrenade, 0, 0, 0, 1) -- grenade ammo crates now contain 1 grenade each
   400     SpawnAmmoCrate(0, 0, amGrenade) -- x=y=0 means random position on map</code>
   400     SpawnAmmoCrate(0, 0, amGrenade) -- spawn grenade ammo crate at random position</code>
   401 
   401 
   402 === <tt>!SpawnUtilityCrate(x, y, ammoType [, amount])</tt> ===
   402 === <tt>!SpawnUtilityCrate(x, y, ammoType [, amount])</tt> ===
   403 Spawns an utility crate with some ammo at the specified position. The function behaves almost like `SpawnAmmoCrate`, the differences are 1) the crate looks different and 2) if `ammoType` is set to `amNothing`, a random utility out of the set of available utilities from the weapon scheme is chosen as content.
   403 Spawns an utility crate with some ammo at the specified position. The function behaves almost like `SpawnAmmoCrate`, the differences are 1) the crate looks different and 2) if `ammoType` is set to `amNothing`, a random utility out of the set of available utilities from the weapon scheme is chosen as content.
   404 
   404 
   405 Example:
   405 Example: