lep / jassdoc

Document the WarCraft 3 API
52 stars 20 forks source link

GetUnitAbilityLevel skills treated as equals #152

Closed Tasyen closed 2 months ago

Tasyen commented 2 months ago

GetUnitAbilityLevel treats some abilities as the same. Recently I wanted to check which worker ability an worker has so I did GetUnitAbilityLevel > 0 . But every melee worker had all built skills and returned 1 for any of them.

print(GetUnitName(udg_Unit))
local skills = {'ANbu','AHbu','AEbu','AObu','AUbu','AGbu'}
for i, skill in ipairs(skills) do
   print(skill, GetUnitAbilityLevel(udg_Unit, FourCC(skill)))
end

image

Luashine commented 2 months ago

Oh, one one hand general stuff about the game should belong to a mapper's wiki, on the other hand we don't have such a wiki and even if we did, would anyone like to look up info in two places?

I will expand the test code and make it a PR. Thanks!

Luashine commented 2 months ago

builders2

nbee is some campaign High Elf "engineer" in name only. He has no building ability. ogru is Grunt for control. I am not sure who all these building skills belong to, I just ran with your list :)

lep commented 2 months ago
local unit u = CreateUnit(Player(0), 'hpea', 0, 0, 0)
call BJDebugMsg(I2S(GetHandleId(BlzGetUnitAbility(u, 'AHbu'))))
call BJDebugMsg(I2S(GetHandleId(BlzGetUnitAbility(u, 'AObu'))))

Yeah, you even get the same ability object (the above should print the same number twice).

WaterKnight commented 2 months ago

Also works with UnitRemoveAbility and BlzUnitDisableAbility.