• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[General] Data Reference

Status
Not open for further replies.
Level 6
Joined
Jul 23, 2018
Messages
243
Hello there, I thank you in advance for reading this thread and help me with my problems for all problems I've encountered.
So anyway, I put something like this in unit's extended tooltip

|c00A0A0A0Hit Point Base: <e000,HP>
Mana Base: None
Attack Enable: True
Attack Damage: <e000,dmgplus1>
Attack Speed: <e000,cool1>
Attack Type: Siege
Weapon Type: Artillery (Line)
Ability: Burning
Classification: Mechanical
Repair Time: <e000,reptm> seconds
Repair Cost: <e000,goldRep> gold
Defense Type: Large
Defense Base: <e000,def>
Armor Type: Wood
Can Flee: True
Speed Base: <e000,spd>
Upgrades Used: Iron Plating, Steel Ranged Bonus, Vorpal Blades|r

It's the data that I manipulated in WE and showed it in game. The problem is the speed base, attack speed, repair time and repair cost all show 0 except for hit point and defense base. How can I fix this?
 
Level 5
Joined
Jul 31, 2020
Messages
103
If you encounter values you can't seem to add from the object editor, I suggest building the tooltip through a script. I've done it several times in the past, it's not a big deal to just collect the needed values, and build your desired string.

Also, DoomBlade, doing it manually means it'll give you more work every time you modify something.
 
Level 6
Joined
Jul 23, 2018
Messages
243
If you encounter values you can't seem to add from the object editor, I suggest building the tooltip through a script. I've done it several times in the past, it's not a big deal to just collect the needed values, and build your desired string.

Also, DoomBlade, doing it manually means it'll give you more work every time you modify something.
I sadly do not know how to use script
 
Level 5
Joined
Jul 31, 2020
Messages
103
I sadly do not know how to use script

Alright, here's an example I put together.

