LuaAPI.wiki
changeset 823 83dacaa4d7d0
parent 822 a946cbc1e636
child 824 adfb23d8bc13
equal deleted inserted replaced
822:a946cbc1e636 823:83dacaa4d7d0
   773 
   773 
   774 === <tt>!SetEffect(gearUid, effect, effectState)</tt> ===
   774 === <tt>!SetEffect(gearUid, effect, effectState)</tt> ===
   775 Sets the state for one of the effects <tt>heInvulnerable, heResurrectable, hePoisoned, heResurrected, heFrozen</tt> for the specified hedgehog gear.
   775 Sets the state for one of the effects <tt>heInvulnerable, heResurrectable, hePoisoned, heResurrected, heFrozen</tt> for the specified hedgehog gear.
   776 A value of 0 usually means the effect is disabled, values other than that indicate that it is enabled and in some cases specify e.g. the remaining time of that effect.
   776 A value of 0 usually means the effect is disabled, values other than that indicate that it is enabled and in some cases specify e.g. the remaining time of that effect.
   777 
   777 
   778 Example (sets all bots poisoned):
   778 || *`effect`* || *Desription* || *`effectState`* ||
       
   779 || `heInvulnerable` || Wether hog is invulnerable || Any non-zero value turns on invulnerability. `0` turns it off. ||
       
   780 || `hePoisoned` || Poison damage, damages hog each turn. || Amount of damage per turn. Use `0` to disable poisoning. ||
       
   781 || `heResurrectable` || Whether to resurrect the hog on death || With a non-zero value, the hedgehog will be resurrected and teleported to a random location on death. `0` disables this. ||
       
   782 || `heResurrected` || Whether the hedgehog has been resurrected once. This is only a graphical effect. || With a non-zero value, the hedgehog was resurrected, `0` otherwise. ||
       
   783 || `heFroze` || Freeze level. Frozen hedgehogs skip turn, are heavy and take half damage || The number denotes “how frozen” the hedgehog is, i.e. how long it. The freezer sets this to `199999` initially. The value will be reduced by `50000` each round. If `0`, hedgehog is not frozen. The value will also be used for some other things by the engine, like animation, etc. ||
       
   784 
       
   785 Example (sets all bots poisoned with poison damage of 1):
   779 
   786 
   780 <code language="lua">    function onGearAdd(gear)
   787 <code language="lua">    function onGearAdd(gear)
   781         if (GetGearType(gear) == gtHedgehog) and (GetHogLevel(gear) > 0) then
   788         if (GetGearType(gear) == gtHedgehog) and (GetHogLevel(gear) > 0) then
   782             SetEffect(gear, hePoisoned, 1)
   789             SetEffect(gear, hePoisoned, 1)
   783         end
   790         end
   784     end</code>
   791     end</code>
   785 
   792 
   786 *Note*: prior to the ice-gun release, 0.9.19 (commit r10a0a31804f3) `effectState` was of boolean type (`true` = effect enabled, `false` = effect disabled)
   793 *Historic note*: prior to the ice-gun release, 0.9.19 (commit r10a0a31804f3) `effectState` was of boolean type (`true` = effect enabled, `false` = effect disabled)
   787 
   794 
   788 === <tt>CopyPV(gearUid, gearUid)</tt> ===
   795 === <tt>CopyPV(gearUid, gearUid)</tt> ===
   789 This sets the position and velocity of the second gear to the first one.
   796 This sets the position and velocity of the second gear to the first one.
   790 
   797 
   791 === <tt>!FollowGear(gearUid)</tt> ===
   798 === <tt>!FollowGear(gearUid)</tt> ===