LuaAPI.wiki
changeset 99 983ec9ac63c7
parent 98 54e178bb6986
child 100 1671c5c8961a
equal deleted inserted replaced
98:54e178bb6986 99:983ec9ac63c7
   338 <code lang="lua">    !SetAmmo(amShotgun, 9, 0, 0, 0) -- unlimited amount of shotgun ammo for players
   338 <code lang="lua">    !SetAmmo(amShotgun, 9, 0, 0, 0) -- unlimited amount of shotgun ammo for players
   339     !SetAmmo(amGrenade, 0, 0, 0, 3) -- crates should contain always three grenade</code>
   339     !SetAmmo(amGrenade, 0, 0, 0, 3) -- crates should contain always three grenade</code>
   340 === <tt>!SetHealth(gearUid, health)</tt> ===
   340 === <tt>!SetHealth(gearUid, health)</tt> ===
   341 
   341 
   342 <blockquote>Sets the health of the specified gear.
   342 <blockquote>Sets the health of the specified gear.
       
   343 This can be used for purposes other than killing hedgehogs.
       
   344 
       
   345 For example:
       
   346 
       
   347   * Starting the RC Plane 10 shots
       
   348   * Starting Flying Saucer (gtJetpack) with only 50% fuel.
       
   349   * Setting all the mines to duds.
       
   350   * (And more!)
       
   351 
       
   352 <code lang="lua">    function onGearAdd(gear)
       
   353        if (!GetGearType(gear) == gtRCPlane) then
       
   354             !SetHealth(gear, 10)
       
   355        end
       
   356        if (!GetGearType(gear) == gtJetpack) then
       
   357             !SetHealth(gear, 1000)
       
   358        end
       
   359        if (!GetGearType(gear) == gtMine) then
       
   360             !SetHealth(gear, 0)
       
   361        end
       
   362     end</code>
       
   363 
       
   364 
       
   365 
   343 </blockquote>
   366 </blockquote>
   344 === <tt>!SetEffect(gearUid, effect, true/false)</tt> (0.9.14 / dev) ===
   367 === <tt>!SetEffect(gearUid, effect, true/false)</tt> (0.9.14 / dev) ===
   345 
   368 
   346 <blockquote>Enables (true) or disables (false) one of the effects <tt>heInvulnerable, heResurrectable, hePoisoned</tt> for the specified hedgehog gear.
   369 <blockquote>Enables (true) or disables (false) one of the effects <tt>heInvulnerable, heResurrectable, hePoisoned</tt> for the specified hedgehog gear.
   347 </blockquote>
   370 </blockquote>