• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 21st Texturing Contest: Upgrade is now concluded, time to vote for your favourite set of icons! Click here to vote!

[Trigger] Probably a stupid question...

Status
Not open for further replies.
Level 5
Joined
Oct 11, 2009
Messages
125
In my map I'm making if you start the game and it isn't full the missing players units are still there. I have been looking in the triggers for about 15 minutes and I can't figure out how to get rid of the units in the start. help?
 

Dr Super Good

Spell Reviewer
Level 65
Joined
Jan 18, 2005
Messages
27,296
You firstly create a group of all the units owned by the player (in this case the player is someone who is not playing) and then enumerate through the group and remove all the units in the group (remember to destroy group afterwards or recycle it to stop leaks).


Get all players who need their units removed
itteration 1 runs for each player you identified (to be removed).
Each cycle in the itteration gets all units owned by that player and then runs itteration 2

itteration 2 runs for each unit you identified (to be removed).
each cycle removes the unit.
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
Something like this:

  • 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
        • Then - Actions
          • Set grpData = (Units owned by (Player((Integer A))))
          • Unit Group - Pick every unit in grpData and do (Actions)
            • Loop - Actions
              • Unit - Remove (Picked unit) from the game
          • Custom script: call DestroyGroup(udg_grpData)
        • Else - Actions
 
Level 5
Joined
Oct 11, 2009
Messages
125
okay im at the variable screen and selected Player Group now I don't know how to add units to the group...and I dont know what to set those 2 variables at?!?!?
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
It's not a player group, it's a unit group.

I also used the trigger editor to produce what I posted above, so the options are there, even if you can't find them. Look harder.
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
It's not a player group, it's a unit group.

There is only one variable. The unit group. I've clarified what it is, too, since you seemed to be using a player group.

There is only one variable. The unit group. I've clarified what it is, too, since you seemed to be using a player group.

Figured if I need to repeat myself I'll get it over with.
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
It was just an example. I really didn't put any time into making sure it was perfectly correct.

But you're right, it should be. If a user is not playing then it's units should be removed. I would also make sure that the player controller is a user (and not playing) so computer units are not removed.
 
Status
Not open for further replies.
Top