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

Player's units' total value calculation

Status
Not open for further replies.
Level 11
Joined
Jan 23, 2015
Messages
788
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
 
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
 
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]
 
  • 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
 
Status
Not open for further replies.
Back
Top