ZooeyBot icon indicating copy to clipboard operation
ZooeyBot copied to clipboard

[Informational] Triggering an action only once after a condition is met

Open Masuzu opened this issue 7 years ago • 0 comments

This pattern can be very convenient to perform specific actions after some boss special triggers. For instance, in the current August 2017 Water Guild War, you may want to use clear right after the 75% HP trigger and only once before the 50% trigger is reached. You can achieve this using custom variables as follows:

--[[Other actions--]]
if enemy_1.hp_percentage < 75 and enemy_1.hp_percentage > 50 then
  if booleans["75% trigger reached"] == nil then
    booleans["75% trigger reached"] = true
    --[[The code in this 'if' block will only execute once--]]
    ...
  end
end
--[[Other actions--]]

Masuzu avatar Aug 17 '17 18:08 Masuzu