HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Random movement trigger?

05-10-2007, 09:58 PM#1
Ember-Magic
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. :P)

Any help would be appreciated. :D

Ember-Magic
05-11-2007, 01:17 PM#2
Vexorian
Quote:
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.

Please ellaborate what do you want to do? "If it moved to 2 the unit would move to 5" What unit, and what is it?

Also, no you wouldn't need to "learn ai" since the internal ai is only good at melee games, but you will have to make ai, which would mean to make the unit follow the certain random algorithm you are making.

I think it would be possible in GUI, but if you want to keep your sanity you should do this in Jass, even so you might need vJass, seriously, some [][] notation might save your life here, or at least you'll have to make a function for matrix indexes and that stuff.
05-11-2007, 01:20 PM#3
Toink
Quote:
Originally Posted by Vexorian
Please ellaborate what do you want to do? "If it moved to 2 the unit would move to 5" What unit, and what is it?

DL Pyramid Escape, play Ghost Path, voila.

EDIT: But I'll elaborate..
Code:
O-O-O-O-O
|  |  |  |  | 
O-O-O-O-O
|  |  |  |  | 
O-O-O-O-O

That means makes a unit go to a random location( in this case the 'O' )
05-11-2007, 01:29 PM#4
Vexorian
Thanks, but no thanks?
05-11-2007, 01:35 PM#5
Toink
You're welcome.
05-11-2007, 10:55 PM#6
Centreri
If I understand the problem correctly, this is easy to do. It would take a few triggers, probably, one per location, perhaps, but very possible in GUI.

If all you really need is random movement, then for each location make a trigger that says something like
Events: 'Unit enters location X'
Conditions:
Actions:
Set Int1 to random integer from 1 to four.
Condition/Action/Else: If variable Int1 is 1, order unit x to move to location x. Else, Condition/Action/Else: If variable Int1 is 2, order unit x to move to location y. Else, Condition/Action/Else, etc.