# [Trigger]Random movement trigger?

Status
Not open for further replies.

#### Ember-Magic

Level 1
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:

(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. )

Any help would be appreciated.

Ember-Magic

#### PurplePoot

Level 40
• The Randominator
• Events
• (something happens, probably A Unit Enters <Region>)
• Conditions
• 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

Last edited:

#### Dr Super Good

Spell Reviewer
Level 64
Use conditions with random integer comparisions.

Thinking WEU or any programming language has an OR function built in is a bad idea since how will one tell what chance what is meant to happen? Thus conditions work best. . .

#### Ember-Magic

Level 1
Thanks a lot, guys.

I've got it working now.

Status
Not open for further replies.

Replies
9
Views
818
[Trigger] Unique Random
Replies
3
Views
647
Replies
5
Views
633
[Trigger] Range of 1 Square
Replies
2
Views
733
[Trigger] Duel trigger
Replies
10
Views
1K