vJASS:
function Trig_setMyTooltip_Actions takes nothing returns nothing
    // This script sets the learn, and extended tooltips (levels 1, 2, 3) for a custom Feral Spirit ability.

    local unit array tempUnit

    local integer array baseDamage
    local integer array damageDice
    local integer array damageSides
    local integer array damageMin
    local integer array damageMax
    local real array attackCooldown
    local real array damagePerSecond
    local integer array numSummons
    local integer array manaCost
    local integer array maxLife
    local integer array baseArmor
    local integer array cooldown

    local string tempStr

    set udg_pos = Location(GetRectMaxX(GetPlayableMapRect()), GetRectMinY(GetPlayableMapRect()))    // pos is a global Point type variable created in GUI, the location set here is the bottom right corner of the map
    call CreateNUnitsAtLoc( 1, 'o001', Player(bj_PLAYER_NEUTRAL_EXTRA), udg_pos, bj_UNIT_FACING )
    set tempUnit[0] = GetLastCreatedUnit()    // tempUnit[0] == ability level 1 summoned unit
    call CreateNUnitsAtLoc( 1, 'o002', Player(bj_PLAYER_NEUTRAL_EXTRA), udg_pos, bj_UNIT_FACING )
    set tempUnit[1] = GetLastCreatedUnit()    // tempUnit[1] == ability level 2 summoned unit
    call CreateNUnitsAtLoc( 1, 'o003', Player(bj_PLAYER_NEUTRAL_EXTRA), udg_pos, bj_UNIT_FACING )
    set tempUnit[2] = GetLastCreatedUnit()    // tempUnit[2] == ability level 3 summoned unit
    call CreateNUnitsAtLoc( 1, 'O000', Player(bj_PLAYER_NEUTRAL_EXTRA), udg_pos, bj_UNIT_FACING )
    set tempUnit[3] = GetLastCreatedUnit()    // tempUnit[3] == a hero unit to teach the ability to
    call RemoveLocation(udg_pos)
    call SelectHeroSkill(tempUnit[3], 'A000')    // 'A000' == the custom ability's id, accessible in the object editor after pressing ctrl + d

    set bj_forLoopAIndex = 0
    set bj_forLoopAIndexEnd = 2    // 0 to 2 because the ability has 3 levels, as already stated, and shown by the 3 different summons
    loop
        exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        // --- values related to damage
        set baseDamage[GetForLoopIndexA()] = BlzGetUnitBaseDamage(tempUnit[GetForLoopIndexA()], 0)    // the base damage value that can be changed in the object editor
        set damageDice[GetForLoopIndexA()] = BlzGetUnitDiceNumber(tempUnit[GetForLoopIndexA()], 0)    // dice count
        set damageSides[GetForLoopIndexA()] = BlzGetUnitDiceSides(tempUnit[GetForLoopIndexA()], 0)    // dice sides
        set damageMin[GetForLoopIndexA()] = (baseDamage[GetForLoopIndexA()] + damageDice[GetForLoopIndexA()])    // min damage = base damage + dice count
        set damageMax[GetForLoopIndexA()] = (baseDamage[GetForLoopIndexA()] + (damageDice[GetForLoopIndexA()] * damageSides[GetForLoopIndexA()]))    // max damage = base damage + dice count * dice sides
        set attackCooldown[GetForLoopIndexA()] = BlzGetUnitWeaponRealField(tempUnit[GetForLoopIndexA()], UNIT_WEAPON_RF_ATTACK_BASE_COOLDOWN, 0)
        set damagePerSecond[GetForLoopIndexA()] = ((I2R(damageMin[GetForLoopIndexA()]) + I2R(damageMax[GetForLoopIndexA()])) / 2) / attackCooldown[GetForLoopIndexA()]
        // --- non-damage values
        set numSummons[GetForLoopIndexA()] = BlzGetAbilityIntegerLevelField(BlzGetUnitAbility(tempUnit[3], 'A000'), ABILITY_ILF_NUMBER_OF_SUMMONED_UNITS_OSF2, GetForLoopIndexA())    // number of summoned units found in the object editor

        set baseArmor[GetForLoopIndexA()] = R2I(BlzGetUnitArmor(tempUnit[GetForLoopIndexA()]))    // the base armor, which can be modified in the object editor, of these units; this is normally a real value, but converting to integer so that it shows up neatly in the tooltip later is good enough; R2I() converts from real to integer

        set maxLife[GetForLoopIndexA()] = BlzGetUnitMaxHP(tempUnit[GetForLoopIndexA()])    // the max life/hp/health/whatever terminology one prefers

        set manaCost[GetForLoopIndexA()] = BlzGetAbilityManaCost('A000', GetForLoopIndexA())

        set cooldown[GetForLoopIndexA()] = R2I(BlzGetAbilityCooldown('A000', GetForLoopIndexA()))    // same deal here as with armor, normally a real value, but we only care about the integer part right now
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop
    set bj_forLoopAIndex = 0
    set bj_forLoopAIndexEnd = 3
    loop
        exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        call RemoveUnit(tempUnit[GetForLoopIndexA()])    // we don't need the dummy units anymore to access their properties, so we remove them all
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop

    // --- building the tooltip string here; not being fancy, just adding everything into one uniform tooltip, and using it for every level + the learn tooltip
    set tempStr = "Jimmy is a jolly ol' feller who likes dogs.|nNumber of Dogs: |cffffff00" + I2S(numSummons[0]) + "|r |cff808080,|r |cffffff00" + I2S(numSummons[1]) + "|r |cff808080,|r |cffffff00" + I2S(numSummons[2]) + "|r|nDog Damage: |cffffff00" + I2S(damageMin[0]) + " - " + I2S(damageMax[0]) + " (" + R2S(damagePerSecond[0]) + " DPS)|r |cff808080,|r |cffffff00" + I2S(damageMin[1]) + " - " + I2S(damageMax[1]) + " (" + R2S(damagePerSecond[1]) + " DPS)|r |cff808080,|r |cffffff00" + I2S(damageMin[2]) + " - " + I2S(damageMax[2]) + " (" + R2S(damagePerSecond[2]) + " DPS)|r|nDog Armor: |cffffff00" + I2S(baseArmor[0]) + "|r |cff808080,|r |cffffff00" + I2S(baseArmor[1]) + "|r |cff808080,|r |cffffff00" + I2S(baseArmor[2]) + "|r|nDog Life: |cffffff00" + I2S(maxLife[0]) + "|r |cff808080,|r |cffffff00" + I2S(maxLife[1]) + "|r |cff808080,|r |cffffff00" + I2S(maxLife[2]) + "|r|nMana Cost: |cffffff00" + I2S(manaCost[0]) + "|r |cff808080,|r |cffffff00" + I2S(manaCost[1]) + "|r |cff808080,|r |cffffff00" + I2S(manaCost[2]) + "|r|nCooldown: |cffffff00" + I2S(cooldown[0]) + "|r |cff808080,|r |cffffff00" + I2S(cooldown[1]) + "|r |cff808080,|r |cffffff00" + I2S(cooldown[2]) + "|r"

    // --- setting the tooltips right here
    set bj_forLoopAIndex = 0
    set bj_forLoopAIndexEnd = 2
    loop
        exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        call BlzSetAbilityExtendedTooltip('A000', tempStr, GetForLoopIndexA())
        call BlzSetAbilityResearchExtendedTooltip('A000', tempStr, GetForLoopIndexA())
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop
endfunction

function InitTrig_setMyTooltip takes nothing returns nothing
    set gg_trg_setMyTooltip = CreateTrigger()
    call TriggerAddAction(gg_trg_setMyTooltip, function Trig_setMyTooltip_Actions)
endfunction

It's commented to be easier to understand. I'm also attaching the map, so that you can check out the units/ability. It's ticked in to run on map init, by the way, that's how the script is called.

I would also attach a screenshot of how the tooltip looks like in-game, but since the map is there, you can check it out yourself. I didn't make anything fancy, it's for the sake of showing how it's done.
 

Attachments

  • (1)tooltip_script.w3x
    21.7 KB · Views: 14
Level 6
Joined
Jul 23, 2018
Messages
243
I'll learn jass quick then I'll come back to this
Edit: turns out, I can refer damage by using maxdmg1 and mindmg2 and 'm using 1.29 so I cannot open your map
Edit 2: what is this?
JASS:
    local integer array cooldown
And also you cannot refer speed base?
 
Last edited:
Status
Not open for further replies.
Top