LuaAPI.wiki
changeset 881 ab6bd4812ca4
parent 871 3222b4cfef8a
child 885 40aae8355e3e
equal deleted inserted replaced
880:edb64d05684e 881:ab6bd4812ca4
   383 
   383 
   384 === <tt>!SpawnHealthCrate(x, y, [, health])</tt> ===
   384 === <tt>!SpawnHealthCrate(x, y, [, health])</tt> ===
   385 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.
   385 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.
   386 
   386 
   387 === <tt>!SpawnAmmoCrate(x, y, ammoType [, amount])</tt> ===
   387 === <tt>!SpawnAmmoCrate(x, y, ammoType [, amount])</tt> ===
   388 Spawns an ammo crate at the specified position with content of ammoType (see [AmmoTypes Ammo Types]). 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. By default, 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.
   388 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. By default, 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.
   389 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:
   389 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:
   390 
   390 
   391 Example:
   391 Example:
   392 
   392 
   393 <code language="lua">    SetAmmo(amGrenade, 0, 0, 0, 1) -- see below
   393 <code language="lua">    SetAmmo(amGrenade, 0, 0, 0, 1) -- see below
   394     SpawnAmmoCrate(0, 0, amGrenade) -- x=y=0 means random position on map</code>
   394     SpawnAmmoCrate(0, 0, amGrenade) -- x=y=0 means random position on map</code>
   395 
   395 
   396 === <tt>!SpawnUtilityCrate(x, y, ammoType [, amount])</tt> ===
   396 === <tt>!SpawnUtilityCrate(x, y, ammoType [, amount])</tt> ===
   397 Spawns an utility crate with some ammo at the specified position. The function behaves exactly like `SpawnAmmoCrate`, the only difference is the appearance of the crate.
   397 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.
   398 
   398 
   399 Example:
   399 Example:
   400 
   400 
   401 <code language="lua">    SetAmmo(amLaserSight, 0, 0, 0, 1)
   401 <code language="lua">    SetAmmo(amLaserSight, 0, 0, 0, 1)
   402     SpawnUtilityCrate(0, 0, amLaserSight)</code>
   402     SpawnUtilityCrate(0, 0, amLaserSight)</code>