Is it possible to use triggers or something to change a spell's icon based on level?

PaladinHeart

New Member
Reaction score
3
Is it possible to use triggers or something to change a spell's icon based on level?

I'm using a spellbook with abilities in it, and I'd like to have the abilities appear differently, depending on each ability's level.
 

PaladinHeart

New Member
Reaction score
3
I did find this:

Code:
function Learn_Actions takes nothing returns nothing
  if GetLearnedSkillLevel() == 1 and GetLearnedSkill() == <hero skill> then
    call UnitRemoveAbility(GetTriggerUnit(), GetLearnedSkill())
    call UnitAddAbility(GetLearningUnit(), <adder spellbook ability>)
    call MakeUnitAbilityPermanent(u, <adder spellbook ability>)
    call MakeUnitAbilityPermanent(u, <ability inside spellbook>)
  endif
endfunction

function Learn takes nothing returns nothing
  local trigger t = CreateTrigger()
  call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_HERO_SKILL)
  call TriggerAddAction(t, function Learn_Actions)
endfunction

But I feel that I would have to understand the code first. Where would I put my skill's name at, the spellbook's name, etc..? I have no knowledge of Jass, so this completely confuses me...
 

tommerbob

Minecraft. :D
Reaction score
110
You can't just change the icon for an ability. You need to replace the ability with a new one. That's what that Jass code does.

So you need to make copies of the ability, for each level. And then via triggers, detect when the unit increases the level of the ability, and then remove/add the appropriate ability. Depending on how many units and abilities you want to do this for, it is a lot of Object Editor data, so I recommend against this. But its up to you.
 

PaladinHeart

New Member
Reaction score
3
Yes I'm beginning to realize this is a lot of extra work. I may reduce the total number of spells. 11 would take a loooong time. xP
I may just do 4 for now.

But anyway, thanks for the information. I did finally figure out all the information I needed. The main thing is using spellbooks with the same ID, and disabling the hidden spellbooks for the player and removing the old spell.
 

Grymlax

Probably not around
Reaction score
138
it might be easier to use the ability engineering upgrade. you can hide it with a disabled spellbook.

This way has te advantage of not screwing with cooldowns. (don't know how your current trigger works)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top