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

Dynamic Tooltps is now a thing with 1.30

Status
Not open for further replies.
Level 10
Joined
Apr 9, 2004
Messages
502
Hi All,

Just tried this out and it's a little clunky but I made my tooltip dynamic. Not sure what other goodies 1.30 came out with but has anyone started using this? I think we can create fully dynamic tooltips (there's a bit of lag with use but for the most part it works quite well.

Thoughts?

Other thoughts:

we can now completely control a SFX, so the dummy unit is no longer a thing really...
 
Last edited:

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,183
One downside that it is a pain to create a good looking tooltip in the code editor. Most people need external tools (previously built into JNGP)
So I'd probably not overuse it since it seems time consuming.

As for SFX, dummies are actually still useful.
For example, if I want a unit to be able to cast a spell over and over with the same unit, and I want to use a hashtable it could be better to use a dummy unit instead.
Not required, but easier.
 
Level 13
Joined
Jul 15, 2007
Messages
763
I was working on a project (that's now on the shelf for the time being) where there was 1 ability for each player. The ability's tooltip was periodically modified to show the player's hero stats, so it effectively served as a character/stat sheet. It actually worked quite well.

I also did some brief testing with locally setting tooltips and it works without causing desyncs, however i was warned by others to be cautious and because i found a different solution i never pursued more vigorous desync testing.

As Chaosy says dummy units are still useful. Even in cases where dummies function as SFX, it's usually an auxiliary function for them, and they may carry out other functions such as casting abilities or bestowing auras.
 
Level 13
Joined
Oct 12, 2016
Messages
769
I personally will keep to the old ways of using dummy units simply because the new functions make maps inaccessible to older clients, which there are still a lot of. It's something to consider.
 
Level 8
Joined
Mar 19, 2017
Messages
248
It was a thing on 1.29 even. 1.30 brought dynamic item tooltips completely bug-free.
You can do neat things like showing the current cooldown of a skill (plus the new cooldown "getters"), ie. with a periodic timer of let's say 0.0416~ (1/24).
A constant track mechanism of the current unit selected of a given player could expand the dynamic tooltips/icons system to MUI.
Another neat thing is an easily managable Q-W-E-R ability system, on which you simply modify abilities tooltips accordingly with an internal system. Using multiple levels and Channel will allow to get different ability states, like disabled (not visible), targeted, instant, maybe different cast ranges (this will recquire lots of levels), the possibility to switch a "Q" ability with an "R", but the thing is you only need 4 abilities. Don't know if i explained this correctly to be fair...


Pinzu did a desync test with BlzSetAbilityIcon (this doesn't feature levels, so the only way) and it worked. Someone also did a desync test on the new item tooltips/icon modifiers, resulting in that such functions also worked with GetLocalPlayer blocks. The local hiding of sfx is the correct analogy (modifying a string on the GetLocalPlayer block) i guess, so it shouldn't desync per se.
This could also be explained because the functions that modify item/ability strings don't modify the internal value (on the object editor). One also may note that BlzSetAbilityTooltip functions won't work if you use them on a null string field as internal value. Maybe BlzSetAbilityIcon also won't work on abilities with no established icon path (there is no test here, but this may set the trend).

I think the ultimate desync test could be, 1. modifying the icon/tooltip of an ability locally for multiple players, then 2. doing a comparisson using BlzGetAbilityIcon/Tooltip functions plus a classic desync tester like removing a unit. My bet is that it will not even cause a desync, as the value returned and compared "should" be the internal value based on my hypothesis.
But maybe not.
 
Last edited:
I plan on making heavy use of dynamic tooltips in future iterations of Gaias Retaliation, to get rid of many ability duplicates I currently mass-generate via LUA scripts.

The potential is amazing, especially as it allows to show damage values of abilities dynamically calculated by hero stats.
It also allows for randomized stats on items.
 
Level 5
Joined
Jun 7, 2012
Messages
66
I am already using something like this. Works perfectly fine without desyncs.

Wurst:
function unit.heroUpdateSpellSlot(int slot)//1-36
    let uid=GetHandleId(this)
    let abilid=heroSpellDummi[slot-1]
    let index=uid.getHeroUidAbilityIndex(slot)
    let abillevel=uid.getHeroUidAbilityLevel(slot)
    let data=heroSpellInfoId[index] castTo HeroAbility
    var manaCost=data.manaCost
    let abiltype=data.abilType
    if data.manacostDynamic
        let pwr=this.getHeroSpellPower(index)
        if pwr>1.
            manaCost=R2I(I2R(manaCost)/pwr+0.5)
        else
            manaCost=R2I((2.-pwr)*I2R(manaCost)+0.5)
            if manaCost>100 and data.manaCost<=100
                manaCost=100
    SetPlayerAbilityAvailable(GetOwningPlayer(this),abilid,false)
    SetUnitAbilityLevel(this,abilid,abiltype)
    var name=data.name
    if abillevel>0
        name=name+" - |cffffcc00Level "+I2S(abillevel)+"|r"
    if abiltype!=AbilType.PASSIVE
        name=name+" (|cffffcc00"+heroSpellHotkey[slot-1]+"|r)"
    if localPlayer==this.getOwner()
        BlzSetAbilityTooltip(abilid,name,abiltype)
        BlzSetAbilityExtendedTooltip(abilid,data.description,abiltype)
        BlzSetAbilityIcon(abilid,data.icon)
    BlzSetUnitAbilityManaCost(this,abilid,abiltype,manaCost)
    BlzSetUnitAbilityCooldown(this,abilid,abiltype,data.cooldown)
    SetPlayerAbilityAvailable(GetOwningPlayer(this),abilid,true)

Same channel abilities on both screenshots similar to how Disruptive described it.

f617c5c37b.png
05a30b672c.png
 
Last edited:
Level 4
Joined
Jul 2, 2014
Messages
46
Just did something like dynamically creates tooltip and updates them as I update heroes stats (custom inventory/stat system so I have functions that I hook onto to make sure it's always up to date), I added some sort of "autodetect dynamic value" in tooltips

This tooltip : "Throw a poisoned arrow toward target enemy, on impact, deal {base=15;level=10;spellpower=60;color=cc78ff} magical damage over 5 seconds." becomes this

level 1: level1.png

level 4: level4.png

level 16 + 12 spellpower: level16+sp.png

Can actually add as much dynamic values as I want and as much values I want, can add an armor ratio, intelligence ratio, set display to percentage, as well as add values for some specific classes; works like a charm :p
 
Level 10
Joined
Apr 9, 2004
Messages
502
This is good news. As for ability setup, quick question on that is that each slot must have a unit id, plus you can't modify an ability once it's created correct? Additionally, channel works for 99% of things but doesn't account for some interactions such as casting not interrupting the previous action. You'd need something like roar or other spells to make that happen no?
 
plus you can't modify an ability once it's created correct?
You can change text & icons, cooldown & Manacost during the game.
One needs to force an update of the Ability Interface to see results for current selected units.

As for ability setup, quick question on that is that each slot must have a unit id
if you need different Spell Range / Spell Time / Targeting Type, yes.

One also needs to bind/execute ability Execution code/Trigger, in an unit/unitType/Level - button infrastructure. The Ability itself is no unique indicator anymore, when using such dynamic ability buttons. Which should be obvious, but wanted to point it out, cause it is a heavy change in the Ability Casting event handling.

Edit: The amount of levels drasticly increases with range/aoe variations, the spell time problem could be solved with code/triggers by always setting maximum channel time but doing an break/finsh in the code/trigger.

Edit: Did some counting to know the amount of levels one would need to create To support most spells in ones dynamgic Ability-Button System.

Assumptions
Each has a Magic/Phyisical/Ultimate level, except hidden
Ranges: melee/400/600/800/1200/unlimited -> 6 ranges
Aoes: 50/100/150/200/250/300/350/400/450/500 -> 10 AoEs​

Results into
  • 1 Hidden
  • 3 Selfcast
  • 18 (6x3) Single Target
  • 18 (6x3) TargetvPoint (Shockwave like targeting)
  • 180 (6x10x3) Point AoE
  • => 220
Theoretical one would not need Ultimate for Selfcast and AoE, cause there is nothing to penetrate for the spell itself, the code will do it.
  • 1
  • 2
  • 18
  • 18
  • 120
  • => 159
220 or 159 levels would that setup requier.
One would need upto 7 of such abilities to fill the unit ability Interface, But only the 1. would be a pain to create (cause that channel ability does not support autofill for many fields in WE). the 2 to 7 one are simple copies.

Edit: Edit: Oh no I forgot single target spells also need allowed Targets. That will explode the level amount even more.
 
Last edited:
Level 8
Joined
Mar 19, 2017
Messages
248
The amount of levels is something that relates to map design and is something that the author must decide. But there is some inherent power here (gameplay wise) and a possible new feature that the current JASS functions doesn't grant you directly (maybe we get new Cast Range modifiers/Hotkeys/ but that's not what we got right now). Channel ability has less intrinsic limitations (on average) than ie. Roar. Yes, Channel interrupts the previous action, but Roar is entirely hardcoded to be an Instant ability.

Another possible approach would be choosing different iconic skill types (this is game design), and doing the same that i said with the Channel ability but with different and iconic dummy Skills: ie. For your classic single target skill you use a dummy Chain Lightning with lots of levels, for your AoE skill you use a dummy Silence with lots of levels, for Instants you could use a dummy Roar. Then you simply add those abilities, hide them at the start (the new native comes in handy) create the infrastructure (here, to achieve the dinamic hotkeys you will need to, in general, create as much of skill types as slots, then maybe link them on a Table fashion "SKILL[integerSkillType][integerSkillSlot]") and then unhide them and modify them (with the tooltips/cooldowns/mana costs natives) as you need them to.
But here you're convoluting the infrastructure even more, and let me say innecessarily.

But the neat thing about the Channel system like is to switch hotkeys dinamically specially, among other things (additional control over a complete skill slot). But specially those hotkeys. And also the targeting types. Maybe you also want to feature dinamic cast ranges, different AoE's, or dinamic cast times, and depending on the precision you are aiming then maybe you need to explode the Channel ability with levels just like you said, but on my perspective i would do something different (more cast ranges and less aoes, but in the end the levels round the 200~ too should i want some precise cast ranges).
It is known that the loading time greatly resents abilities/upgrades with lots of levels, but i don't know if there is a treshold or something, like ie. having 20~ skills with 100 levels v/s having 4 skills with 500 levels. So this is the basic cost of this system basically (again, gameplay wise): an increased loading time. This could be huge, but i don't know the hard data here.
For heroes one could use Engineering Upgrade (just adding it to the hero) and more Channel abilities (but this time with less levels), ie. the first 4 Channel abilities comprehend cast ranges from 100-2000 for their respective slots, then by adding a custom Engineering Upgrade of a certain level you could access the next cast ranges, or maybe a certain Engineering Upgrade unlocks the AoE's, etc. But again, here i'm trading levels for more abilities.

Edit: Edit: Oh no I forgot single target spells also need allowed Targets. That will explode the level amount even more.
Just like casting time could be resolved with the trick you mentioned, the targeting filter can also be resolved with an ON_SPELL_CHANNEL trigger and some custom SimError function.
 
Last edited:
Level 15
Joined
Nov 30, 2007
Messages
1,202
I wouldn't say it was completely bug free, if I recall correctly manipulating cooldowns was a pain in the neck. But that might have been due to my specific use-case.

Another problem not making it completely dynamic is that you can't change target range or AOE without creating a redicolous amount of levels as far as I'm aware of. Though if you just want to change the range/aoe you could do that for a single spell quite easily, but not for a generic "spell menu".

Hotkeys could theoretically be customized if you create a spell for each hotkey you want to include, though that is alot of work for very little benfit (26 letters in the english alphabet to include for each spell).

*Edit:

I uploaded the system in the spell section in case anyone wants to check it out.
 
Last edited:
Status
Not open for further replies.
Top