• 🏆 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!

[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 63
Joined
Jan 18, 2005
Messages
27,197
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