(Help) someone plays then create hero.

morno

Active Member
Reaction score
2
hi its been a wile but now i have stared my new project: Children of Lore. and im havin some prob whit the trigger to check in Player red-Purple is playing. if so then i whants it to create a hero for evry playing player..
 
K

KiD-X

Guest
Pretty sure you will want to be using a trigger similar to this :


Code:
Setup Players
    Events
        Map initialization
    Conditions
    Actions
        -------- Remove all players not playing. --------
        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) Not equal to Is playing
                    Then - Actions
                        Player Group - Remove (Picked player) from (All players)
                        Unit Group - Pick every unit in (Units owned by (Player((Integer A)))) and do (Actions)
                            Loop - Actions
                                Unit - Remove (Picked unit) from the game
                    Else - Actions
 

hell_knight

Playing WoW
Reaction score
126
That will work, but instead of 12 set it to the player number of purple.

Unit Group Leak,
Make a unit group variable name it tempgroup
Then do

Code:
Player Group - Remove (Picked player) from (All players)
              Set tempgroup - Units owned by (Player((Interger A))
                  Unit Group   pick every unit in tempgroup
                     Loop - Actions
                                Unit - Remove (Picked unit) from the game
                                call DestroyGroup (udg_tempgroup

Made freehand sorry if messy.
 

ManyTimes

I'm so lonesome I could cry...
Reaction score
293
Why remove players not playing from All Players.
All players consists only of players playing.
And why create units for a player that is not playing, to then remove them at map init. It is better to do it the other way, if a player is playing, then create a hero for the playing player, which is also what the thread starter is asking (if I understood correctly).

Thats why, you should use more or less something like this:
Code:
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) Not equal to Is playing
                    Then - Actions
                        Unit - Create 1 Arch Mage for (Player(Integer A)) at (Center of playable map area) facing default building degrees
                    Else - Actions
Cheerio
 
General chit-chat
Help Users

      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