• 💀 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!

Player's units' total value calculation

Not open for further replies.
Level 11
Jan 23, 2015
Can you give me an idea of how to calculate the total point value of all of the player buildings?

I tried to do it in a few ways but failed, there must be a way but I can't think of it right now cause my brain is blocked from this WE xD
Level 3
Mar 29, 2014
easy, just look in the unit editor. there u can see the value of each given unit type. Then u need to count how many units of a type a player owns (u can do this by trigger numbers of unit in region entire mapowned by player) and then u need to add values by multiplying first and then adding them
Level 12
Mar 24, 2011
Uuugh... @Alpun No.

@RobertMDK You can do this:

  • Set TempUnitGroup = (Units in (Playable map area) owned by Player 1 (Red))
  • Unit Group - Pick every unit in TempUnitGroup and do (Actions)
    • Loop - Actions
      • Set TotalPoints = TotalPoints + (Point-value of (Picked unit))
  • Custom Script: call DestroyGroup(udg_TempUnitGroup)
TotalPoints is integer variable.
Maybe you would like to put all this in a loop 1 to 12 so you can get teh points of all players or array TotalPoints so you can het the total points for each player, TotalPoints[PlayerNumber]
Level 6
May 20, 2014
  • Actions
    • Set tempUnitGroup = (Units in (Playable map area) matching ((((Matching unit) is A structure) Equal to True) and ((Owner of (Matching unit)) Equal to Player 1 (Red))))
    • Unit Group - Pick every unit in tempUnitGroup and do (Actions)
      • Loop - Actions
        • Set tempInt = (tempInt + (Point-value of (Picked unit)))
    • Custom script: call DestroyGroup(udg_tempUnitGroup)
    • Game - Display to (All players) the text: (String(tempInt))
I haven't tested personally but I think you're looking for something like this.

edit: beaten again asdfnjkwenjfkanfdsas

edit2: picked unit > matching unit
Not open for further replies.