LuaAPI.wiki
changeset 564 c002f49283c6
parent 563 83ede97a33c6
child 567 17cf8a0c007f
equal deleted inserted replaced
563:83ede97a33c6 564:c002f49283c6
   341 === <tt>!SpawnHealthCrate(x, y)</tt> ===
   341 === <tt>!SpawnHealthCrate(x, y)</tt> ===
   342 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).
   342 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).
   343 
   343 
   344 === <tt>!SpawnAmmoCrate(x, y, ammoType)</tt> ===
   344 === <tt>!SpawnAmmoCrate(x, y, ammoType)</tt> ===
   345 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).
   345 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).
   346 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:
   346 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:
   347 
   347 
   348 Example:
   348 Example:
   349 
   349 
   350 <code language="lua">    SetAmmo(amGrenade, 0, 0, 0, 1) -- see below
   350 <code language="lua">    SetAmmo(amGrenade, 0, 0, 0, 1) -- see below
   351     SpawnAmmoCrate(0, 0, amGrenade) -- x=y=0 means random position on map</code>
   351     SpawnAmmoCrate(0, 0, amGrenade) -- x=y=0 means random position on map</code>
   623 
   623 
   624 Example:
   624 Example:
   625 
   625 
   626 <code language="lua">    SetAmmo(amShotgun, 9, 0, 0, 0) -- unlimited amount of shotgun ammo for players
   626 <code language="lua">    SetAmmo(amShotgun, 9, 0, 0, 0) -- unlimited amount of shotgun ammo for players
   627     SetAmmo(amGrenade, 0, 0, 0, 3) -- crates should contain always three grenade</code>
   627     SetAmmo(amGrenade, 0, 0, 0, 3) -- crates should contain always three grenade</code>
       
   628 
       
   629 === <tt>!SetAmmoDelay(ammoType, delay)</tt> ===
       
   630 Changes the delay of a specified [AmmoTypes Ammo Type].
   628 
   631 
   629 === <tt>!AddAmmo(gearUid, ammoType, ammoCount) (0.9.16) </tt> ===
   632 === <tt>!AddAmmo(gearUid, ammoType, ammoCount) (0.9.16) </tt> ===
   630 Adds `ammoType` to the specified gear. The amount added is determined by the arguments passed via `SetAmmo()` in the `onAmmoStoreInit()` event handler. In 0.9.16 ammo can be set directly via the optional third parameter, `ammoCount`. A value of 0 will remove the weapon, a value of 100 will give infinite ammo.
   633 Adds `ammoType` to the specified gear. The amount added is determined by the arguments passed via `SetAmmo()` in the `onAmmoStoreInit()` event handler. In 0.9.16 ammo can be set directly via the optional third parameter, `ammoCount`. A value of 0 will remove the weapon, a value of 100 will give infinite ammo.
   631 
   634 
   632 *Note:* The effectiveness of this function may be limited due to problems with `gfPerHogAmmo` in Lua scripting.
   635 *Note:* The effectiveness of this function may be limited due to problems with `gfPerHogAmmo` in Lua scripting.