BlzSetAbilityStringLevelField
- Parameters
-
whichAbility ability
whichField abilitystringlevelfield
level integer
0-indexed level (since 1.31.1). Index=0 means level=1 in game and so on.
value string
- comment
- bug
-
v2.0.3.22904, v2.0.3: per-ability instance fields sometimes wrongly apply to all ability instances of the base type. See
BlzSetAbilityStringLevelField
for test code.Bug report: https://us.forums.blizzard.com/en/warcraft3/t/ability-specific-tooltip-natives-broken-in-v20322978/36601
Test code (Lua):
heroA = CreateUnit(Player(0), FourCC("Otch"), -100, 0, 90) heroB = CreateUnit(Player(0), FourCC("Otch"), 100, 0, 90) abilCode = FourCC"AOmi" print(UnitAddAbility(heroA, abilCode)) print(UnitAddAbility(heroB, abilCode)) abilityA = BlzGetUnitAbility(heroA, abilCode) abilityB = BlzGetUnitAbility(heroB, abilCode) print("ability pointers:", tostring(abilityA), tostring(abilityB)) BlzSetAbilityStringLevelField(abilityB, ABILITY_SLF_TOOLTIP_NORMAL, 0, "this is ability B tooltip") BlzSetAbilityStringLevelField(abilityB, ABILITY_SLF_TOOLTIP_NORMAL_EXTENDED, 0, "this is ability B tooltip extended") heroC = CreateUnit(Player(0), FourCC("Otch"), 200, 0, 90) print(UnitAddAbility(heroC, abilCode)) abilityC = BlzGetUnitAbility(heroC, abilCode) -- String Level Field, wrongly applies to all in 2.0.3 print("Expected: default / changed / default") print(BlzGetAbilityStringLevelField(abilityA, ABILITY_SLF_TOOLTIP_NORMAL, 0)) print(BlzGetAbilityStringLevelField(abilityB, ABILITY_SLF_TOOLTIP_NORMAL, 0)) print(BlzGetAbilityStringLevelField(abilityC, ABILITY_SLF_TOOLTIP_NORMAL, 0)) -- Integer Level Field test, works in 2.0.3 print("expected: changed (77), unchanged (125)") print(BlzGetAbilityIntegerLevelField(abilityA, ABILITY_ILF_MANA_COST, 0)) print(BlzSetAbilityIntegerLevelField(abilityA, ABILITY_ILF_MANA_COST, 0, 77)) print(BlzGetAbilityIntegerLevelField(abilityA, ABILITY_ILF_MANA_COST, 0)) print(BlzGetAbilityIntegerLevelField(abilityB, ABILITY_ILF_MANA_COST, 0)) -- Integer Field test, wrongly applies to all in 2.0.3 -- v2.0.2: sets value, but has no effect print(BlzGetAbilityIntegerField(abilityA, ABILITY_IF_BUTTON_POSITION_NORMAL_X)) print(BlzSetAbilityIntegerField(abilityA, ABILITY_IF_BUTTON_POSITION_NORMAL_X, 2)) print(BlzGetAbilityIntegerField(abilityA, ABILITY_IF_BUTTON_POSITION_NORMAL_X)) print(BlzGetAbilityIntegerField(abilityB, ABILITY_IF_BUTTON_POSITION_NORMAL_X)) print(BlzGetAbilityIntegerField(abilityA, ABILITY_IF_BUTTON_POSITION_NORMAL_Y)) print(BlzSetAbilityIntegerField(abilityA, ABILITY_IF_BUTTON_POSITION_NORMAL_Y, 1)) print(BlzGetAbilityIntegerField(abilityA, ABILITY_IF_BUTTON_POSITION_NORMAL_Y)) print(BlzGetAbilityIntegerField(abilityB, ABILITY_IF_BUTTON_POSITION_NORMAL_Y)) -- String Field test, wrongly applies to all in 2.0.3 print(BlzGetAbilityStringField(abilityA, ABILITY_SF_ICON_RESEARCH)) print(BlzSetAbilityStringField(abilityA, ABILITY_SF_ICON_RESEARCH, [[ReplaceableTextures\CommandButtons\BTNAttack.blp]])) print(BlzGetAbilityStringField(abilityA, ABILITY_SF_ICON_RESEARCH)) print(BlzGetAbilityStringField(abilityB, ABILITY_SF_ICON_RESEARCH))
- patch
-
1.31.0.11889
- Source
- common.j (suggest an edit or discuss on Github)
- return type
-
boolean
- Source code
-
native BlzSetAbilityStringLevelField takes ability whichAbility, abilitystringlevelfield whichField, integer level, string value returns boolean