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

[Solved] Roar Ability (Increase Strength) - MUI Spell

Status
Not open for further replies.
Level 4
Joined
Sep 25, 2018
Messages
81
I am trying to create an ability which increases the strength of the caster by 10 for the duration of the ability.

The ability is based on Roar, the unit casts the ability, gains +50% bonus attack damage and +10 strength for 15 seconds. Only the caster is affected by the roar, so it no longer effects other units.

I am just wondering the best way to deal with the attribute element of the ability. Seeing as now you can edit the Attribute Bonus ability using triggers to increase / decrease the bonus, I am wondering whether it may be easier just to give every Hero a hidden Attribute Bonus ability and just edit the bonus each time using triggers.

Edit: So I was trying to do the trigger (It has been a few years since I have done any Warcraft 3 triggering) and I am having trouble getting the Attribute Bonus to remove the bonus strength after the Roar buff has been lost, all that seems to happen is the unit suddenly starts losing 10 strength every 0.1 seconds and then dies (bit weird). This is what I have so far:

  • RoarCast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Roar (Bear)
    • Actions
      • -------- Edit Units Attributes --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) has buff Roar (Bear)) Equal to False
        • Then - Actions
          • Ability - Set Ability: (Unit: (Triggering unit)'s Ability with Ability Code: Attribute Bonus )'s Integer Level Field: Strength Bonus ('Istr') of Level: 0 to ((Ability: (Unit: (Triggering unit)'s Ability with Ability Code: Attribute Bonus )'s Integer Level Field Strength Bonus ('Istr'), of Level: 0) + 10)
          • Unit - Increase level of Attribute Bonus for (Triggering unit)
          • Unit - Decrease level of Attribute Bonus for (Triggering unit)
        • Else - Actions
      • -------- - --------
      • -------- Add to R_UnitGroup --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) is in R_UnitGroup.) Equal to False
        • Then - Actions
          • Unit Group - Add (Triggering unit) to R_UnitGroup
        • Else - Actions
      • -------- - --------
      • -------- Turn on RoarTimer --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (RoarTimer <gen> is on) Equal to False
        • Then - Actions
          • Trigger - Turn on RoarTimer <gen>
        • Else - Actions

  • RoarTimer
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in R_UnitGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff Roar (Bear)) Equal to True
            • Then - Actions
            • Else - Actions
              • Ability - Set Ability: (Unit: (Picked unit)'s Ability with Ability Code: Attribute Bonus )'s Integer Level Field: Strength Bonus ('Istr') of Level: 0 to ((Ability: (Unit: (Picked unit)'s Ability with Ability Code: Attribute Bonus )'s Integer Level Field Strength Bonus ('Istr'), of Level: 0) - 10)
              • Unit - Increase level of Attribute Bonus for (Picked unit)
              • Unit - Decrease level of Attribute Bonus for (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of units in R_UnitGroup) Equal to 0
            • Then - Actions
              • Trigger - Turn off (This trigger)
            • Else - Actions
 
Last edited:
Level 15
Joined
Feb 2, 2009
Messages
156
Looks to me that you may be forgetting to remove the unit from the unit group once it no longer has the buff. As such when the trigger loops it just decreases the strength of the unit until its conveyed hit point bonus from strength goes below 0 (resulting in death).

So a "Unit - Remove (Picked Unit) from R_UnitGroup" after your changing of the Attribute Bonus in your RoarTimer trigger should do the trick! (i think?)

Once that is fixed it looks decent! In terms of your earlier question:
"I am wondering whether it may be easier just to give every Hero a hidden Attribute Bonus ability and just edit the bonus each time using triggers."
I can tell you that it saves you some time navigating through some GUI windows, but having the flexibility of modifying it in code is helpful.

But in my own experience seeing the '+' symbol on a heroes strength when there is a bonus is nice visually, and I think what your doing with attribute bonus in this is really neat!

Edit: Clarification and small typos.
 
Last edited:
Level 4
Joined
Sep 25, 2018
Messages
81
Looks to me that you may be forgetting to remove the unit from the unit group once it no longer has the buff. As such when the trigger loops it just decreases the strength of the unit until its conveyed hit point bonus from strength goes below 0 (resulting in death).

So a "Unit - Remove (Picked Unit) from R_UnitGroup" after your changing of the Attribute Bonus in your RoarTimer trigger should do the trick! (i think?)

Once that is fixed it looks decent! In terms of your earlier question:

I can tell you that it saves you some time navigating through some GUI windows, but having the flexibility of modifying it in code is helpful.

But in my own experience seeing the '+' symbol on a heroes strength when there is a bonus is nice visually, and I think what your doing with attribute bonus in this is really neat!

Edit: Clarification and small typos.

So a "Unit - Remove (Picked Unit) from R_UnitGroup" after your changing of the Attribute Bonus in your RoarTimer trigger should do the trick! (i think?)
Yes, that did the trick! Not sure how I completely forgot to remove the unit from the trigger at the end.

Seems to be working properly now. Little concerned that my code may leak or be inefficient, but what I have does work and seems to be MUI.

  • RoarCast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Roar (Bear)
    • Actions
      • -------- Edit Units Attributes --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) has buff Roar (Bear)) Equal to False
        • Then - Actions
          • Ability - Set Ability: (Unit: (Triggering unit)'s Ability with Ability Code: Attribute Bonus )'s Integer Level Field: Strength Bonus ('Istr') of Level: 0 to ((Ability: (Unit: (Triggering unit)'s Ability with Ability Code: Attribute Bonus )'s Integer Level Field Strength Bonus ('Istr'), of Level: 0) + 10)
          • Unit - Increase level of Attribute Bonus for (Triggering unit)
          • Unit - Decrease level of Attribute Bonus for (Triggering unit)
        • Else - Actions
      • -------- - --------
      • -------- Add to R_UnitGroup --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) is in R_UnitGroup.) Equal to False
        • Then - Actions
          • Unit Group - Add (Triggering unit) to R_UnitGroup
        • Else - Actions
      • -------- - --------
      • -------- Turn on RoarTimer --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (RoarTimer <gen> is on) Equal to False
        • Then - Actions
          • Trigger - Turn on RoarTimer <gen>
        • Else - Actions

  • RoarTimer
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in R_UnitGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff Roar (Bear)) Equal to False
            • Then - Actions
              • Ability - Set Ability: (Unit: (Picked unit)'s Ability with Ability Code: Attribute Bonus )'s Integer Level Field: Strength Bonus ('Istr') of Level: 0 to ((Ability: (Unit: (Picked unit)'s Ability with Ability Code: Attribute Bonus )'s Integer Level Field Strength Bonus ('Istr'), of Level: 0) - 10)
              • Unit - Increase level of Attribute Bonus for (Picked unit)
              • Unit - Decrease level of Attribute Bonus for (Picked unit)
              • Unit Group - Remove (Picked unit) from R_UnitGroup.
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of units in R_UnitGroup) Equal to 0
            • Then - Actions
              • Trigger - Turn off (This trigger)
            • Else - Actions
 
Status
Not open for further replies.
Top