• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

A good -ar trigger

Status
Not open for further replies.
Level 7
Joined
Apr 13, 2008
Messages
183
Hey Guys! I have a -ar trigger, but it gives heroes to players that are not playing, it creates the same heroes and there are only 5-6 heroes that it has a chance to give you (the others just can be spawned for you). So I was wondering if someone can help me with a good -ar trigger. ThanK You!
 
Level 5
Joined
Dec 18, 2007
Messages
205
hmm well first of all you should create a global unit type array.
at map intialization set every hero available to that variable, e.g.
Heroes[1]=Demon Hunter
Heroes[2]=Mountain King
...
Next step is creating a boolean array (maybe only a local one, because you only need it in the execution trigger, but if you don't know JASS, just make a normal variable). you will need it, when setting a randomed hero to "picked".

On the execution of the trigger (the event you want), pick every player in all players matching what you want (e.g. Pick every Players in All players matching matching player is playing=true).

make a loop until the player has got a hero:

loop((

set x=random number between 1 and MAXHEROES
if then else function:
if
boolean[x]=false
then
Create a unit of type Heroes[x]
set boolean[x]=true
endif

))loop


I think I've written this in a bit complicated way, but I'm damned tired, so excuse me ;)
And I don't know whether I can answer you soon if you have any questions, but I'll try so.

good luck,
greetz
 
Level 7
Joined
Apr 13, 2008
Messages
183
Can't you make the trigger a little bit like... understandable?!
set x=random number between 1 and MAXHEROES??? what does that mean? And what is the boolean?! I really need your help! Pls explain more... understandable!
 
Level 5
Joined
Dec 18, 2007
Messages
205
well i would say that this is pretty good explained xD
but i try to explain it in detail:

Create 4 variables:
-unit type array (i named it "Heroes")
-boolean array (i named it "Picked")
-integer (i named it "x")
-integer (i named it "MaxHeroes")

Then make the following trigger:

  • Intialization Trigger
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- paste here all units that are available to be randomed in your map --------
      • Set Heroes[1] = Mountain King
      • Set Heroes[2] = Lich
      • -------- afterwards set the MaxHeroes-integer to the total number of available heroes --------
      • Set MaxHeroes = 2
So you give each array a hero and then set the maximum number of heroes available. You will need them for the -ar trigger.
This trigger will somehow look like this, but keep in mind: i didn't test it! but it should work in some way like this:

  • All Random
    • Events
      • Player - Player 1 (Red) types a chat message containing -ar as Exakte Ãœbereinstimmung
    • Conditions
    • Actions
      • Trigger - Turn off (This trigger)
      • Player Group - Pick every player in (All players matching ((((Matching player) controller) equal to User) and (((Matching player) slot status) equal to "is playing?"))) and do (Actions)
        • Loop - Actions
          • -------- now there is some JASS script (Custom script) for the loop, i don't expect you to understand this, but I didn't know how to make this in GUI --------
          • Custom script: loop
          • Set x = (Random integer number between 1 and MaxHeroes)
          • Custom script: exitwhen udg_Picked[udg_x]==false
          • Custom script: endloop
          • -------- the loop exits as soon as it got an unpicked hero because Picked[x] is false and afterwards set to true --------
          • Set Picked[x] = True
          • Einheit - Create 1 Heroes[x] for (Picked player) at (Center of (Playable map area)) facing 270.00 degrees
          • -------- so you got the UnPicked Hero which you can now create where you want --------
And sorry for the german-english trigger, i don't know how to convert german text into english text. If anyone knows, please tell me, that would ease the whole process with changing "Aktionen" -> "Actions" and so on-.-

greetz,
breathl3ss
 
Level 5
Joined
Dec 18, 2007
Messages
205
So now all in all we got the following variables:

---

'Heroes' as an unit type array
'MaxHeroes' as an integer
'x' as an integer
'Picked' as a boolean array
'Repicked' as a boolean array
'Unit' as a unit
'Location' as location (for avoiding a leak)
'Force' as force (avoiding leak)

---

Remember: I made this trigger GUI friendly. I could have made it in JASS, then it would be much easier and leaks could be avoided in a more simple way by using locals etc.

---

Intialization trigger:

  • Intialization Trigger
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- paste here all units that are available to be randomed in your map --------
      • Set Heroes[1] = Bergkönig
      • Set Heroes[2] = Paladin
      • -------- afterwards set the MaxHeroes-integer to the total number of available heroes --------
      • Set MaxHeroes = 2
