In that case, don't forget to use the correct constant.
The constant for learning a hero skill should be used. If you have JNGP you can view the function list, which also has a list of constants.
JASS:
constant unitevent EVENT_UNIT_HERO_SKILL=ConvertUnitEvent(79)
constant playerunitevent EVENT_PLAYER_HERO_SKILL=ConvertPlayerUnitEvent(42)
constant unitevent EVENT_UNIT_SPELL_EFFECT=ConvertUnitEvent(291)
constant playerunitevent EVENT_PLAYER_UNIT_SPELL_EFFECT=ConvertPlayerUnitEvent(274)
The constant for learning a hero skill should be used. If you have JNGP you can view the function list, which also has a list of constants.