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

[vJASS] Spellbook with multiple pages using an item

Status
Not open for further replies.
Level 25
Joined
Feb 2, 2006
Messages
1,669
Hello,
you might know the trick to hide and show icons in a spellbook by using this code:
JASS:
public method show take unit whichUnit returns nothing
call UnitAddAbility(whichUnit, this.spellbookAbilityId())
call SetPlayerAbilityAvailable(GetOwningPlayer(whichUnit), this.spellbookAbilityId(), false)
call SetUnitAbilityLevel(whichUnit, this.abilityId(), 1)
endmethod

public method hide takes unit whichUnit returns nothing
call UnitRemoveAbility(whichUnit, this.spellbookAbilityId())
endmethod
The spellbook ability must have the same ID as the shown spell book ability and only contain the ability which you want to add. This works fine when the visible spell book is an ability of the unit.

But I need this to work for an item which is carried by the unit. I tried the code above but it does not work. Nothing is shown in the spellbook. Is it even possible?
 
Status
Not open for further replies.
Top