[Trigger] Confused Why This Condition Isn't Being Met

Level 21
Joined
Mar 16, 2008
Messages
955
Edit: just broke the trigger in 2 and added a 0.5 sec timer. @GrapesOfWath also created an extended gui to solve this problem

Seems the condition in the loop of the king unit isn't being met and I can't figure out why.

Seems some regions work and some do not. Not sure why

1743999741004.png

  • Red Hire Offer
    • Events
      • Unit - A unit enters Red Yellow Altar <gen>
      • Unit - A unit enters Red OJ Altar <gen>
      • Unit - A unit enters Red LG Altar <gen>
      • Unit - A unit enters Red Pink Altar <gen>
      • Unit - A unit enters Red Gray Altar <gen>
      • Unit - A unit enters Red LB Altar <gen>
      • Unit - A unit enters Red DG Altar <gen>
      • Unit - A unit enters Red Brown Altar <gen>
      • Unit - A unit enters Light Brown Red Altar <gen>
      • Unit - A unit enters Peach Red Altar <gen>
      • Unit - A unit enters Lime Red Altar <gen>
      • Unit - A unit enters Light Purple Red Altar <gen>
    • Conditions
      • (Entering unit) Equal to Red_King
    • Actions
      • For each (Integer integer_red_hire_loop) from 5 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (altar_regions_red[integer_red_hire_loop] contains Red_King) Equal to True
            • Then - Actions
              • Set VariableSet integer_red_hire_target = integer_red_hire_loop
            • Else - Actions
      • For each (Integer integer_red_hire_loop) from 17 to 20, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (altar_regions_red[integer_red_hire_loop] contains Red_King) Equal to True
            • Then - Actions
              • Set VariableSet integer_red_hire_target = integer_red_hire_loop
            • Else - Actions
      • Player Group - Pick every player in Knights_Group_Var and do (Actions)
        • Loop - Actions
          • Dialog - Hide Hire_Dialog_Menu_Red for (Picked player)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Knight_Altar_Var[integer_red_hire_target] is alive) Equal to True
        • Then - Actions
          • Dialog - Show Hire_Dialog_Menu_Red for Player_array_var[integer_red_hire_target]
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Red_King is alive) Equal to True
        • Then - Actions
          • Unit - Move Red_King instantly to King_Vendor_Red
        • Else - Actions
      • Countdown Timer - Pause king_offer_join_timer[1]
      • Countdown Timer - Start king_offer_join_timer[1] as a One-shot timer that will expire in 5.00 seconds

  • Red King Trained
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
      • (Owner of (Trained unit)) Equal to Player 1 (Red)
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Trained unit)) Equal to Royal Sovereign
          • (Unit-type of (Trained unit)) Equal to Royal Monarch
          • (Unit-type of (Trained unit)) Equal to Royal Majesty
    • Actions
      • Set VariableSet Red_King = (Trained unit)
      • Set VariableSet knight_type[1] = (Name of (Trained unit))
      • Hero - Create Royal Orb of Fire and give it to (Trained unit)
      • Item - Make (Last created item) Drop from Heroes upon death
      • Hero - Create Artifact Shard and give it to (Trained unit)
      • Item - Make (Last created item) Drop from Heroes upon death
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • moon_gem_king Equal to 1
          • (moon_gem is owned) Equal to False
        • Then - Actions
          • Hero - Give moon_gem to Red_King
        • Else - Actions
          • Hero - Give bok_item[1] to Red_King
      • Trigger - Turn off Limit King Cancel Red <gen>
      • Trigger - Turn off Limit King Train Red <gen>
      • Trigger - Turn off (This trigger)
  • Set Region and Point Variables
    • Events
      • Time - Elapsed game time is 0.10 seconds
    • Conditions
    • Actions
      • Set VariableSet Recent_Dead_Castle_Point_Var = (Center of Center Rally Point <gen>)
      • Set VariableSet blk_default_pt_array[5] = (Center of Black Default Yellow <gen>)
      • Set VariableSet blk_default_pt_array[6] = (Center of Black Default OJ <gen>)
      • Set VariableSet blk_default_pt_array[7] = (Center of Black Default LG <gen>)
      • Set VariableSet blk_default_pt_array[8] = (Center of Black Default Pink <gen>)
      • Set VariableSet blk_default_pt_array[9] = (Center of Black Default Gray <gen>)
      • Set VariableSet blk_default_pt_array[10] = (Center of Black Default LB <gen>)
      • Set VariableSet blk_default_pt_array[11] = (Center of Black Default DG <gen>)
      • Set VariableSet blk_default_pt_array[12] = (Center of Black Default Brown <gen>)
      • Set VariableSet blk_default_pt_array[17] = (Center of Black Default Lght Brn <gen>)
      • Set VariableSet blk_default_pt_array[18] = (Center of Black Default Lght Brn <gen>)
      • Set VariableSet blk_default_pt_array[19] = (Center of Black Default Lime <gen>)
      • Set VariableSet blk_default_pt_array[20] = (Center of Black Default Lght Purp <gen>)
      • Set VariableSet RedMobaSpawnMid_Varx = (Center of Red Moba Spawn Mid <gen>)
      • Set VariableSet RedMobaSpawnWest_Var = (Center of Red Moba Spawn West <gen>)
      • Set VariableSet RedMobaSpawnEast_Var = (Center of Red Moba Spawn East <gen>)
      • Set VariableSet BlueMobaSpawnMid_Var = (Center of Blue Moba Spawn Mid <gen>)
      • Set VariableSet BlueMobaSpawnNorth_Var = (Center of Blue Moba Spawn North <gen>)
      • Set VariableSet BlueMobaSpawnSouth_Var = (Center of Blue Moba Spawn South <gen>)
      • Set VariableSet TealMobaSpawnMid_Var = (Center of Teal Moba Spawn Mid <gen>)
      • Set VariableSet TealMobaSpawnWest_Var = (Center of Teal Moba Spawn West <gen>)
      • Set VariableSet TealMobaSpawnEast_Var = (Center of Teal Moba Spawn East <gen>)
      • Set VariableSet PumpMobaSpawnMid_Var = (Center of Purple Moba Spawn Mid <gen>)
      • Set VariableSet PumpMobaSpawnTop_Var = (Center of Purp Moba Spawn North <gen>)
      • Set VariableSet PumpMobaSpawnBot_Var = (Center of Purp Moba Spawn South <gen>)
      • Set VariableSet Mid_Moba_Rally_Pt = (Center of Center Moba Region <gen>)
      • Set VariableSet Red_CastlePt_Var = (Center of Red Castle <gen>)
      • Set VariableSet Blue_CastlePt_Var = (Center of Blue Castle <gen>)
      • Set VariableSet Teal_CastlePt_Var = (Center of Teal Castle <gen>)
      • Set VariableSet Purp_CastlePt_Var = (Center of Purple Castle <gen>)
      • Set VariableSet Creep_Center_Var = (Center of Creep Center <gen>)
      • Set VariableSet Creep_NE_Var = (Center of NE <gen>)
      • Set VariableSet Creep_NW_Var = (Center of NW <gen>)
      • Set VariableSet Creep_SE_Var = (Center of SE <gen>)
      • Set VariableSet Creep_SW_Var = (Center of SW <gen>)
      • Set VariableSet Middle_NW_Var = (Center of Middle NW <gen>)
      • Set VariableSet Middle_SE_Var = (Center of Middle SE <gen>)
      • Set VariableSet Map_Center_Point_Var = (Center of Map Center <gen>)
      • Set VariableSet Center_Point_Var = (Center of Center Rally Point <gen>)
      • Set VariableSet King_Return_Red = (Center of Red king return <gen>)
      • Set VariableSet King_Return_Blue = (Center of Blue King Return <gen>)
      • Set VariableSet King_Return_Teal = (Center of Teal King Return <gen>)
      • Set VariableSet King_Return_Purp = (Center of Purple king Return <gen>)
      • Set VariableSet king_vendor[1] = (Center of Red Ftn <gen>)
      • Set VariableSet king_vendor[2] = (Center of Blue Ftn <gen>)
      • Set VariableSet king_vendor[3] = (Center of Teal Ftn <gen>)
      • Set VariableSet king_vendor[4] = (Center of Purp Ftn <gen>)
      • Set VariableSet King_Vendor_Red = (Center of Red Ftn <gen>)
      • Set VariableSet King_Vendor_Blue = (Center of Blue Ftn <gen>)
      • Set VariableSet King_Vendor_Teal = (Center of Teal Ftn <gen>)
      • Set VariableSet King_Vendor_Purp = (Center of Purp Ftn <gen>)
      • Set VariableSet Boss_Room_Point_Var_Fire = (Center of Fire Golem <gen>)
      • Set VariableSet Boss_Room_Point_Var_Water = (Center of Water Leviathan <gen>)
      • Set VariableSet Boss_Room_Point_Var_Wind = (Center of Storm <gen>)
      • Set VariableSet Boss_Room_Point_Var_Snow = (Center of Penguin <gen>)
      • Set VariableSet Ember_Base_Pt_Var = (Center of Ember Base <gen>)
      • Set VariableSet NE_Well_Pt_Var[1] = (Center of NEWell 1 <gen>)
      • Set VariableSet NE_Well_Pt_Var[2] = (Center of NEWell 2 <gen>)
      • Set VariableSet NE_Well_Pt_Var[3] = (Center of NEWell 3 <gen>)
      • Set VariableSet NE_Well_Pt_Var[4] = (Center of NEWell 4 <gen>)
      • Set VariableSet NE_Bowl_Pt_Var[1] = (Center of NEBowl 1 <gen>)
      • Set VariableSet NE_Bowl_Pt_Var[2] = (Center of NEBowl 2 <gen>)
      • Set VariableSet NE_Bowl_Pt_Var[3] = (Center of NEBowl 3 <gen>)
      • Set VariableSet NE_Bowl_Pt_Var[4] = (Center of NEBowl 4 <gen>)
      • Set VariableSet NE_Bowl_Pt_Var[5] = (Center of NEBowl 5 <gen>)
      • Set VariableSet NE_Bowl_Pt_Var[6] = (Center of NEBowl 6 <gen>)
      • Set VariableSet Hell_Entrance_Pt_Var = (Center of Hell Entrance <gen>)
      • Set VariableSet Portal_to_Hev_Pt_Var = (Center of End of Hell Heaven Entrance <gen>)
      • Set VariableSet Hev_Pt_Var = (Center of Heaven <gen>)
      • Set VariableSet old_god_entry_pt[1] = (Center of Cthuun Entrance <gen>)
      • Set VariableSet old_god_entry_pt[2] = (Center of Yogg Entrance <gen>)
      • Set VariableSet old_god_entry_pt[3] = (Center of Nzoth Entrance <gen>)
      • Set VariableSet old_god_entry_pt[4] = (Center of Melbu Entrance <gen>)
      • Set VariableSet Hell_Owl1_Pt_Var[1] = (Center of Hell Owl 1 East <gen>)
      • Set VariableSet Hell_Owl1_Pt_Var[2] = (Center of Hell Owl 1 West <gen>)
      • Set VariableSet Hell_Owl2_Pt_Var[1] = (Center of Hell Owl 2 East <gen>)
      • Set VariableSet Hell_Owl2_Pt_Var[2] = (Center of Hell Owl 2 West <gen>)
      • Set VariableSet altar_regions_red[5] = Red Yellow Altar <gen>
      • Set VariableSet altar_regions_red[6] = Red OJ Altar <gen>
      • Set VariableSet altar_regions_red[7] = Red LG Altar <gen>
      • Set VariableSet altar_regions_red[8] = Red Pink Altar <gen>
      • Set VariableSet altar_regions_red[9] = Red Gray Altar <gen>
      • Set VariableSet altar_regions_red[10] = Red LB Altar <gen>
      • Set VariableSet altar_regions_red[11] = Red DG Altar <gen>
      • Set VariableSet altar_regions_red[12] = Red Brown Altar <gen>
      • Set VariableSet altar_regions_red[17] = Light Brown Red Altar <gen>
      • Set VariableSet altar_regions_red[18] = Peach Red Altar <gen>
      • Set VariableSet altar_regions_red[19] = Lime Red Altar <gen>
      • Set VariableSet altar_regions_red[20] = Light Purple Red Altar <gen>
      • Set VariableSet altar_regions_blue[5] = Blue Yellow Altar <gen>
      • Set VariableSet altar_regions_blue[6] = Blue OJ Altar <gen>
      • Set VariableSet altar_regions_blue[7] = Blue LG Altar <gen>
      • Set VariableSet altar_regions_blue[8] = Blue Pink Altar <gen>
      • Set VariableSet altar_regions_blue[9] = Blue Gray Altar <gen>
      • Set VariableSet altar_regions_blue[10] = Blue DG Altar <gen>
      • Set VariableSet altar_regions_blue[11] = Blue LB Altar <gen>
      • Set VariableSet altar_regions_blue[12] = Blue Brown Altar <gen>
      • Set VariableSet altar_regions_blue[17] = Light Brown Blue Altar <gen>
      • Set VariableSet altar_regions_blue[18] = Peach Blue Altar <gen>
      • Set VariableSet altar_regions_blue[19] = Lime Blue Altar <gen>
      • Set VariableSet altar_regions_blue[20] = Light Purple Blue Altar <gen>
      • Set VariableSet altar_regions_teal[5] = Teal Yellow Altar <gen>
      • Set VariableSet altar_regions_teal[6] = Teal OJ Altar <gen>
      • Set VariableSet altar_regions_teal[7] = Teal LG Altar <gen>
      • Set VariableSet altar_regions_teal[8] = Teal Pink Altar <gen>
      • Set VariableSet altar_regions_teal[9] = Teal Gray Altar <gen>
      • Set VariableSet altar_regions_teal[10] = Teal LB Altar <gen>
      • Set VariableSet altar_regions_teal[11] = Teal DG Altar <gen>
      • Set VariableSet altar_regions_teal[12] = Teal Brown Altar <gen>
      • Set VariableSet altar_regions_teal[17] = Light Brown Teal Altar <gen>
      • Set VariableSet altar_regions_teal[18] = Peach Teal Altar <gen>
      • Set VariableSet altar_regions_teal[19] = Lime Teal Altar <gen>
      • Set VariableSet altar_regions_teal[20] = Light Purple Teal Altar <gen>
      • Set VariableSet altar_regions_purple[5] = PurpYellow Altar <gen>
      • Set VariableSet altar_regions_purple[6] = Purp OJ Altar <gen>
      • Set VariableSet altar_regions_purple[7] = Purp LG Altar <gen>
      • Set VariableSet altar_regions_purple[8] = Purp Pink Altar <gen>
      • Set VariableSet altar_regions_purple[9] = Purp Gray Altar <gen>
      • Set VariableSet altar_regions_purple[10] = Purp DG Altar <gen>
      • Set VariableSet altar_regions_purple[11] = Purp LB Altar <gen>
      • Set VariableSet altar_regions_purple[12] = Purp Brown Altar <gen>
      • Set VariableSet altar_regions_purple[17] = Light Brown Purp Altar <gen>
      • Set VariableSet altar_regions_purple[18] = Peach Purp Altar <gen>
      • Set VariableSet altar_regions_purple[19] = Lime Purp Altar <gen>
      • Set VariableSet altar_regions_purple[20] = Light Purple Purp Altar <gen>
  • [/SPOILER]
 
Last edited:
Level 26
Joined
Aug 18, 2009
Messages
4,099
Units entering a region is a marginal event for the state whether they are in the region, i.e., the question is whether they are considered outside or inside the region at the moment when the event is happening. But also, this event specifically actually does an indirection, it does not directly act on the GUI region, but creates a Jass/Lua region out of it when the event is created (i.e. at map init when specified in event block), so moving the GUI region later on does not affect the area that needs to be entered for the event to fire. Moreover, there is a bug with the GUI region getting converted into a Jass/Lua region in that an additional row and column of 32 world units is added in positive directions (jassdoc/common.j at 4034ef5cffe9e9fbc2245e960036d3b6cafd8fb4 · lep/jassdoc). What you are probably experiencing is that when you approach the regions from bottom or left side, that the unit is correctly considered to be inside the region, whereas it is not when the region is entered from top or right side.
 
Level 21
Joined
Mar 16, 2008
Messages
955
Is the trigger at main post the updated one? Is it solved or still need solving?
Solved the trigger being ran by a timer started by the "unit enters" event.

It was strange because entering the regions from the right did NOT work. But entering the regions from the left DID work without the timer fix.
 
Top