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

Modifying Basic Attack Stat Based on Missing Health

Status
Not open for further replies.
Level 24
Joined
Feb 9, 2009
Messages
1,783
As it says on the tin, or more in depth:
Unit gains 0.15/0.20/0.25/0.30/0.35 damage per 1% health missing

I've tried modifying Item - Attack Damage Bonus (Claws of Attack) & Item Permanent Damage Bonus - (Tome) using the Ability Modifer Natives, Ex:
  • Ability - Set Ability: (Unit: (Picked unit)'s Ability with Ability Code: Item Permanent Damage Gain )'s Integer Level Field: Attack Modification ('Iaa1') of Level: 0 to X
  • Ability - Set Ability: (Unit: (Picked unit)'s Ability with Ability Code: Item Damage Bonus (+1))'s Integer Level Field: Attack Bonus ('Iatt') of Level: 0 to X

No dice!

Working directly with the unit's base attack does work, however that brings the problem of needing to trigger any form of damage increments.

Lastly I'd like to avoid spamming +100 levels or separate copies of Item damage bonus with varying levels.

Please & Thank you!
 

Uncle

Warcraft Moderator
Level 63
Joined
Aug 10, 2018
Messages
6,456
Try refreshing the ability. increase its level and decrease it back right away. Or disable it and re-enable it back. If those don't work, try adding a 0.00 second wait before the refresh.
Wow, all this time I was wondering why this wouldn't work. Refreshing the ability works perfectly.
  • Cast Spell
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Test
    • Actions
      • Set i = (i + 1)
      • Ability - Set Ability: (Unit: (Triggering unit)'s Ability with Ability Code: Damage Bonus )'s Integer Level Field: Attack Bonus ('Iatt') of Level: 0 to i
      • Unit - Set level of Damage Bonus for (Triggering unit) to 2
      • Unit - Set level of Damage Bonus for (Triggering unit) to 1
Make sure the Damage Bonus ability has 2 levels in the Object Editor so it can increase/decrease properly.

Edit:
But how would you use this method to get Real damage bonuses? You're pretty much stuck with using Integers as far as I know.
  • Set real = (real + 0.25)
  • Ability - Set Ability: (Unit: (Triggering unit)'s Ability with Ability Code: Damage Bonus )'s Integer Level Field: Attack Bonus ('Iatt') of Level: 0 to (Integer(real))
  • Unit - Set level of Damage Bonus for (Triggering unit) to 2
  • Unit - Set level of Damage Bonus for (Triggering unit) to 1
Tested this with a Damage Engine and it doesn't appear to work.

What you could do is use this function as a way to display the current bonus damage (at least every +1) on the UI and then have a separate Real variable that is used with a DDS to calculate the true damage dealt. I uploaded a map with a working example. The UI displays +1 damage but you'll see that the unit deals 1.25, 1.50, 1.75, etc... damage.
 

Attachments

  • Bonus Damage Test.w3x
    44.3 KB · Views: 20
Last edited:
Level 24
Joined
Feb 9, 2009
Messages
1,783
I was toiling over why the flipping thing wouldn't work!
Nice job you two!

Edit: have some Cherry Tomatoes(Rep)!
cherry tomato rep (Balloon shop - Pepper).gif
 
Last edited:
Status
Not open for further replies.
Top