Hello everyone!
I have the following task: to grant the "Haste" spell through a script when the "Speed Magic" skill is leveled up during an attack. And to remove it if the skill was unlearned from a mentor. This is necessary because I changed the tier of the "Haste" spell from 1 to 3, and when "Speed Magic" is leveled up, the spell becomes unavailable in battle.
I found a couple of functions in the script files that are responsible for this:
HasHeroSkill(heroName, skillID); - checks for the presence of a skill
TeachHeroSpell(heroName, spell); - grants a spell
How to remove a spell - ?
The only thing that worries me is the script name of the hero. If I want this function to work for all heroes, how should I proceed?
And a separate question, does the trigger work from the very beginning, or can it be set to work from a certain point?