One Last issue! Risk unit Spawns

Seannny

Why GUI when you can Jass?
Reaction score
46
Okay, one final issue to resolve tonight! =3

This one involves a risk like trigger. where basically at the start of the map/whenever the event is triggered the trigger creates one Human Warrior for a random player at a random place on the map. This happens until all spots are filled. However, it is even, every player has either the same or 1-2 less/more bases than the others, depending on the amount of people playing of course.

So heres what i had until i remembered that you cant use Pick units inside itself.... -.- and i really cant figure out any other way. id use jass with FirstOfGroup but i no like 0 jass :thdown:

Code:
Start spawn
    Events
        Time - Elapsed game time is 0.10 seconds
    Conditions
    Actions
        Set Numberofbase = 35
        Set Numberofplayers = (Number of players in (All players controlled by a User player))
        Set Createint = (Numberofbase / Numberofplayers)
        Unit Group - Pick every unit in (Random Createint units from (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Circle of Power) and ((Owner of (Matching unit)) Equal to Neutral Hostile)))) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Player 1 (Red) slot status) Equal to Is playing
                    Then - Actions
                        Set Spawn = (Position of (Picked unit))
                        Unit - Create 1 Human Warrior for Player 1 (Red) at Spawn facing (Position of (Triggering unit))
                        Custom script:   call RemoveLocation(udg_Spawn)
                        Unit Group - Pick every unit in (Units within 512.00 of (Position of (Last created unit))) and do (Actions)
                            Loop - Actions
                                Unit - Change ownership of (Picked unit) to (Owner of (Last created unit)) and Change color
                    Else - Actions
        Unit Group - Pick every unit in (Random Createint units from (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Circle of Power) and ((Owner of (Matching unit)) Equal to Neutral Hostile)))) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Player 2 (Blue) slot status) Equal to Is playing
                    Then - Actions
                        Set Spawn = (Position of (Picked unit))
                        Unit - Create 1 Human Warrior for Player 2 (Blue) at Spawn facing (Position of (Triggering unit))
                        Custom script:   call RemoveLocation(udg_Spawn)
                        Unit Group - Pick every unit in (Units within 512.00 of (Position of (Last created unit))) and do (Actions)
                            Loop - Actions
                                Unit - Change ownership of (Picked unit) to (Owner of (Last created unit)) and Change color
                    Else - Actions
        Unit Group - Pick every unit in (Random Createint units from (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Circle of Power) and ((Owner of (Matching unit)) Equal to Neutral Hostile)))) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Player 3 (Teal) slot status) Equal to Is playing
                    Then - Actions
                        Set Spawn = (Position of (Picked unit))
                        Unit - Create 1 Human Warrior for Player 3 (Teal) at Spawn facing (Position of (Triggering unit))
                        Custom script:   call RemoveLocation(udg_Spawn)
                        Unit Group - Pick every unit in (Units within 512.00 of (Position of (Last created unit))) and do (Actions)
                            Loop - Actions
                                Unit - Change ownership of (Picked unit) to (Owner of (Last created unit)) and Change color
                    Else - Actions
        Unit Group - Pick every unit in (Random Createint units from (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Circle of Power) and ((Owner of (Matching unit)) Equal to Neutral Hostile)))) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Player 4 (Purple) slot status) Equal to Is playing
                    Then - Actions
                        Set Spawn = (Position of (Picked unit))
                        Unit - Create 1 Human Warrior for Player 4 (Purple) at Spawn facing (Position of (Triggering unit))
                        Custom script:   call RemoveLocation(udg_Spawn)
                        Unit Group - Pick every unit in (Units within 512.00 of (Position of (Last created unit))) and do (Actions)
                            Loop - Actions
                                Unit - Change ownership of (Picked unit) to (Owner of (Last created unit)) and Change color
                    Else - Actions
        Unit Group - Pick every unit in (Random Createint units from (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Circle of Power) and ((Owner of (Matching unit)) Equal to Neutral Hostile)))) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Player 5 (Yellow) slot status) Equal to Is playing
                    Then - Actions
                        Set Spawn = (Position of (Picked unit))
                        Unit - Create 1 Human Warrior for Player 5 (Yellow) at Spawn facing (Position of (Triggering unit))
                        Custom script:   call RemoveLocation(udg_Spawn)
                        Unit Group - Pick every unit in (Units within 512.00 of (Position of (Last created unit))) and do (Actions)
                            Loop - Actions
                                Unit - Change ownership of (Picked unit) to (Owner of (Last created unit)) and Change color
                    Else - Actions
        Unit Group - Pick every unit in (Random Createint units from (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Circle of Power) and ((Owner of (Matching unit)) Equal to Neutral Hostile)))) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Player 6 (Orange) slot status) Equal to Is playing
                    Then - Actions
                        Set Spawn = (Position of (Picked unit))
                        Unit - Create 1 Human Warrior for Player 6 (Orange) at Spawn facing (Position of (Triggering unit))
                        Custom script:   call RemoveLocation(udg_Spawn)
                        Unit Group - Pick every unit in (Units within 512.00 of (Position of (Last created unit))) and do (Actions)
                            Loop - Actions
                                Unit - Change ownership of (Picked unit) to (Owner of (Last created unit)) and Change color
                    Else - Actions
        Unit Group - Pick every unit in (Random Createint units from (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Circle of Power) and ((Owner of (Matching unit)) Equal to Neutral Hostile)))) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Player 7 (Green) slot status) Equal to Is playing
                    Then - Actions
                        Set Spawn = (Position of (Picked unit))
                        Unit - Create 1 Human Warrior for Player 7 (Green) at Spawn facing (Position of (Triggering unit))
                        Custom script:   call RemoveLocation(udg_Spawn)
                        Unit Group - Pick every unit in (Units within 512.00 of (Position of (Last created unit))) and do (Actions)
                            Loop - Actions
                                Unit - Change ownership of (Picked unit) to (Owner of (Last created unit)) and Change color
                    Else - Actions
        Unit Group - Pick every unit in (Random Createint units from (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Circle of Power) and ((Owner of (Matching unit)) Equal to Neutral Hostile)))) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Player 8 (Pink) slot status) Equal to Is playing
                    Then - Actions
                        Set Spawn = (Position of (Picked unit))
                        Unit - Create 1 Human Warrior for Player 8 (Pink) at Spawn facing (Position of (Triggering unit))
                        Custom script:   call RemoveLocation(udg_Spawn)
                        Unit Group - Pick every unit in (Units within 512.00 of (Position of (Last created unit))) and do (Actions)
                            Loop - Actions
                                Unit - Change ownership of (Picked unit) to (Owner of (Last created unit)) and Change color
                    Else - Actions
        Unit Group - Pick every unit in (Random Createint units from (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Circle of Power) and ((Owner of (Matching unit)) Equal to Neutral Hostile)))) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Player 9 (Gray) slot status) Equal to Is playing
                    Then - Actions
                        Set Spawn = (Position of (Picked unit))
                        Unit - Create 1 Human Warrior for Player 9 (Gray) at Spawn facing (Position of (Triggering unit))
                        Custom script:   call RemoveLocation(udg_Spawn)
                        Unit Group - Pick every unit in (Units within 512.00 of (Position of (Last created unit))) and do (Actions)
                            Loop - Actions
                                Unit - Change ownership of (Picked unit) to (Owner of (Last created unit)) and Change color
                    Else - Actions
        Unit Group - Pick every unit in (Random Createint units from (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Circle of Power) and ((Owner of (Matching unit)) Equal to Neutral Hostile)))) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Player 10 (Light Blue) slot status) Equal to Is playing
                    Then - Actions
                        Set Spawn = (Position of (Picked unit))
                        Unit - Create 1 Human Warrior for Player 10 (Light Blue) at Spawn facing (Position of (Triggering unit))
                        Custom script:   call RemoveLocation(udg_Spawn)
                        Unit Group - Pick every unit in (Units within 512.00 of (Position of (Last created unit))) and do (Actions)
                            Loop - Actions
                                Unit - Change ownership of (Picked unit) to (Owner of (Last created unit)) and Change color
                    Else - Actions
        Unit Group - Pick every unit in (Random Createint units from (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Circle of Power) and ((Owner of (Matching unit)) Equal to Neutral Hostile)))) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Player 11 (Dark Green) slot status) Equal to Is playing
                    Then - Actions
                        Set Spawn = (Position of (Picked unit))
                        Unit - Create 1 Human Warrior for Player 11 (Dark Green) at Spawn facing (Position of (Triggering unit))
                        Custom script:   call RemoveLocation(udg_Spawn)
                        Unit Group - Pick every unit in (Units within 512.00 of (Position of (Last created unit))) and do (Actions)
                            Loop - Actions
                                Unit - Change ownership of (Picked unit) to (Owner of (Last created unit)) and Change color
                    Else - Actions
        Unit Group - Pick every unit in (Random Createint units from (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Circle of Power) and ((Owner of (Matching unit)) Equal to Neutral Hostile)))) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Player 12 (Brown) slot status) Equal to Is playing
                    Then - Actions
                        Set Spawn = (Position of (Picked unit))
                        Unit - Create 1 Human Warrior for Player 12 (Brown) at Spawn facing (Position of (Triggering unit))
                        Custom script:   call RemoveLocation(udg_Spawn)
                        Unit Group - Pick every unit in (Units within 512.00 of (Position of (Last created unit))) and do (Actions)
                            Loop - Actions
                                Unit - Change ownership of (Picked unit) to (Owner of (Last created unit)) and Change color
                    Else - Actions
So any ideas to keep it Gui?

PS> i realise i could have done For integer A 1-12, just realised that now, but thats not the point of this trigger =)
 

cleeezzz

The Undead Ranger.
Reaction score
268
Code:
Pick all units in (Blah)
       Loop Actions
             Set TPU = Picked Unit
             Pick all units in (Blah2)
                   Change ownership of (Picked Unt) to (Owner of (TPU))
 

Seannny

Why GUI when you can Jass?
Reaction score
46
Code:
Pick all units in (Blah)
       Loop Actions
             Set TPU = Picked Unit
             Pick all units in (Blah2)
                   Change ownership of (Picked Unt) to (Owner of (TPU))

You cant do that though...

You cant use Pick all units inside a pick all units... Can you?
 

Weyrling

New Member
Reaction score
25
You can indeed ^_^
You just have to remember that the first picked unit needs a variable.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top