# HG changeset patch
# User Wuzzy
# Date 1461712989 -3600
# Node ID ab6bd4812ca4684d820bd92850bbf6fdaf673327
# Parent edb64d05684ea4340132ed8b12a5b5743affcb46
LuaAPI: special amNothing for SpawnAmmoCrate / SpawnUtilityCrate
diff -r edb64d05684e -r ab6bd4812ca4 LuaAPI.wiki
--- a/LuaAPI.wiki Wed Apr 27 00:19:53 2016 +0100
+++ b/LuaAPI.wiki Wed Apr 27 00:23:09 2016 +0100
@@ -385,7 +385,7 @@
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.
=== !SpawnAmmoCrate(x, y, ammoType [, amount]) ===
-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.
+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.
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:
Example:
@@ -394,7 +394,7 @@
SpawnAmmoCrate(0, 0, amGrenade) -- x=y=0 means random position on map
=== !SpawnUtilityCrate(x, y, ammoType [, amount]) ===
-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.
+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.
Example: