• 🏆 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!

[Trigger] Random movement trigger?

Status
Not open for further replies.
Level 1
Joined
May 5, 2007
Messages
2
Hello,

Well, today at school I was coming up with ideas for things for my maze to make it unique, and I thought of - if you've ever played Pyramid Escape, you'll probably recognize this - making a unit take a random path through a square area (using regions), and the player had to follow correctly or the player would die.

I've already made a system to determine if the unit (leading unit) has entered a region or not, and to kill the player if he doesn't enter the correct regions, but when I was making this idea, I obviously didn't have the World Editor right in front of me, so I thought that the Actions had an "Or" function to make random things happen, but it turned out that I had gotten it confused with Conditions.

So is there any way to make the unit (leading unit) take a random path? I'm not talking about superly-duperly hard random paths.
To explain, I've made a diagram:
mazediagwr7.png

(Red squares are regions.)
At the start of the maze, the leading unit is at the black dot.
After a player enters the safe-zone for the level with this obstacle, the unit moves to square 1.
After entering square 1, the trigger would move it to either 2, 3, or 4. If it went to square 2, the unit would go to square 5. If it went to square 3, the unit would move to square 7. If it went to square 4, the unit would move to square 6.
After entering a square, the unit would take a random path (left or straight for square 5; left or straight for square 6; right or straight for square 7.) Then on to a predefined path by me.
All paths would lead to square 8, which moves the unit to square 9.
After entering square 9, the unit waits 7 seconds - for the player to finish following it - then moves instantly back to square 1.

So could anyone tell me if there's a trigger to allow this random movement, or am I going to have to learn AI or something? (Which I have no idea how to do. :p)

Any help would be appreciated. :D

Ember-Magic
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
  • The Randominator
    • Events
      • (something happens, probably A Unit Enters <Region>)
    • Conditions
      • (add your conditions here)
    • Actions
      • Set tmpInt = (Random Integer Number between 1 and (max random rects))
      • If (All Conditions are true) Then (do actions) Else (do actions)
        • If - Conditions
          • tmpInt Equal to 1
        • Then - Actions
          • Unit - Order (Triggering Unit) to move to <rect>
        • Else - Actions
          • If (All Conditions are true) Then (do actions) Else (do actions)
            • If - Conditions
              • tmpInt Equal to 2
            • Then - Actions
              • Unit - Order (Triggering Unit) to move to <other rect>
            • Else - Actions
              • [And so on...]
Hope this helps :D
 
Last edited:
Status
Not open for further replies.
Top