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

is it possible to Increase a units stats using triggers?

Status
Not open for further replies.
Level 5
Joined
Jun 13, 2012
Messages
113
so what i want to do is simple well simple when i thought of it. Basically when a player has more building then the other players the units spawned will gain increase attack and defence times to the difference of buildings. 1 problem there is no trigger that can increase a units states. Is it possible? if yes can you show me and example? plz and thanks
 

Kusanagi Kuro

Hosted Project: SC
Level 10
Joined
Mar 11, 2012
Messages
708
Yes. It is possible. U can create some abilities that based on Item Ability Attack Speed Bonus and Item Ability Armor Bonus. All of them has several levels. Then u can add those abilities to all unit. Next, calculate the difference of building and then set the level of those abilities for the player to the exact level.
I cant type the trigger right now but other people may help u with them. I just give u the way.
 

Kusanagi Kuro

Hosted Project: SC
Level 10
Joined
Mar 11, 2012
Messages
708
^ I dont know about JASS :D. Also, he doesnt mention about Hero Attribute. What he is talking about is the attack speed and defence bonus.
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
If he wanted to increase the white numbers, he'd use a trigger to increase the stat (str, int or agi) directly. If he wanted to show the increase as a green number, he'd use abilities for that.

The first trigger will find the player with the most farms. The second trigger will give all trained units owned by the player with most farms bonus abilities and set their level to the difference in farms. The difference is calculated based on the player who has the most farms and the player who has second most farms.

  • Untitled Trigger 042
    • Events
      • Unit - A unit Dies
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Farm
    • Actions
      • Set group = (Units of type (Unit-type of (Triggering unit)))
      • Unit Group - Pick every unit in group and do (Actions)
        • Loop - Actions
          • Set u = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (u is alive) Equal to True
            • Then - Actions
              • Set i = (Player number of (Owner of u))
              • Set IAR[i] = (IAR[i] + 1)
            • Else - Actions
      • Set i = 0
      • Set i1 = 0
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • IAR[(Integer A)] Greater than or equal to i
            • Then - Actions
              • Set i1 = i
              • Set i = IAR[(Integer A)]
              • Set p1 = (Player((Integer A)))
            • Else - Actions
          • Set IAR[(Integer A)] = 0
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • i Not equal to i1
          • i Not equal to 0
        • Then - Actions
          • Set PLAYER = p1
          • Set BONUS = (i - i1)
        • Else - Actions
          • Set BONUS = 0
    • Custom script: call DestroyGroup(udg_group)
  • Untitled Trigger 044
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
      • BONUS Not equal to 0
      • (Owner of (Triggering unit)) Equal to PLAYER
    • Actions
      • Unit - Add Acid Bomb to (Triggering unit)
      • Unit - Set level of Acid Bomb for (Triggering unit) to BONUS
      • Unit - Add Animate Dead to (Triggering unit)
      • Unit - Set level of Animate Dead for (Triggering unit) to BONUS
 
Status
Not open for further replies.
Top