Well I'm making a Maze Escape map that when you beat a level you get ported to another random level in the maze; for instance Area of Ice Escape works in that sense.
Currently I'm using AceHart's Non-Repeating Integer Sequence to do this (AceHart's Tutorial); but every now and then I get a level that repeats, as in when I beat the level I just get ported right back to the start of the level again sometimes.
This is how I'm using AceHart's system at the moment...
(Ps: I shortened the Sequence Total variable from 34 to 5 and the If Then and Else conditions from 34 actions to 5 actions so it would be much more easier to read. :thup: You should get the idea though.)
(Pps: To be obvious I have 34 levels in my Maze in total. )
The next trigger is the one I'm using to port the player and other players when they reach the end of the level. To be explanatory I have the upcoming trigger placed in my map 34 times, 1 for each level that I have.
And to be clear when the "Level1End" trigger is run it runs the "SequenceEnd" trigger which runs the random integer action and in return sets the respawn variable for the "Level1End" trigger.
Ps. The Levels region variable is set on map initialization in this manner...
If anyone has any ideas on if I'm missing something in one of my triggers, or if I added something wrong, don't hesitate to tell me; I'm willing to try anything at this point.
Seriously any help is appreciated
Thanks Anvio.
Currently I'm using AceHart's Non-Repeating Integer Sequence to do this (AceHart's Tutorial); but every now and then I get a level that repeats, as in when I beat the level I just get ported right back to the start of the level again sometimes.
This is how I'm using AceHart's system at the moment...
(Ps: I shortened the Sequence Total variable from 34 to 5 and the If Then and Else conditions from 34 actions to 5 actions so it would be much more easier to read. :thup: You should get the idea though.)
(Pps: To be obvious I have 34 levels in my Maze in total. )
Trigger:
- SequenceStart
- Events
- Map initialization
- Conditions
- Actions
- Set SequenceTotal = 5
- For each (Integer A) from 1 to SequenceTotal, do (Actions)
- Loop - Actions
- Set Sequence[(Integer A)] = (Integer A)
- Loop - Actions
- Set SequenceCurrent = SequenceTotal
- Events
Trigger:
- SequenceEnd
- Events
- Conditions
- Actions
- Set RandomLevel = (Random integer number between 1 and SequenceCurrent)
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- RandomLevel Equal to 1
- Then - Actions
- Set Respawn = Levels[1]
- Else - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- RandomLevel Equal to 2
- Then - Actions
- Set Respawn = Levels[2]
- Else - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- RandomLevel Equal to 3
- Then - Actions
- Set Respawn = Levels[3]
- Else - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- RandomLevel Equal to 4
- Then - Actions
- Set Respawn = Levels[4]
- Else - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- RandomLevel Equal to 5
- Then - Actions
- Set Respawn = Levels[5]
- Else - Actions
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- Set Sequence[RandomLevel] = Sequence[SequenceCurrent]
- Set SequenceCurrent = (SequenceCurrent - 1)
The next trigger is the one I'm using to port the player and other players when they reach the end of the level. To be explanatory I have the upcoming trigger placed in my map 34 times, 1 for each level that I have.
And to be clear when the "Level1End" trigger is run it runs the "SequenceEnd" trigger which runs the random integer action and in return sets the respawn variable for the "Level1End" trigger.
Trigger:
- Level1End
- Events
- Unit - A unit enters Region 066 <gen>
- Conditions
- (Unit-type of (Triggering unit)) Equal to Hero_Type
- Actions
- Trigger - Turn off Lose <gen>
- Trigger - Turn off RedDeath <gen>
- Trigger - Turn off BlueDeath <gen>
- Trigger - Turn off TealDeath <gen>
- Trigger - Turn off PurpleDeath <gen>
- Trigger - Turn off YellowDeath <gen>
- Trigger - Turn off OrangeDeath <gen>
- Trigger - Turn off GreenDeath <gen>
- Trigger - Turn off PinkDeath <gen>
- Trigger - Turn off GrayDeath <gen>
- Trigger - Turn off LightBlueDeath <gen>
- Trigger - Turn off DarkGreenDeath <gen>
- Trigger - Run SequenceEnd <gen> (checking conditions)
- Set Level = (Level + 1)
- Hero - Set (Triggering unit) Hero-level to ((Hero level of (Triggering unit)) + 1), Hide level-up graphics
- Set Heroes = (Units of type Hero_Type)
- Unit Group - Pick every unit in Heroes and do (Unit - Kill (Picked unit))
- Player Group - Pick every player in (All players) and do (Camera - Pan camera for (Picked player) to (Center of Respawn) over 0.00 seconds)
- Unit Group - Pick every unit in Heroes and do (Hero - Instantly revive (Picked unit) at (Center of Respawn), Show revival graphics)
- Trigger - Turn on RedDeath <gen>
- Trigger - Turn on BlueDeath <gen>
- Trigger - Turn on TealDeath <gen>
- Trigger - Turn on PurpleDeath <gen>
- Trigger - Turn on YellowDeath <gen>
- Trigger - Turn on OrangeDeath <gen>
- Trigger - Turn on GreenDeath <gen>
- Trigger - Turn on PinkDeath <gen>
- Trigger - Turn on GrayDeath <gen>
- Trigger - Turn on LightBlueDeath <gen>
- Trigger - Turn on DarkGreenDeath <gen>
- Trigger - Turn on Lose <gen>
- Custom script: call DestroyGroup( udg_Heroes )
- Custom script: call DestroyTrigger( GetTriggeringTrigger() )
- Events
Ps. The Levels region variable is set on map initialization in this manner...
Trigger:
- SetRegionsStart
- Events
- Map initialization
- Conditions
- Actions
- Set Levels[1] = Region 001 <gen>
- Set Levels[2] = Region 002 <gen>
- Set Levels[3] = Region 003 <gen>
- Set Levels[4] = Region 004 <gen>
- Set Levels[5] = Region 005 <gen>
- All the way up to 34...
- Events
If anyone has any ideas on if I'm missing something in one of my triggers, or if I added something wrong, don't hesitate to tell me; I'm willing to try anything at this point.
Seriously any help is appreciated
Thanks Anvio.