# HG changeset patch # User RedGrinner@gmail.com # Date 1300971810 0 # Node ID 983ec9ac63c7af76f1f5326f2e5bbff0963fe966 # Parent 54e178bb698606c9748da18a3dd50b17cc8c4173 Added a non-exhaustive list of examples for further applications of SetHealth() diff -r 54e178bb6986 -r 983ec9ac63c7 LuaAPI.wiki --- a/LuaAPI.wiki Thu Mar 24 12:43:03 2011 +0000 +++ b/LuaAPI.wiki Thu Mar 24 13:03:30 2011 +0000 @@ -340,6 +340,29 @@ === !SetHealth(gearUid, health) ===
Sets the health of the specified gear. +This can be used for purposes other than killing hedgehogs. + +For example: + + * Starting the RC Plane 10 shots + * Starting Flying Saucer (gtJetpack) with only 50% fuel. + * Setting all the mines to duds. + * (And more!) + + function onGearAdd(gear) + if (!GetGearType(gear) == gtRCPlane) then + !SetHealth(gear, 10) + end + if (!GetGearType(gear) == gtJetpack) then + !SetHealth(gear, 1000) + end + if (!GetGearType(gear) == gtMine) then + !SetHealth(gear, 0) + end + end + + +
=== !SetEffect(gearUid, effect, true/false) (0.9.14 / dev) ===