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

Accessing gold resources of allies who left the game

Status
Not open for further replies.

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,899
I imagine this would work:
  • Setup Players
    • Events
      • Time - Elapsed game time is 0.50 seconds
    • Conditions
    • Actions
      • Set VariableSet ActivePlayers = (All players matching ((((Matching player) slot status) Equal to Is playing) and (((Matching player) controller) Equal to User)).)
  • Player Leaves
    • 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
    • Conditions
    • Actions
      • Player Group - Remove (Triggering player) from ActivePlayers.
      • Set VariableSet TempInteger[1] = ((Triggering player) Current gold)
      • Set VariableSet TempInteger[2] = (Number of players in ActivePlayers)
      • Set VariableSet TempInteger[3] = (TempInteger[1] / TempInteger[2])
      • Player Group - Pick every player in ActivePlayers and do (Actions)
        • Loop - Actions
          • Player - Add TempInteger[3] to (Picked player).Current gold
 
I imagine this would work:
  • Setup Players
    • Events
      • Time - Elapsed game time is 0.50 seconds
    • Conditions
    • Actions
      • Set VariableSet ActivePlayers = (All players matching ((((Matching player) slot status) Equal to Is playing) and (((Matching player) controller) Equal to User)).)
  • Player Leaves
    • 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
    • Conditions
    • Actions
      • Player Group - Remove (Triggering player) from ActivePlayers.
      • Set VariableSet TempInteger[1] = ((Triggering player) Current gold)
      • Set VariableSet TempInteger[2] = (Number of players in ActivePlayers)
      • Set VariableSet TempInteger[3] = (TempInteger[1] / TempInteger[2])
      • Player Group - Pick every player in ActivePlayers and do (Actions)
        • Loop - Actions
          • Player - Add TempInteger[3] to (Picked player).Current gold
Will it still track the gold accurately even though the player has left the game?
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,899
Oh, I misread and thought he just wanted their resources after they left. I'm pretty sure everything will still work even after they leave though.

But to expand on what I originally said, you could create another Player Group for Inactive Players, and then do the same method(s) mentioned above but periodically like you had suggested.

So at the start of the game you break the Users up into two Player Groups, ActivePlayers and InactivePlayers.

If a Player leaves they're removed from ActivePlayers and put into InactivePlayers and their gold is evenly distributed among ActivePlayers.

Then you can periodically distributed the InactivePlayer's gold among the ActivePlayers. Or, make it Event based because I imagine the only time they're gaining gold is after kills, acquiring gold power ups, and being rewarded gold through triggers.
 
Status
Not open for further replies.
Top