Add 0.5 attack as a bonus

Level 11
Joined
Jul 28, 2024
Messages
340
How can I add 0.5 attack to a unit as a bonus? Or 1.5?..

I think I saw in the past modifier like +1.5

i use this library at the moment
but it is not very important

or maybe damage bonus can be set as percent?
 
Last edited:
Did you try using those numbers when setting/adding the bonus?
  • Custom script: call SetUnitBonus(GetTriggerUnit(), BONUS_DAMAGE, 0.5)
  • Custom script: call SetUnitBonus(GetTriggerUnit(), BONUS_DAMAGE, 1.5)
  • Custom script: call AddUnitBonus(GetTriggerUnit(), BONUS_DAMAGE, 0.5)
  • Custom script: call AddUnitBonus(GetTriggerUnit(), BONUS_DAMAGE, 1.5)
These functions take a Real.

Warcraft 3's UI often displays values as Integers, but under the hood it's using Reals for most things. So your Footman's Attack UI may display 11-13 damage, but the Footman can deal 11.5 damage to a unit. Maybe that's related?
 
Last edited:
Yeah that's how i invoke it but i would like to see it in the ui...
I looked into it and NewBonus uses the Item Damage Bonus ability which can only support Integers, so it's probably rounding your 0.5 down to 0 and 1.5 down to 1.

I believe the only option is to use Command Aura, have it Target: Self, and change it to a Flat Bonus. But even that might round down.

Edit: Nope, Command Aura rounds to an Integer as well.

I don't think you can get the Attack UI to display anything but Integers, unless you want to work with custom UI frames. Some references:
This will likely be a major headache to get working properly.
 
Last edited:
Back
Top