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

[Solved] Count of unit abilities

Status
Not open for further replies.
Level 2
Joined
Aug 4, 2010
Messages
23
How can i make ( integer ) condition which will be checking if unit have eg. 3 abilities.
In GUI i se inventory size, count of buffs but there is no count of abilities.

Another problem
It is possible to store ability's ID into something like 2D arrays?
 
Last edited:
Level 33
Joined
Mar 27, 2008
Messages
8,035
  • Ability Count
    • Events
      • Unit - A unit Learns a skill
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Level of Acid Bomb for (Triggering unit)) Equal to 1
          • (Level of Animate Dead for (Triggering unit)) Equal to 1
          • (Level of Avatar for (Triggering unit)) Equal to 1
          • *Fill this field with your ability in the game*
    • Actions
      • Set AbilitiesCount = (AbilitiesCount + 1)
      • Game - Display to (All players) the text: (You have + ((String(AbilitiesCount)) + abilities.))
Just follow trigger above, and that will count the unit's count of ability (trigger above does not work for multiple unit)
 
Ahahahaha dude you tell me to read post but you didn't at 1st place :)
You forget to say that all abilities in 1 "OR" condition function belongs to exactly 1 hero.
My point was to point at fact that abilities above can't be random or from few units :)
At the other hand you speak of using this for 2 or more units.
 
Level 16
Joined
May 1, 2008
Messages
1,605
Moin moin o_O

YIHA! the battle has started *ding ding ding*

  • Test
    • Events
      • Unit - A unit Learns a skill
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Paladin
    • Actions
      • Set TempUnit = (Triggering unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Level of Acid Bomb for TempUnit) Equal to 1
              • (Level of Animate Dead for TempUnit) Equal to 1
              • (Level of Attribute Bonus for TempUnit) Equal to 1
        • Then - Actions
          • Set AbilityCount[(Player number of (Owner of TempUnit))] = (AbilityCount[(Player number of (Owner of TempUnit))] + 1)
          • Custom script: call DisplayTimedTextToPlayer(GetOwningPlayer(udg_TempUnit),0.,0.,5.,I2S(udg_AbilityCount[GetPlayerId(GetOwningPlayer(udg_TempUnit)) +1]))
        • Else - Actions
      • Set TempUnit = No unit
Greetings and Peace (!!)
Dr. Boom
 
Level 2
Joined
Aug 4, 2010
Messages
23
That will not work with my map because heroes can buy skills. I'll try first suggestion.
 
Level 2
Joined
Aug 4, 2010
Messages
23
Well i making AIs, they can right now: fight, run away to refill hp, buy first skill. Now i trying to do that AI will decide if they need new skill or upgrade.

Edit: Is possible to have 2D arrays or something similar?
 
Level 16
Joined
May 1, 2008
Messages
1,605
Well if you say, you can buy the abilities, then I do it this way, that I create dummy tombs, which can be bought and give the (TriggeringUnit()) the ability. In this case use this:

  • Item
    • Events
      • Unit - A unit Sells an item (from shop)
    • Conditions
      • (Item-class of (Sold Item)) Equal to Campaign
    • Actions
      • Set AbilityCount[(Player number of (Owner of (Triggering unit)))] = (AbilityCount[(Player number of (Owner of (Triggering unit)))] + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • AbilityCount[(Player number of (Owner of (Triggering unit)))] Equal to 3
        • Then - Actions
          • -------- actions --------
        • Else - Actions
Note:
This trigger requires, that all "buy able ability items" are in the category "Campaign". You can change it ofc, but this make the filter easier instead of filter all the different items.

@ Pharaoh_: Well for example you to this with Locations and Groups. So I thought I do the same with units, because I do the same in jass. Well if this isn't needed ... fine =)

Greetings and Peace
Dr. Boom
 
Level 2
Joined
Aug 4, 2010
Messages
23
Ok thank you guys, you helped my with counting but now a have another problem.

I want to store abiliy's ID into 2D array. HeroSkill[ playerID, numberOfSkill ] but in GUI there is no 2D arrays.
 
Status
Not open for further replies.
Top