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

[Solved] Share start gold works in single player, but not in multiplayer

Status
Not open for further replies.
Level 13
Joined
Feb 5, 2018
Messages
567
So I wanted to make a gold system, where if player plays alone he gets 160 gold and if there are two players they gain 80 gold and so on. I tried all colors in single player from slots 1 to 8.

On every attempt I gained 160 gold, yay!

Afterwards I tried this on multiplayer with my friend, I tried slots 4 (purple) and slots 7 (green) and gained 80 gold on each game, which is correct, since I wanted to share the 160 gold amongst 2 active players.

Now the problem is that my friend used slot 8 (pink) and didn't get any gold. Once again I tested all the slots from 1-8 and it gives the gold. Originally the player set up was on map ini trigger and I thought it might not calculate the players correctly if they "connect at different times".

I also increased the elapsed game time from 0.01 to 0.05 and then to 0.25 seconds to see if it helped my friend and it did not.

Oh and also the trigger which creates the builders, made the builder for slot 8 (pink).

I am confused.

EDIT: I manually added all the slots to activeplayers in single player and only the first player in Player group gets the gold, so in this case slot 1 (red) gets 160 gold / 8 = 20 gold and players from 2-8 have 0 gold. Forgot that this might happen when looping through player groups.

  • Start
    • Events
      • Time - Elapsed game time is 0.25 seconds
    • Conditions
    • Actions
      • -------- Player set up --------
      • Set VariableSet Players = (All players matching (((Matching player) slot status) Equal to Is playing).)
      • Set VariableSet ActivePlayers = (All players matching ((((Matching player) slot status) Equal to Is playing) and (((Matching player) controller) Equal to User)).)
      • Player Group - Pick every player in ActivePlayers and do (Actions)
        • Loop - Actions
          • Player - Set (Picked player).Current gold to (160 / (Number of players in ActivePlayers))
      • -------- Cam setup --------
      • Set VariableSet CamStrings[1] = 2000
      • Set VariableSet CamStrings[1] = 2200
      • Set VariableSet CamStrings[1] = 2400
      • Set VariableSet CamStrings[1] = 2600
      • Set VariableSet CamStrings[1] = 2800
      • Set VariableSet CamStrings[1] = 3000
      • -------- --------
      • Set VariableSet TeamLife = 100.00
      • -------- --------
      • Player - Turn Gives bounty On for Player 13 (Maroon)
      • -------- Start Timer --------
      • Countdown Timer - Start StartTimer as a One-shot timer that will expire in 90.00 seconds
      • Set VariableSet StartTimer = (Last started timer)
      • Countdown Timer - Create a timer window for StartTimer with title First Wave In:
      • Set VariableSet StartTimerWindow = (Last created timer window)
      • Countdown Timer - Show StartTimerWindow
      • -------- Builders and start camera --------
      • Player Group - Pick every player in ActivePlayers and do (Actions)
        • Loop - Actions
          • Unit - Create 1 Ancestral Builder for (Picked player) at (Center of Builders <gen>) facing Default building facing degrees
          • Selection - Select (Last created unit) for (Picked player)
          • Camera - Pan camera for (Picked player) to (Center of Builders <gen>) over 0.00 seconds
 
Last edited:
Level 13
Joined
Feb 5, 2018
Messages
567
What I did I manually set each players gold to 160 / activeplayers and it worked for 8 players as should. For some odd reason the player group stops cycling at the first player it found.

  • Player - Set Player 1 (Red).Current gold to (160 / (Number of players in ActivePlayers))
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
Yeah, I'm thinking it's because in order to calculate the Number of players in ActivePlayers it needs to enumerate over the players in that group (which it's already doing in the first place). That's why calculating the gold beforehand should fix it.
  • Player - Set (Picked player).Current gold to Gold

But the Elapsed time thing shouldn't matter, as long as it's not running during Map Initialization it should work.

There's really no other reason why this wouldn't work.
 
Last edited:
Status
Not open for further replies.
Top