• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Trigger doesn't work

Status
Not open for further replies.
Level 4
Joined
Sep 11, 2018
Messages
74
This trigger doesnt seem to work. Every second the dummy casts invisibility even though theres a condition for it. I have to create 'Unit - Enter Region' triggers for each hiding spot and then it works.
prob.jpg
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
The condition isn't the problem; how you've structured your if statements is. Every second it checks if the unit in each of 5 regions, but if has the buff and hidingspot[(Integer A)] contains protagonist ever evaluates to false while it has the buff, the buff is then removed. The unit can't be in all 5 regions simultaneously unless they all overlap, so one of those checks will always evaluate to false and it will always clear the buff, then attempt to re-add it. Instead you need to check that all of the regions as a whole don't contain the unit (not just that a least 1 of them doesn't contain it). I would structure this check like this:

  • Set IsHiding = false
  • For each (Integer A) from 1 to 5 do (Actions)
    • Loop - Actions
      • If (All conditions are true) then do...
        • If - Conditions
          • (hidingspot[(Integer A)] contains protagonist) equal to true
        • Then - Actions
          • Set IsHiding = true
        • Else - Actions
  • If (All conditions are true) then do...
    • If - Conditions
      • IsHiding = false
      • (protagonist has buff Invisibility) equal to true
    • Then - Actions
      • Unit - Remove Invisibility buff from protagonist
    • Else - Actions
  • If (All conditions are true) then do...
    • If - Conditions
      • IsHiding = true
      • (protagonist has buff Invisibility) equal to false
    • Then - Actions
      • -------- create dummy, cast invis --------
    • Else - Actions
 
Status
Not open for further replies.
Top