xponen

paralyze calculator

Jul 7th, 2013
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.67 KB | None | 0 0
  1. local function Paralyze(unitID, frameCount)
  2.     local health, maxHealth, paralyzeDamage = Spring.GetUnitHealth(unitID)
  3.     local second = math.abs(frameCount*(1/30)) --because each frame took 1/30 second
  4.     second = second-1-1/16 --because at 0% it took 1 second to recover, and paralyze is in slow update (1/16)
  5.     --Note: ZK use
  6.     --paralyzeAtMaxHealth=true, and
  7.     --unitParalysisDeclineScale=40
  8.     local paralyze = maxHealth+maxHealth*second/40 --a full health of paralyzepoints represent 1 second of paralyze, additional health/40 paralyzepoints represent +1 second of paralyze. Reference: modrules.lua, Unit.cpp(spring).
  9.     Spring.SetUnitHealth(unitID, { paralyze = paralyze })
  10. end
Advertisement
Add Comment
Please, Sign In to add comment