The new -ar trigger:

  • All Random
    • Events
      • Player - Player 1 (Red) types a chat message containing -ar as "Perfect Match??"
    • Conditions
    • Actions
      • Trigger - Turn off (This trigger)
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • 'IF'-Conditions
              • ((Player((Integer A))) slot status) equal to is playing
              • ((Player((Integer A))) controller) equal to user
            • 'THEN'-Actions
              • Force - Add (Player((Integer A))) to Force
            • 'ELSE'-Actions
      • Force - Pick every player in Force and do (Actions)
        • Loop - Actions
          • Custom script: loop
          • Set x = (Random integer number between 1 and MaxHeroes)
          • Custom script: exitwhen udg_Picked[udg_x]==false
          • Custom script: endloop
          • Set Picked[x] = True
          • Set Location = ((Picked player) start location)
          • Unit - Create 1 Heroes[x] for (Picked player) at Location facing 270.00 degrees
          • Custom script: call RemoveLocation(udg_Location)
      • Custom script: set udg_Location=null
      • Custom script: call DestroyForce(udg_Force)
      • Custom script: set udg_Force=null
      • Trigger - Turn on Repick <gen>
Here's the repick system, i haven't tested it so tell me any errors. The trigger is turned off at default and will be activated when -ar is entered:

  • Repick
    • Events
      • Player - Player 1 (Red) types a chat message containing -repick as "Perfect Match"
    • Conditions
      • Repicked[(Player number of (Triggering player))] equal to False
    • Actions
      • Set Repicked[(Player number of (Triggering player))] = True
      • Set Unit = (Random unit from (Units owned by (Triggering player) matching (((Matching unit) is A Hero) equal to True)))
      • For each (Integer A) from 1 to MaxHeroes, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • 'IF'-Conditions
              • (Unit-type of Unit) equal to Heroes[(Integer A)]
            • 'THEN'-Actions
              • Set Picked[(Integer A)] = False
              • Custom script: loop
              • Set x = (Random integer number between 1 and MaxHeroes)
              • Custom script: exitwhen udg_Picked[udg_x]==false and udg_x!=bj_forLoopAIndex
              • Custom script: endloop
              • Set Picked[x] = True
              • Set Location = ((Picked player) start location)
              • Unit - Create 1 Heroes[x] for (Picked player) at Location facing 270.00 degrees
              • Custom script: call RemoveLocation(udg_Location)
              • Custom script: set udg_Location=null
            • 'ELSE'-Aktionen
and i hope you understand it because i didn't rewrite german into english.

---

the swap system is very complicated and i don't think i will do one, so excuse me. maybe someone else knows this.

---

so good luck with your map and try learning GUI tutorials to get more knowledge. And afterwards change to JASS, it's much easier :p

---

greetings

---

EDIT: Rewrote it into English. Hope you understand now.
 
Last edited:
Level 17
Joined
Jun 28, 2008
Messages
776
There is a simple method that I use.

Set all your heroes into an array unit type eg.
Heros[1] = Lich
Heros[2] = Ranger

ect

The random select

Event
player types -ar
condition

Actions

Pick all playing players
set Player(player varible) = picked player
run Random Trigger(see below)

Then create a random trigger like

Events

Conditions

Actions

Set herocount = 0

Unit group - pick every unit ownd by player [a player varible]
if picked unit is a hero = true then set herocount(integer) to
herocount + 1

if herocount = 0 then
x := math(random number from 1 to max heroes)
order the player to pick the Heros[x]


Then repeat the green text/trigger 10 times

Sorry if this is unclear, I wil post the real trigger when I get my internet workin(this is from a friends pc that does not have WE)
 
