• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Shared gold between Player 1 and Player 2

Status
Not open for further replies.
Level 6
Joined
Aug 31, 2018
Messages
157
I have a Dungeon type map (2 players, red and blue)
There you kill many many mobs and you get gold for each killed mob (random gold amount)

What i want to do is, to share the gold between player 1 and player 2. Literally 50-50 for both, so they can have the same amount of gold. Because right now, if player 1 kills a mob, only he gets the gold.



Bonus question:
Its weird, but everytime i kill a mob, it says (for example) +32 gold, but i dont get a 32 gold. I get for example, 20 gold. Why does this happens?

P.S
I tried to use the trigger Divert 50% of the gold income from player 1, to player 2. And the same for player 2, for player 1. But it doesnt work, i literally get 0 gold and player 2 gets all the gold.
 
Level 20
Joined
Feb 27, 2019
Messages
592
Id probably end up using triggers. Adding gold via triggers is basically: unit dies, check conditions, add gold to owner of killing unit and allies based on point value of unit. If youd like to show the bounty as floating text, then there are tutorials that will show how that is done.

Bonus: It may be because of Upkeep
P.S Also because of Upkeep
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,555
I just created a simple example of what [db]east suggested. On newer versions you have access to Gold Bounty directly so no need for Point Value.

First, let's track our Users:
  • Setup ActiveUsers
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • -------- Track our Active Users: --------
      • Set VariableSet ActiveUsers = (All players matching ((((Matching player) slot status) Equal to Is playing) and (((Matching player) controller) Equal to User)).)
      • Set VariableSet TotalUsers = (Number of players in ActiveUsers)
  • Player Leaves
    • Events
      • Player - Player 1 (Red) leaves the game
      • Player - Player 2 (Blue) leaves the game
    • Conditions
    • Actions
      • -------- This User is no longer active: --------
      • Player Group - Remove (Triggering player) from ActiveUsers.
      • Set VariableSet TotalUsers = (TotalUsers - 1)

Now let's add the gold bounty:
  • Custom Bounty
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Owner of (Dying unit)) Equal to Neutral Hostile
      • ((Owner of (Killing unit)) is in ActiveUsers.) Equal to True
    • Actions
      • -------- In this case I'm dividing the Gold Bounty Base by the number of Users in the game: --------
      • -------- (Note that you can customize this Arithmetic to take into consideration Gold Bounty Dice rolls as well) --------
      • Set VariableSet Bounty = ((Unit: (Dying unit)'s Integer Field: Gold Bounty Awarded - Base ('ubba')) / TotalUsers)
      • Player - Add Bounty to Player 1 (Red).Current gold
      • Player - Add Bounty to Player 2 (Blue).Current gold

So this design isn't the most efficient and you could definitely improve it, but it gets the job done.
 

Attachments

  • Custom Bounty 1.w3m
    17.3 KB · Views: 14
Level 6
Joined
Aug 31, 2018
Messages
157
Btw @Uncle question. Your trigger works but not at 100%. Right now, for each killed mob, both player 1 and player 2 gets +20 gold. So if a mob gives 32 gold, i will get 52 gold instead and player 2 will get 20 gold.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,555
Btw @Uncle question. Your trigger works but not at 100%. Right now, for each killed mob, both player 1 and player 2 gets +20 gold. So if a mob gives 32 gold, i will get 52 gold instead and player 2 will get 20 gold.
It sounds like your creeps still have their Bounty set in the Object Editor. This is a triggered bounty system so it's meant to replace warcraft 3's normal bounty system, not use both.

The trigger will give X gold to both players, where X is Bounty Gold Base / Number of Active players.

In singleplayer it'll be X / 1 so full gold is given to one player.

In co-op it'll be X / 2 so the gold is split between the two players.

Do note that I ALWAYS add gold to both players, which I figured would be fine.
 
Status
Not open for further replies.
Top