What would the trigger be...?

Calibrator

New Member
Reaction score
1
Im making a Ice Escape-Like maze. Its a ice maze typically. One of its triggers makes it start at a randoms level and when you beet that lvl you go to a different lvl. Its always different, so its not in seqeunce, its actually random. What would the trigger be for that? Ty for any answers =D.
 

bumbaclo

New Member
Reaction score
3
Well from what I understand...you could set each of your starting regions to a number (from 1 onward), and then use a trigger to move all the units to a random region by picking a random integer from the set of 1 to however many levels u have.
 

Calibrator

New Member
Reaction score
1
Thats what i was thinking too, but where would the (random region from 1-(whatever)) Trigger be located? Like at which drop down select D=?
 

bumbaclo

New Member
Reaction score
3
So basically make a region variable with an array. Then pre-set each of the starting regions, e.g. Start[1] = region 1, Start[2] = region 2, etc...Set another variable Random = Random integer from 1 to (# of regions). Then for the trigger action do: Move units to Start[Random].

The only problem i see is that it could also move to the same level, or a level previously done. So after every level is finished you could set the region for that level to no region, and use an if statement for the trigger: If Start[Random] = no region, then Run the trigger again (ignoring conditions).

This is a freehand draft so someone else can correct the mistakes if there are any.
 

Calibrator

New Member
Reaction score
1
I forgot to say this, im not so good with variables xD. Can you explain a little easier? (or even better, step-by-step for the variables xD). Sorry, but everyone starts somewhere =D
 

bumbaclo

New Member
Reaction score
3
Ok so I got my editor out and heres two triggers you need:

Trigger:
  • Untitled Trigger 001
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Start[0] = Region 000 <gen>
      • Set Start[1] = Region 001 <gen>
      • Set Start[2] = Region 002 <gen>


Trigger:
  • Untitled Trigger 002
    • Events
    • Conditions
    • Actions
      • Set Random = (Random integer number between 1 and 10)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • LevelDone[Random] Equal to True
        • Then - Actions
          • Trigger - Run (This trigger) (ignoring conditions)
        • Else - Actions
          • Unit - Move (Triggering unit) instantly to (Center of Start[Random])


There are 3 variables here: Start, LevelDone, and Random.
Start is a region array, Leveldone is a boolean array, and Random is an integer.
To make arrays, when creating the variable, check the "array" box on the lower left corner.

The first trigger is to pre-set all the different Start regions.
The second trigger shows the actions: Random will be set from 1 to the # of regions you have. When a level is finished, set LevelDone[# corresponding to the start region] = true. For example: If you put the Level which starts at Region A as 1, then when you finish the level, put LevelDone[1] = True as well.
 

Calibrator

New Member
Reaction score
1
Hm, i did that and edited so when it hit a region, it would run that trigger, but it kills me. thats all it does. Kills the trigger unit. Anyone else know how to do what i asked?
 

Calibrator

New Member
Reaction score
1
It worked. But it randoms the same thing every time i restart the game. it goes lvl 4 - 2 -3 , but it doesnt change if i restart the game. It keeps going 4-2-3. How can i make it so that it is different each game?
 

Seprest

New Member
Reaction score
15
Don't bump more than once in 24 hours. Most of us look at most posts on the entire front page and will offer suggestions if we have them.


If you only want to use each 'level' once, then you must set the slot in the boolean array corresponding to the random number to false. The boolean array must also be set to false in all indexes by default.

If the second trigger does not have an event, it is quite possible 4-2-3 is the default order your map teleports your unit to when you hit the end of each of those levels. If you were using a teleport-like trigger using circle of powers ect beforehand, make sure you disable them and change whatever event you used to use to move the unit between levels, to instead be the event for the 2nd trigger posted above.
 

Calibrator

New Member
Reaction score
1
Sadly, i did everything you said, and at the same result. The sequence didnt change at all. (oh, and i had already done everything you said, but i double checked, but still nothing). This is my trigger below.
 

Attachments

  • Crude.png
    Crude.png
    43.5 KB · Views: 156

Seprest

New Member
Reaction score
15
You create a unit gorup in your final action that isn't used.... You just need to move the triggering unit or all units in that unit group, but you only move the triggering unit.


Also why would you run the trigger ignoring conditions? Just make it so that it runs the trigger with conditions.


Now, if you REALLY want to make sure that the first level you go to is random.

Make a different trigger for the first teleportCircle(or whatever you use) that doesn't take into consideration if any of the levels are done, because you should have just started the map. I suggest you try to get THAT trigger to work. It is pretty simple, just teleport to a random region in your region array.

Also set an integer that you increase each trigger, so that this trigger doesn't keep going on after all 3 levels have been exhausted.
 

Calibrator

New Member
Reaction score
1
I did everything you said, and now it takes me to random levels, but it takes me to level that i have already done. Any idea how to make it so it only does level i HAVENT done?
 

Seprest

New Member
Reaction score
15
implement the boolean array :thup:

As in the first trigger you tried. Experiment till it works. Remember, set each spot in the boolean array to false when the map is initialized.
 

Calibrator

New Member
Reaction score
1
Oh, i think i know whats wrong.

LevelDone[random]

Wouldnt that make a level be done, but randomly? So the lvl it sets to *done* wouldnt be the same as the Start[random] that i got sent to. Hm... And i dont know what you mean by implement D:
 

Seprest

New Member
Reaction score
15
The LevelDone = true does not set that index it to true. It just checks if it IS true, the = does not set it in this situation, because you are doing a (if/then/else) statement, not SET LevelDone[Random] = true

What it actually does is CHECK if a RandomLevel is TRUE or FALSE, it does not set anything! If the LevelDone[Random] = true, then it will keep running the trigger until it gets a LevelDone[Random] = false (and thus go on to the else statement. I hope you understand it now ;)

The boolean is not there to check off what levels are done per se. It is only there to check IF a level is done. Make sure the boolean array has all needed indexes set to FALSE at the beggining of the map. Also make sure each time a level is selected as not done, and you are teleported to it, you SET LevelDone[Random] = true as an action in the same else statement.

Also make sure you add this ad the beginning of your actions:
Trigger:
  • For each (Integer A) from 1 to 5, do (If (LevelDone[(Integer A)] Equal to True) then do (Set DoneCount = (DoneCount + 1)) else do (Do nothing))
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • DoneCount Equal to 5
      • Then - Actions
        • Trigger - Turn off (This trigger)
      • Else - Actions
        • Set DoneCount = 0


DoneCount just checks how many of the levels are done, if all are done, it will stop the trigger. Change all the 5's to the # of levels you have. You'll need to make an integer variable for DoneCount, with it set to 0.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top