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

Display Damage of a Custom Unit in it's Extended Tooltip

Status
Not open for further replies.
Level 2
Joined
Mar 6, 2020
Messages
14
Hello Guys,
I created a copy of the HeadHunter unit, modified it's damage base from 21 to 99 and now I want to display this number in the HeadHunter's extended tooltip.
Later, I would also like to references this new damage number (99) in some other unit's tooltip.

What I did:
- find out new units id:
Code:
o000:ohun
- find out damage id:
Code:
mindmg1, maxdmg1, dmgplus1
- write the tooltip:
Code:
HP: <o000:ohun,HP>|nDamage: <o000:ohun,mindmg1> - <o000:0hun,maxdmg1>

This does not work. It will display the modified HP value correctly. However, it won't show the modified damage number correctly...

Anything I missed here?
 
Level 12
Joined
Jan 30, 2020
Messages
875
I had the same concern with abilities extended tooltips, for example where you want to indicate the damage of a summoned unit for a summoning ability .

It failed completely, so I ended up writing the final value directly.

If anyone has found workarounds, I am also interested, thanks !
 
Level 2
Joined
Mar 6, 2020
Messages
14
woah thats really bad. i need this value at like 3 different locations (unit, spell, item)...
so if i need to change the damage of a unit in the future thats really bad :/
 
Level 12
Joined
Jan 30, 2020
Messages
875
Hello again.

@Bigabig : I haven't tested it yet, but it should work.
I am yet unfamiliar with all these new natives Blizzard has introduced, but while looking for something else, I found those that could solve your problem :

JASS:
// All these to change the tooltip of your ability with triggers :

native BlzSetAbilityTooltip                        takes integer abilCode, string tooltip, integer level returns nothing
native BlzSetAbilityActivatedTooltip               takes integer abilCode, string tooltip, integer level returns nothing
native BlzSetAbilityExtendedTooltip                takes integer abilCode, string extendedTooltip, integer level returns nothing
native BlzSetAbilityActivatedExtendedTooltip       takes integer abilCode, string extendedTooltip, integer level returns nothing
native BlzSetAbilityResearchTooltip                takes integer abilCode, string researchTooltip, integer level returns nothing
native BlzSetAbilityResearchExtendedTooltip        takes integer abilCode, string researchExtendedTooltip, integer level returns nothing
native BlzGetAbilityTooltip                        takes integer abilCode, integer level returns string
native BlzGetAbilityActivatedTooltip               takes integer abilCode, integer level returns string
native BlzGetAbilityExtendedTooltip                takes integer abilCode, integer level returns string
native BlzGetAbilityActivatedExtendedTooltip       takes integer abilCode, integer level returns string
native BlzGetAbilityResearchTooltip                takes integer abilCode, integer level returns string
native BlzGetAbilityResearchExtendedTooltip        takes integer abilCode, integer level returns string

// and these to get your unit's min/max damage. If it returns the initial values, you can use the Set* natives :

native BlzGetUnitBaseDamage                        takes unit whichUnit, integer weaponIndex returns integer
native BlzSetUnitBaseDamage                        takes unit whichUnit, integer baseDamage, integer weaponIndex returns nothing
native BlzGetUnitDiceNumber                        takes unit whichUnit, integer weaponIndex returns integer
native BlzSetUnitDiceNumber                        takes unit whichUnit, integer diceNumber, integer weaponIndex returns nothing
native BlzGetUnitDiceSides                         takes unit whichUnit, integer weaponIndex returns integer
native BlzSetUnitDiceSides                         takes unit whichUnit, integer diceSides, integer weaponIndex returns nothing

So all you have to do is calculate the min and max damage from BaseDamage, DiceNumber and DiceSlices, put this in your Extended tooltip string, and change your ability extended tooltip with the native

If Base damage and dices changes are not read properly by the unit natives, you'll just have to set them with triggers.

I don't see how this would not work !

Note that I haven't implemented this in my map as I only have 3 summoning abilities in total and I only need to display 1 unit damage for each ability.
But if i extend these summoning abilities in the future, that is how I would do it.

If you only use GUI, it should still be easy doing all calculations in GUI and then call the natives with a custom script line when needed.


Hoping this will solve your problem,
Take care !
 
Status
Not open for further replies.
Top