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

Dividing resources to team when player leaves

Status
Not open for further replies.
Level 4
Joined
Feb 7, 2007
Messages
61
how do i make it to where if the player leaves the game, it will split its resources amoung its current allies.
 
Level 4
Joined
Feb 7, 2007
Messages
61
what if there are, say, 4 teams, and a player leaves from team 2, how do i make it to where it divides the resources that the leaving person had, to his team(Team 2), that is playing just in case that a person on his team already left so that it doesnt divide to a player who isnt playing or isnt there. Get what im saying? lol
 
Level 11
Joined
Aug 25, 2006
Messages
971
Ready
..........................
Wait for it
.........................
*Poof*
  • AutoDivide
    • Events
      • Player - Player 1 (Red) leaves the game
      • Player - Player 2 (Blue) leaves the game
      • Player - Player 3 (Teal) leaves the game
      • Player - Player 4 (Purple) leaves the game
      • Player - Player 5 (Yellow) leaves the game
      • Player - Player 6 (Orange) leaves the game
      • Player - Player 7 (Green) leaves the game
      • Player - Player 8 (Pink) leaves the game
      • Player - Player 9 (Gray) leaves the game
      • Player - Player 10 (Light Blue) leaves the game
      • Player - Player 11 (Dark Green) leaves the game
      • Player - Player 12 (Brown) leaves the game
    • Conditions
    • Actions
      • Set Temp_Force = (All allies of (Triggering player))
      • Set Temp_Int = (((Triggering player) Current gold) / (Number of players in Temp_Force))
      • Set Temp_Int2 = (((Triggering player) Current lumber) / (Number of players in Temp_Force))
      • Player Group - Pick every player in Temp_Force and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked player) slot status) Equal to Is playing
            • Then - Actions
              • Player - Add Temp_Int to (Picked player) Current gold
              • Player - Add Temp_Int2 to (Picked player) Current lumber
              • Game - Display to (Picked player), at offset (0.00, 0.00) the text: (You get + ((String(Temp_Int)) + (( gold and + ((String(Temp_Int2)) + lumber, because your ally )) + ((Name of (Triggering player)) + has left the game.))))
            • Else - Actions
      • Custom script: call DestroyForce(udg_Temp_Force)
 
  • Share Resources
    • Events
      • Player - Player 1 (Red) leaves the game
      • Player - Player 2 (Blue) leaves the game
      • Player - Player 3 (Teal) leaves the game
      • Player - Player 4 (Purple) leaves the game
      • Player - Player 5 (Yellow) leaves the game
      • Player - Player 6 (Orange) leaves the game
      • Player - Player 7 (Green) leaves the game
      • Player - Player 8 (Pink) leaves the game
      • Player - Player 9 (Gray) leaves the game
      • Player - Player 10 (Light Blue) leaves the game
      • Player - Player 11 (Dark Green) leaves the game
      • Player - Player 12 (Brown) leaves the game
    • Conditions
    • Actions
      • Player Group - Pick every player in (All allies of (Triggering player)) and do (Actions)
        • Loop - Actions
          • Player - Add (((Triggering player) Current gold) / (Number of players in (All players matching ((((Matching player) slot status) Equal to Is playing) and (((Matching player) is an ally of (Triggering player)) Equal to True))))) to (Picked player) Current gold
          • Player - Add (((Triggering player) Current lumber) / (Number of players in (All players matching ((((Matching player) slot status) Equal to Is playing) and (((Matching player) is an ally of (Triggering player)) Equal to True))))) to (Picked player) Current lumber
I didnt test this, but i know you can! :D
 
Level 11
Joined
Aug 25, 2006
Messages
971
@Just_Spectating Thats pretty funny, we both posted triggers. Unfortunitly yours leaks, and doesn't display any text.

Temp_Int is well... an integer. Temp_Force is a playergroup. Also I updated my above post (the one with the trigger) to also contain lumber. If you don't want lumber, don't use the updated version.
 
Level 11
Joined
Aug 25, 2006
Messages
971
Easy to solve a unit group leak/player group (force) leak all you have to do is: Set a variable to the group you want. (Like setting Temp_Force to all allies of the triggering player) Then once your done with the variable, you trash it. (Thats what the custom text at the bottom of my trigger is for) If he doesn't understand the custom text, he doesn't have to use it. It'll leak, but only once per activation of the trigger. Yours leaks 3 times per activation. I'm sure Lafeet appreciates the work you put into the trigger anyway. Lol
 
Level 4
Joined
Feb 7, 2007
Messages
61
yeah but text would be great to let the player know how much gold/wood he/she recieved. im gonna check out ur trigger wd40bomber7

Edit--

Can you check this for me, im getting confused between (Matching players,picked players, and triggering players)

  • Left the Game Removal
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units in (Playable map area) matching ((Owner of (Matching unit)) Equal to (Player((Integer A))))) and 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 Has left the game
                • Then - Actions
                  • Unit - Remove (Picked unit) from the game
                  • Set Temp_Force = (All allies of (Matching player))
                  • Set Temp_Int = (((Matching player) Current gold) / (Number of players in Temp_Force))
                  • Set Temp_Int = (((Matching player) Current lumber) / (Number of players in Temp_Force))
                  • Player Group - Pick every player in Temp_Force and do (Actions)
                    • Loop - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • ((Picked player) slot status) Equal to Is playing
                        • Then - Actions
                          • Player - Add Temp_Int to (Picked player) Current gold
                          • Player - Add Temp_Int2 to (Picked player) Current lumber
                          • Game - Display to (Player group((Picked player))) the text: ((You recieved |cffFFFF00 + (String(Temp_Int))) + (|r gold and |cff00FF00 + ( |rwood from your ally, + ((Name of (Triggering player)) + ,who just left the game.))))
                        • Else - Actions
                • Else - Actions
 
