• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

How to Show Enemy's Current Gold?

Status
Not open for further replies.
Level 5
Joined
May 8, 2020
Messages
90
1711030806270.png


I have a formula like this but don't know how to do it when I enter a command or something

for example: -show

It will display the gold of all enemies in play
 
Enemies in this case are Players and when you want to work with multiple Players at once you use a Player Group. Just like when you want to work with multiple Units you would use a Unit Group. I recommend trying to get into the habit of relying on these "Group" actions because you're going to be using them a lot. Unit/Player = a single thing, Unit Group/Player Group = multiple things.

With that in mind, here's one way to do it:
  • Enemy Gold Command
    • Events
      • Player - Player 1 (Red) types a chat message containing -enemy gold as An exact match
      • Player - Player 2 (Blue) types a chat message containing -enemy gold as An exact match
    • Conditions
    • Actions
      • Set Player_Group_Self = (Player group((Triggering player)))
      • Set Player_Group_Enemies = (All enemies of (Triggering player))
      • Player Group - Pick every player in Player_Group_Enemies and do (Actions)
        • Loop - Actions
          • Set Current_Gold = ((Picked player) Current gold)
          • Game - Display to Player_Group_Self for 10.00 seconds the text: ((Name of (Picked player)) + ( current gold: + (String(Current_Gold))))
      • Custom script: call DestroyForce( udg_Player_Group_Self )
      • Custom script: call DestroyForce( udg_Player_Group_Enemies )
^ This will only show the text to the Player that typed the chat command. The Custom Scripts help clean up the memory leaks but you don't NEED them for the trigger to work.

conc.png
 
Last edited:
Status
Not open for further replies.
Back
Top