• 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.

how can I include multiple circles condition?

Level 2
Joined
Jul 27, 2024
Messages
7
Hello im creating kind of a car map
and I wanted to make a trigger function which: if a player passes threw those 4 regions/circles he receive a gold reward
and if possible to make it that only when he passes threw a certain order 1,2,3,4 circles then the gold reward received.

p.s I understand basic wc3 editor but new to all those event and logic
 
Level 20
Joined
Jan 3, 2022
Messages
364
For each player you need a variable (array) to store the last circle. If player passes circle1 then lastCircle must be 0 to get reward. If rewarded then save current circle number to last circle.

This is basic programming but you'll need to understand how it's done in GUI triggers on top of it.
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
It’s best if you save the regions into an array first so you can easily refer to them sequentially. Then as Luashine said compare the current passed region to the last one. I think it’s also smart to exclude the current region so you could run over it multiple times without failing the loop. A second region array can hold each player’s current region.
  • //set this on map init
  • //player count is needed if you ever want to ‘reset’ the regions for a new race or whatever
  • //this refers to the highest used player slot that a racer could have
  • Set HIGHEST_PLAYER = 24
  • Set GR_COUNT = (GR_COUNT + 1) //doing it this way makes it easy to add any number of regions and still keep the variables updated automatically; also easy to change the order
  • Set GoldRegions[GR_COUNT] = FirstRegion <gen>
  • Trigger - Add to THE REGION TRIGGER <gen> the event: Unit - A unit enters GoldRegions[GR_COUNT]
  • Set GR_COUNT = (GR_COUNT + 1)
  • Set GoldRegions[GR_COUNT] = OtherRegion <gen>
  • Trigger - Add to THE REGION TRIGGER <gen> the event: Unit - A unit enters GoldRegions[GR_COUNT]
  • Set GR_COUNT = (GR_COUNT + 1)
  • Set GoldRegions[GR_COUNT] = SomeRegion <gen>
  • Trigger - Add to THE REGION TRIGGER <gen> the event: Unit - A unit enters GoldRegions[GR_COUNT]
  • Set GR_COUNT = (GR_COUNT + 1)
  • Set GoldRegions[GR_COUNT] = LastRegion <gen>
  • Trigger - Add to THE REGION TRIGGER <gen> the event: Unit - A unit enters GoldRegions[GR_COUNT]
  • For each (Integer A) from 1 to HIGHEST_PLAYER do (Actions)
    • Loop - Actions
      • Set GR_Previous[(Integer A)] = No Region
There is no direct way to learn “which region fired the enters region event” when there are multiple events for the trigger. We must check every region for the triggering unit which is why we made the array.
  • Events
    • //none, we add with the trigger above
  • Conditions
    • //probably check unit type here so this only works for cars
    • //this whole method will fail if a player can have multiple cars at a time and touch rings out of sequence
  • Actions
    • For each (Integer A) from 1 to GR_COUNT do (Actions)
      • Loop - Actions
        • If (All conditions are true) then do (Then actions) else do (Else actions)
          • If - Conditions
            • (GoldRegions[(Integer A)] contains (Triggering Unit)) equal to True
          • Then - Actions
            • Set CurrentRegion = (Integer A) //this is an integer variable not a region variable
            • Custom script: exitwhen true //leave the loop early
          • Else - Actions
    • Set PN = (Player number of (Owner of Triggering Unit))
    • If (All conditions are true) then do (Then actions) else do (Else actions)
      • If - Conditions
        • GR_Previous[PN] equal to GoldRegions[(CurrentRegion - 1)] //by leaving the 0th index null this will actually work for the first gate
      • Then - Actions
        • Set GR_Previous[PN] = GoldRegions[CurrentRegion]
        • If (All conditions are true) then do (Then actions) else do (Else actions)
          • If - Conditions
            • CurrentRegion equal to GR_COUNT
          • Then - Actions
            • Set GR_Previous[PN] = No region
            • //Lap completed, give reward
          • Else - Actions
      • Else - Actions
        • Set GR_Previous[PN] = No region //this resets it all to start at region 1 again
There’s probably an error somewhere in that (mobile triggers are hard) but the method will work. I have had to make one executive choice since your post did not specify: if the wrong ring is driven though should all progress reset to 0, or should it just stay where they are and let them try to find the correct ring?

I made it to reset to the start if you input a ring out of sequence, but you may not want that. In case it’s not clear this sequence would be necessary to complete after skipping gate 3: 124 (oops) 1234. But it’s also possible to make it work like: 124 (oops) 34.
 
Top