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

System that counts the number of a certain unit type

Status
Not open for further replies.
Level 13
Joined
Sep 13, 2010
Messages
550
Kb ennyi:
  • UnitTypeCounter
    • Events
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units owned by (Picked player) of type Footman) and do (Actions)
            • Loop - Actions
              • Set Int = (Int + 1)
Ezt megcsinálod több típussal és Int-et persze más array-re kell rakni :)
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,180
Use a hashtable with parent of player slot number and child of unit type to allow you to store the integer representing the number of units of type the player has. When he makes a new unit you add 1 for that type while if one dies you remove 1 of that unit's type.

Spells like charm have to be tirggered so as to cause no type number inaccuracies.
 
Level 16
Joined
Jun 24, 2009
Messages
1,409
Kb ennyi:
  • UnitTypeCounter
    • Events
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units owned by (Picked player) of type Footman) and do (Actions)
            • Loop - Actions
              • Set Int = (Int + 1)
Ezt megcsinálod több típussal és Int-et persze más array-re kell rakni :)

On this site only english is allowed in public chat and forums ~.~ No matter if the one who asked for help speak hungaryan ~.~
Szóval maradj angolnál honfitársam ~.~
 
Status
Not open for further replies.
Top