• 🏆 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!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

ABILITY_SLF_SPELL_LIST not work?

Level 2
Joined
Jul 21, 2024
Messages
2
I wanted to dynamically modify spell list of spellbook with BlzSetAbilityStringLevelField, but it just do nothing with ABILITY_SLF_SPELL_LIST field.
code is like this, A003 is spellbook.
Lua:
local a = BlzGetUnitAbility(u, FourCC('A003'))
print(BlzGetAbilityStringLevelField(a, ABILITY_SLF_SPELL_LIST, 0))

IncUnitAbilityLevel(u, FourCC('A003'))
BlzSetAbilityStringLevelField(a, ABILITY_SLF_SPELL_LIST, 0, '')
DecUnitAbilityLevel(u, FourCC('A003'))

print(BlzGetAbilityStringLevelField(a, ABILITY_SLF_SPELL_LIST, 0))
 
Yeah, looks like that native doesn't work for that field. Bummer. I tried testing it with a few variants as well (BlzSetAbilityStringLevelArrayField) but that didn't work either.

You'll probably have to update the spells in the spellbook the old-school way:

The TL;DR is that you need to make a new spellbook for each spell you want to dynamically add, and then make sure the "Data - Base Order Id" is the same as the spellbook you want to add it to. Next, disable those spellbooks for all players via code (e.g. map init). Finally, when you want to add a specific ability to your main spellbook--add the disabled spellbook containing that ability instead. Similarly, if you want to remove that ability, just remove the disabled spellbook ability from the unit.
 
Top