• 💀 Happy Halloween! 💀 It's time to vote for the best terrain! Check out the entries to Hive's HD Terrain Contest #2 - Vampire Folklore.❗️Poll closes on November 14, 2023. 🔗Click here to cast your vote!
  • 🏆 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!
  • 🏆 HD Level Design Contest #1 is OPEN! Contestants must create a maze with at least one entry point, and at least one exit point. The map should be made in HD mode, and should not be openable in SD. Only custom models from Hive's HD model and texture sections are allowed. The only exceptions are DNC models and omnilights. This is mainly a visual and design oriented contest, not technical. The UI and video walkthrough rules are there to give everyone an equal shot at victory by standardizing how viewers see the terrain. 🔗Click here to enter!

Counting specific unit / building and displaying it as text to player

Status
Not open for further replies.
Level 2
Joined
Aug 24, 2021
Messages
8
Hi All,

I am wondering if you can help me out with this.

i want to be able to have the game display as a text when they type something like "-count" to show the number of X building to them, so at any point of the game they can check how many they have. This number would obviously change as they build more or if they are killed


I worked it out how to do it in a leaderboard, but not for it to display as a text response

So i have the easy part complete with condition play type exact match -count and display to player 1, i just dont know how to do it without the leaderboard only count trigger.

any help would be great

thanks!
 
Last edited:
Level 12
Joined
Feb 5, 2018
Messages
509
Well assuming you set up all the variables for the building counting, this should be easy.

  • Building Count
    • Events
      • Player - Player 1 (Red) types a chat message containing -count as An exact match
      • Player - Player 2 (Blue) types a chat message containing -count as An exact match
      • Player - Player 3 (Teal) types a chat message containing -count as An exact match
    • Conditions
    • Actions
      • Set VariableSet PlayerCheck = (Triggering player)
      • -------- --------
      • Set VariableSet PlayerNumber = (Player number of PlayerCheck)
      • -------- --------
      • Game - Display to (Player group(PlayerCheck)) for 10.00 seconds the text: (String(Building_Count[PlayerNumber]))
Depending on how you set up your variables you might need to add conditions, but I strongly recommend using arrays. Or you can just use a bunch of if/then/else blocks. Hope this gets you started.

This variable Building_Count is an integer array variable. You can replace with your own variable.
Playercheck = player variable
PlayerNumber = integer variable
 

Uncle

Warcraft Moderator
Level 59
Joined
Aug 10, 2018
Messages
5,852
You can also add all of the buildings to a unit group temporarily. Then you can display the number of units in the group.
  • Actions
  • Set Variable TempGroup = Units owned by (Triggering player) matching Matching unit is a structure equal to True
  • Game - Display to (Player group(Triggering player) for 10.00 seconds the text: (String(Number of units in TempGroup))
  • Custom script: call DestroyGroup(udg_TempGroup)
 
Status
Not open for further replies.
Top