• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

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
 
Level 3
Joined
Mar 29, 2014
Messages
23
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
Joined
Mar 24, 2011
Messages
1,082
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
Joined
May 20, 2014
Messages
228
  • 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.
Top