LuaAPI.wiki
changeset 871 3222b4cfef8a
parent 869 a09b1abfe5e8
child 881 ab6bd4812ca4
equal deleted inserted replaced
870:55e67d58d19e 871:3222b4cfef8a
   379 
   379 
   380 <code language="lua">  -- adds an non-critical explosion at position 1000,1000. Returns 0 if it was not created.
   380 <code language="lua">  -- adds an non-critical explosion at position 1000,1000. Returns 0 if it was not created.
   381     vgear = AddVisualGear(1000, 1000, vgtExplosion, 0, false) 
   381     vgear = AddVisualGear(1000, 1000, vgtExplosion, 0, false) 
   382 </code>
   382 </code>
   383 
   383 
   384 === <tt>!SpawnHealthCrate(x, y)</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).
   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)</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).
   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.
   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)</tt> ===
   396 === <tt>!SpawnUtilityCrate(x, y, ammoType [, amount])</tt> ===
   397 Spawns an utility crate at specified position with content of ammoType. If `x` and `y` are set to 0, the crate will spawn on a random position (but always on land).
   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.
   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>