• 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.

[Trigger] Problems with when a player...

Status
Not open for further replies.
Level 12
Joined
Mar 30, 2013
Messages
664
Hello,

So in my new map, dael'barun world defence. It is a pure 3 players online game.
So my problem is, when a player is leaving the game, he is not leaving his buildings. His building is still on the map with his units also. i used this trigger but it didnt work.
  • Remove Teal
    • Events
      • Player - Player 3 (Teal) leaves the game
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units owned by (Triggering player)) and do (Actions)
        • Loop - Actions
          • Game - Display to (All players) the text: ((Name of (Triggering player)) + |cFFFF0000 has left the game now we need to build us more time to get stronger!|r)
          • Wait 1.00 seconds
          • Unit - Remove (Picked unit) from the game
Hope some one can help! :)
 
Level 15
Joined
Aug 7, 2013
Messages
1,338
Hmm wish I could help.

It might be your wait which is throwing it off? Try taking the "Wait 1.00 seconds" out and see if it works. It could be bugging "Unit - Remove (Picked unit) from the game."

Also you should not put the text message inside the "Unit Group Loop - Actions." Otherwise it will spam the players for each unit that gets removed.
 
Level 28
Joined
Sep 26, 2009
Messages
2,520
yeah, what you want should be:
wait 1 sec
display game message
custom script
unit group actions

The reason is what is in the loop block repeats for each picked unit, so currently for each picked unit you write the game message and then you try to remove it (which I'm not sure if even works properly with the wait inside the loop)
 
Level 12
Joined
Mar 30, 2013
Messages
664
  • Remove Pink Copy
    • Events
      • Player - Player 8 (Pink) leaves the game
    • Conditions
    • Actions
      • Wait 1.00 seconds
      • Game - Display to (All players) the text: ((Name of (Triggering player)) + |cFFFF0000 has left the game now we need to build us more time to get stronger!|r)
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units owned by (Triggering player)) and do (Actions)
        • Loop - Actions
Like that? I feel it might look wrong :p
 
Level 28
Joined
Sep 26, 2009
Messages
2,520
yes like that.
Actions are executed sequentially, meaning they are executed one by one from the upper-most action to the bottom-most one.
Loops (cycles) are part of code that repeats numerous times (the number of iteration is usually set by number or they loop endlessly until specific condition is met).

If you have a piece of trigger with loop that looks like this:
Code:
A
B
Loop
    C
    D
    E
    F
(loop block end)
G
H
where A-G are some actions and this loop iterates 4 times, then the actions are executed as AB CDEF CDEF CDEF CDEF GH. Notice how only CDEF actions inside the loop block are repeated and the order in which they are executed.

Unit group action is a loop which repeats X times where X is number of units in the unit group. The only difference from other loops is that each iteration of this unit group loop points at different unit inside this group.

So looking now at what you have and at what you had, it should be obvious why I wrote you should change the order of some actions.
 
  • Remove Pink Copy
    • Events
      • Player - Player 8 (Pink) leaves the game
    • Conditions
    • Actions
      • Wait 1.00 seconds
      • Game - Display to (All players) the text: ((Name of (Triggering player)) + |cFFFF0000 has left the game now we need to build us more time to get stronger!|r)
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units owned by (Triggering player)) and do (Actions)
        • Loop - Actions
Like that? I feel it might look wrong :p

You can try adding a remove unit action.
 
Level 12
Joined
Mar 30, 2013
Messages
664
This one didn't work:
  • Remove Teal
    • Events
      • Player - Player 3 (Teal) leaves the game
    • Conditions
    • Actions
      • Wait 1.00 seconds
      • Game - Display to (All players) the text: ((Name of (Triggering player)) + |cFFFF0000 has left the game now we need to build us more time to get stronger!|r)
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units owned by (Triggering player)) and do (Actions)
        • Loop - Actions
      • Unit - Remove (Triggering unit) from the game
So, should i try Chaosy's trigger?
Tho, i have tried many now so hope some one got a solution! :goblin_yeah:
 
Level 12
Joined
Mar 30, 2013
Messages
664
Like this?
  • Remove Teal
    • Events
      • Player - Player 3 (Teal) leaves the game
    • Conditions
    • Actions
      • Wait 1.00 seconds
      • Game - Display to (All players) the text: ((Name of (Triggering player)) + |cFFFF0000 has left the game now we need to build us more time to get stronger!|r)
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units owned by (Triggering player)) and do (Actions)
        • Loop - Actions
          • Unit - Remove (Picked unit) from the game
 
Status
Not open for further replies.
Top