• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece!🔗 Click here to enter!

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 39
Joined
Feb 27, 2007
Messages
5,031
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