Level 17
Joined
Jun 28, 2008
Messages
776
-ar

  • All Random
    • Events
      • Player - Player 2 (Blue) types a chat message containing -ar as An exact match
      • Player - Player 8 (Pink) types a chat message containing -ar as An exact match
    • Conditions
      • Game_Mode Equal to True
    • Actions
      • Game - Display to (All players) the text: Game Modes |CFF7BBE...
      • Set Game_Normal = False
      • Set Game_Mode = False
      • Unit - Add Select Unit AP to Red Tavern 0000 <gen>
      • Unit - Add Select Unit AP to Green Tavern 0057 <gen>
      • Unit - Add Select Unit AP to Pink Tavern 0082 <gen>
      • Unit - Add Select Unit AP to Blue Tavern 0081 <gen>
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Player - Limit training of Heroes to 0 for (Picked player)
      • Wait until (Random_GO Equal to True), checking every 1.00 seconds
      • Player Group - Pick every player in x_Player_AllPlayers and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked player) slot status) Equal to Is playing
            • Then - Actions
              • Player - Limit training of Heroes to 1 for (Picked player)
              • Set x_Player_Index = 0
              • Set x_Player_Random = (Picked player)
              • Unit Group - Pick every unit in (Units owned by x_Player_Random) and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) is A Hero) Equal to True
                    • Then - Actions
                      • Set x_Player_Index = (x_Player_Index + 1)
                    • Else - Actions
                      • Do nothing
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • x_Player_Index Greater than 0
                • Then - Actions
                  • Do nothing
                • Else - Actions
                  • Trigger - Run Random Triger <gen> (ignoring conditions)
              • Unit Group - Pick every unit in (Units owned by x_Player_Random) and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) is A Hero) Equal to True
                    • Then - Actions
                      • Set x_Player_Index = (x_Player_Index + 1)
                    • Else - Actions
                      • Do nothing
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • x_Player_Index Greater than 0
                • Then - Actions
                  • Do nothing
                • Else - Actions
                  • Trigger - Run Random Triger <gen> (ignoring conditions)
              • Unit Group - Pick every unit in (Units owned by x_Player_Random) and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) is A Hero) Equal to True
                    • Then - Actions
                      • Set x_Player_Index = (x_Player_Index + 1)
                    • Else - Actions
                      • Do nothing
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • x_Player_Index Greater than 0
                • Then - Actions
                  • Do nothing
                • Else - Actions
                  • Trigger - Run Random Triger <gen> (ignoring conditions)
              • Unit Group - Pick every unit in (Units owned by x_Player_Random) and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) is A Hero) Equal to True
                    • Then - Actions
                      • Set x_Player_Index = (x_Player_Index + 1)
                    • Else - Actions
                      • Do nothing
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • x_Player_Index Greater than 0
                • Then - Actions
                  • Do nothing
                • Else - Actions
                  • Trigger - Run Random Triger <gen> (ignoring conditions)
              • Unit Group - Pick every unit in (Units owned by x_Player_Random) and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) is A Hero) Equal to True
                    • Then - Actions
                      • Set x_Player_Index = (x_Player_Index + 1)
                    • Else - Actions
                      • Do nothing
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • x_Player_Index Greater than 0
                • Then - Actions
                  • Do nothing
                • Else - Actions
                  • Trigger - Run Random Triger <gen> (ignoring conditions)
              • Unit Group - Pick every unit in (Units owned by x_Player_Random) and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) is A Hero) Equal to True
                    • Then - Actions
                      • Set x_Player_Index = (x_Player_Index + 1)
                    • Else - Actions
                      • Do nothing
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • x_Player_Index Greater than 0
                • Then - Actions
                  • Do nothing
                • Else - Actions
                  • Trigger - Run Random Triger <gen> (ignoring conditions)
              • Unit Group - Pick every unit in (Units owned by x_Player_Random) and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) is A Hero) Equal to True
                    • Then - Actions
                      • Set x_Player_Index = (x_Player_Index + 1)
                    • Else - Actions
                      • Do nothing
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • x_Player_Index Greater than 0
                • Then - Actions
                  • Do nothing
                • Else - Actions
                  • Trigger - Run Random Triger <gen> (ignoring conditions)
              • Unit Group - Pick every unit in (Units owned by x_Player_Random) and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) is A Hero) Equal to True
                    • Then - Actions
                      • Set x_Player_Index = (x_Player_Index + 1)
                    • Else - Actions
                      • Do nothing
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • x_Player_Index Greater than 0
                • Then - Actions
                  • Do nothing
                • Else - Actions
                  • Trigger - Run Random Triger <gen> (ignoring conditions)
              • Unit Group - Pick every unit in (Units owned by x_Player_Random) and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) is A Hero) Equal to True
                    • Then - Actions
                      • Set x_Player_Index = (x_Player_Index + 1)
                    • Else - Actions
                      • Do nothing
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • x_Player_Index Greater than 0
                • Then - Actions
                  • Do nothing
                • Else - Actions
                  • Trigger - Run Random Triger <gen> (ignoring conditions)
              • Unit Group - Pick every unit in (Units owned by x_Player_Random) and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) is A Hero) Equal to True
                    • Then - Actions
                      • Set x_Player_Index = (x_Player_Index + 1)
                    • Else - Actions
                      • Do nothing
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • x_Player_Index Greater than 0
                • Then - Actions
                  • Do nothing
                • Else - Actions
                  • Trigger - Run Random Triger <gen> (ignoring conditions)
              • Unit Group - Pick every unit in (Units owned by x_Player_Random) and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) is A Hero) Equal to True
                    • Then - Actions
                      • Set x_Player_Index = (x_Player_Index + 1)
                    • Else - Actions
                      • Do nothing
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • x_Player_Index Greater than 0
                • Then - Actions
                  • Do nothing
                • Else - Actions
                  • Trigger - Run Random Triger <gen> (ignoring conditions)
              • Unit Group - Pick every unit in (Units owned by x_Player_Random) and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) is A Hero) Equal to True
                    • Then - Actions
                      • Set x_Player_Index = (x_Player_Index + 1)
                    • Else - Actions
                      • Do nothing
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • x_Player_Index Greater than 0
                • Then - Actions
                  • Do nothing
                • Else - Actions
                  • Trigger - Run Random Triger <gen> (ignoring conditions)
              • Unit Group - Pick every unit in (Units owned by x_Player_Random) and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) is A Hero) Equal to True
                    • Then - Actions
                      • Set x_Player_Index = (x_Player_Index + 1)
                    • Else - Actions
                      • Do nothing
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • x_Player_Index Greater than 0
                • Then - Actions
                  • Do nothing
                • Else - Actions
                  • Trigger - Run Random Triger <gen> (ignoring conditions)
              • Unit Group - Pick every unit in (Units owned by x_Player_Random) and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) is A Hero) Equal to True
                    • Then - Actions
                      • Set x_Player_Index = (x_Player_Index + 1)
                    • Else - Actions
                      • Do nothing
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • x_Player_Index Greater than 0
                • Then - Actions
                  • Do nothing
                • Else - Actions
                  • Trigger - Run Random Triger <gen> (ignoring conditions)
              • Unit Group - Pick every unit in (Units owned by x_Player_Random) and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) is A Hero) Equal to True
                    • Then - Actions
                      • Set x_Player_Index = (x_Player_Index + 1)
                    • Else - Actions
                      • Do nothing
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • x_Player_Index Greater than 0
                • Then - Actions
                  • Do nothing
                • Else - Actions
                  • Trigger - Run Random Triger <gen> (ignoring conditions)
              • Unit Group - Pick every unit in (Units owned by x_Player_Random) and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) is A Hero) Equal to True
                    • Then - Actions
                      • Set x_Player_Index = (x_Player_Index + 1)
                    • Else - Actions
                      • Do nothing
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • x_Player_Index Greater than 0
                • Then - Actions
                  • Do nothing
                • Else - Actions
                  • Trigger - Run Random Triger <gen> (ignoring conditions)
              • Unit Group - Pick every unit in (Units owned by x_Player_Random) and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) is A Hero) Equal to True
                    • Then - Actions
                      • Set x_Player_Index = (x_Player_Index + 1)
                    • Else - Actions
                      • Do nothing
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • x_Player_Index Greater than 0
                • Then - Actions
                  • Do nothing
                • Else - Actions
                  • Trigger - Run Random Triger <gen> (ignoring conditions)
              • Unit Group - Pick every unit in (Units owned by x_Player_Random) and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) is A Hero) Equal to True
                    • Then - Actions
                      • Set x_Player_Index = (x_Player_Index + 1)
                    • Else - Actions
                      • Do nothing
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • x_Player_Index Greater than 0
                • Then - Actions
                  • Do nothing
                • Else - Actions
                  • Trigger - Run Random Triger <gen> (ignoring conditions)
              • Unit Group - Pick every unit in (Units owned by x_Player_Random) and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) is A Hero) Equal to True
                    • Then - Actions
                      • Set x_Player_Index = (x_Player_Index + 1)
                    • Else - Actions
                      • Do nothing
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • x_Player_Index Greater than 0
                • Then - Actions
                  • Do nothing
                • Else - Actions
                  • Trigger - Run Random Triger <gen> (ignoring conditions)
              • Unit Group - Pick every unit in (Units owned by x_Player_Random) and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) is A Hero) Equal to True
                    • Then - Actions
                      • Set x_Player_Index = (x_Player_Index + 1)
                    • Else - Actions
                      • Do nothing
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • x_Player_Index Greater than 0
                • Then - Actions
                  • Do nothing
                • Else - Actions
                  • Trigger - Run Random Triger <gen> (ignoring conditions)
              • Unit Group - Pick every unit in (Units owned by x_Player_Random) and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) is A Hero) Equal to True
                    • Then - Actions
                      • Set x_Player_Index = (x_Player_Index + 1)
                    • Else - Actions
                      • Do nothing
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • x_Player_Index Greater than 0
                • Then - Actions
                  • Do nothing
                • Else - Actions
                  • Trigger - Run Random Triger <gen> (ignoring conditions)
              • Unit Group - Pick every unit in (Units owned by x_Player_Random) and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) is A Hero) Equal to True
                    • Then - Actions
                      • Set x_Player_Index = (x_Player_Index + 1)
                    • Else - Actions
                      • Do nothing
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • x_Player_Index Greater than 0
                • Then - Actions
                  • Do nothing
                • Else - Actions
                  • Trigger - Run Random Triger <gen> (ignoring conditions)
              • Unit Group - Pick every unit in (Units owned by x_Player_Random) and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) is A Hero) Equal to True
                    • Then - Actions
                      • Set x_Player_Index = (x_Player_Index + 1)
                    • Else - Actions
                      • Do nothing
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • x_Player_Index Greater than 0
                • Then - Actions
                  • Do nothing
                • Else - Actions
                  • Trigger - Run Random Triger <gen> (ignoring conditions)
              • Unit Group - Pick every unit in (Units owned by x_Player_Random) and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) is A Hero) Equal to True
                    • Then - Actions
                      • Set x_Player_Index = (x_Player_Index + 1)
                    • Else - Actions
                      • Do nothing
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • x_Player_Index Greater than 0
                • Then - Actions
                  • Do nothing
                • Else - Actions
                  • Trigger - Run Random Triger <gen> (ignoring conditions)
              • Unit Group - Pick every unit in (Units owned by x_Player_Random) and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) is A Hero) Equal to True
                    • Then - Actions
                      • Set x_Player_Index = (x_Player_Index + 1)
                    • Else - Actions
                      • Do nothing
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • x_Player_Index Greater than 0
                • Then - Actions
                  • Do nothing
                • Else - Actions
                  • Trigger - Run Random Triger <gen> (ignoring conditions)
              • Unit Group - Pick every unit in (Units owned by x_Player_Random) and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) is A Hero) Equal to True
                    • Then - Actions
                      • Set x_Player_Index = (x_Player_Index + 1)
                    • Else - Actions
                      • Do nothing
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • x_Player_Index Greater than 0
                • Then - Actions
                  • Do nothing
                • Else - Actions
                  • Trigger - Run Random Triger <gen> (ignoring conditions)
              • Unit Group - Pick every unit in (Units owned by x_Player_Random) and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) is A Hero) Equal to True
                    • Then - Actions
                      • Set x_Player_Index = (x_Player_Index + 1)
                    • Else - Actions
                      • Do nothing
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • x_Player_Index Greater than 0
                • Then - Actions
                  • Do nothing
                • Else - Actions
                  • Trigger - Run Random Triger <gen> (ignoring conditions)
              • Unit Group - Pick every unit in (Units owned by x_Player_Random) and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) is A Hero) Equal to True
                    • Then - Actions
                      • Set x_Player_Index = (x_Player_Index + 1)
                    • Else - Actions
                      • Do nothing
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • x_Player_Index Greater than 0
                • Then - Actions
                  • Do nothing
                • Else - Actions
                  • Trigger - Run Random Triger <gen> (ignoring conditions)
              • Unit Group - Pick every unit in (Units owned by x_Player_Random) and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) is A Hero) Equal to True
                    • Then - Actions
                      • Set x_Player_Index = (x_Player_Index + 1)
                    • Else - Actions
                      • Do nothing
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • x_Player_Index Greater than 0
                • Then - Actions
                  • Do nothing
                • Else - Actions
                  • Trigger - Run Random Triger <gen> (ignoring conditions)
              • Unit Group - Pick every unit in (Units owned by x_Player_Random) and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) is A Hero) Equal to True
                    • Then - Actions
                      • Set x_Player_Index = (x_Player_Index + 1)
                    • Else - Actions
                      • Do nothing
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • x_Player_Index Greater than 0
                • Then - Actions
                  • Do nothing
                • Else - Actions
                  • Trigger - Run Random Triger <gen> (ignoring conditions)
            • Else - Actions
              • Do nothing
The Random Trigger

  • Player - For x_Player_Random order Shop_Random[(Random integer number between 1 and 4)] to sell a unit of type Hero_List[(Random integer number between 1 and 22)]
Hope this helps
 
Level 12
Joined
Mar 16, 2006
Messages
992
In my FOR loop, I use an IF statement.

For 1-12
IF PLAYER ( Loop A ) == Controller, IS playing, or whatever it is.
**random script here**

Works great in my map. Hope it helps!
 
Status
Not open for further replies.
Top