lua:scripting:examples:findtargets
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
lua:scripting:examples:findtargets [2024/07/04 21:34] – astark | lua:scripting:examples:findtargets [2024/07/04 21:36] (current) – astark | ||
---|---|---|---|
Line 32: | Line 32: | ||
</ | </ | ||
+ | |||
====== Using the targets ====== | ====== Using the targets ====== | ||
+ | |||
+ | FIrst we call the ' | ||
+ | |||
+ | <code lua> | ||
+ | getTargets() | ||
+ | |||
+ | if target then | ||
+ | targetHp = target.hp / target.maxhp * 100 | ||
+ | end | ||
+ | |||
+ | if healer then | ||
+ | healerHp = healer.hp / healer.maxhp * 100 | ||
+ | end | ||
+ | |||
+ | -- Re-target in case of rescue | ||
+ | if rand(20) and not(target == nil) then | ||
+ | mdo(" | ||
+ | end | ||
+ | |||
+ | if targetHp <20 or healerHp <20 then | ||
+ | mdo(" | ||
+ | mdo(" | ||
+ | lag = lag + 2 | ||
+ | return | ||
+ | elseif targetHp <90 then | ||
+ | mdo(" | ||
+ | end | ||
+ | |||
+ | </ | ||
lua/scripting/examples/findtargets.1720128860.txt.gz · Last modified: 2024/07/04 21:34 by astark