• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

How to Show Enemy's Current Gold?

Level 5
Joined
May 8, 2020
Messages
80
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
 

Uncle

Warcraft Moderator
Level 65
Joined
Aug 10, 2018
Messages
6,641
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:
Top