Last edited:
Level 11
Joined
Aug 25, 2006
Messages
971
You made a mistake with the text. It looks like (though its hard to tell) that you forgot to put in the wood value between the color start and color end. Just put in String(Temp_Int2)
The player leave thing is ok, but it will run over and over every 1 second after a player left. To solve this add the action. Set Triggering player gold = 0. Then add the condition (Right after the player slot status = has left the game cond.) Integer player gold > 0. This way the trigger will only run once for each player. (Unless through some automagical fashion the player that left gets more gold 0_o)
Another mistake, you cant use 'matching player' In the creation of Temp_Force because you used a for loop. Get the player the same way you got the player for the condition part. Also you didn't set Temp_Int2 you just set Temp_Int twice.
 
Level 4
Joined
Feb 7, 2007
Messages
61
Yeah, umm i tried the method you first posted earlier, and it doesnt seem to work, but, does it work if the game initialization sets all players alliances to neutral, and then leave the game? or you have to be allied?

This is the trigger you posted earlier

  • AutoDivide
    • Events
      • Player - Player 1 (Red) leaves the game
      • Player - Player 2 (Blue) leaves the game
      • Player - Player 3 (Teal) leaves the game
      • Player - Player 4 (Purple) leaves the game
      • Player - Player 5 (Yellow) leaves the game
      • Player - Player 6 (Orange) leaves the game
      • Player - Player 7 (Green) leaves the game
      • Player - Player 8 (Pink) leaves the game
      • Player - Player 9 (Gray) leaves the game
      • Player - Player 10 (Light Blue) leaves the game
      • Player - Player 11 (Dark Green) leaves the game
      • Player - Player 12 (Brown) leaves the game
    • Conditions
    • Actions
      • Set Temp_Force = (All allies of (Triggering player))
      • Set Temp_Int = (((Triggering player) Current gold) / (Number of players in Temp_Force))
      • Set Temp_Int2 = (((Triggering player) Current lumber) / (Number of players in Temp_Force))
      • Player Group - Pick every player in Temp_Force and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked player) slot status) Equal to Is playing
            • Then - Actions
              • Player - Add Temp_Int to (Picked player) Current gold
              • Player - Add Temp_Int2 to (Picked player) Current lumber
              • Game - Display to (Picked player), at offset (0.00, 0.00) the text: (You get + ((String(Temp_Int)) + (( gold and + ((String(Temp_Int2)) + lumber, because your ally )) + ((Name of (Triggering player)) + has left the game.))))
            • Else - Actions
    • Custom script: call DestroyForce(udg_Temp_Force)
 
Last edited by a moderator:
Level 11
Joined
Aug 25, 2006
Messages
971
Hmm, it looks like fine to me. I'll bring up my mom's computer so I can test multiplayer. Looking into it now...

I don't know what your talking about. Make sure when you tried it that both players where on the same team. It worked for me. Heres the proof!
 

Attachments

  • PlayerResource2.w3x
    13.7 KB · Views: 24
Last edited:
Level 4
Joined
Feb 7, 2007
Messages
61
the trigger is set to give gold to the player allies, what if they are neutral instead of allies? because in the beggining of the game, i set all players to be neutral instead of allies.
 
Level 11
Joined
Aug 25, 2006
Messages
971
Thus your problem! I guess you could cycle through all players that are neutral and add them to the group as well, but what would be the point? I thought the whole point of this was for it to work on allies. Don't set them to neutral. Divide them into teams of full allies.
 
Level 4
Joined
Feb 7, 2007
Messages
61
the game is not with computers that are neutral if i may tell, not the neutral where the color is black, neutral to where you are allies but with no vision. unless it is best for me just to set them to allies, with no vision.
 
Level 4
Joined
Feb 7, 2007
Messages
61
in the game, i have a trigger to where it sets all the players neutral with each other..

  • Make all players Neutral
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Player Group - Make (All players) treat (All players) as an Neutral
      • Game - Display to (All players) for 30.00 seconds the text: |cffFF0000All Natio...
      • Game - Display to (All players) for 30.00 seconds the text: Alliance Terms I...
there are about 8 options available to either,

  • For Example
    • Events
    • Conditions
    • Actions
      • Player Group - Make (All players) treat (All players) as an Enemy
      • Player Group - Make (All players) treat (All players) as an Enemy with shared vision
      • Player Group - Make (All players) treat (All players) as an Neutral
      • Player Group - Make (All players) treat (All players) as an Neutral with shared vision
      • Player Group - Make (All players) treat (All players) as an Ally
      • Player Group - Make (All players) treat (All players) as an Ally with shared vision
      • Player Group - Make (All players) treat (All players) as an Ally with shared vision and shared units
      • Player Group - Make (All players) treat (All players) as an Ally with shared vision and full shared units
one of these, and i chose the one with

  • Player Group - Make (All players) treat (All players) as an Neutral
 
Level 11
Joined
Aug 25, 2006
Messages
971
  • Player Group - Make (All players) treat (All players) as an Ally
  • Player Group - Make (All players) treat (All players) as an Ally with shared vision
  • Player Group - Make (All players) treat (All players) as an Ally with shared vision and shared units
  • Player Group - Make (All players) treat (All players) as an Ally with shared vision and full shared units
Those 4 will probably result in my trigger working. Unfortunitly, I no longer have the chance to test it using the second computer.
 
Level 4
Joined
Feb 7, 2007
Messages
61
ok thanks, so say, if you are just allied to someone, with no vision, and they walk up to you, click on one of your buildings, can they see your resources?
 
Status
Not open for further replies.
Top