• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[System] LearnEvent

Status
Not open for further replies.
Level 21
Joined
Mar 19, 2009
Messages
444
Gentlemen,

For Restricted Complex 601, I have several heroes with triggers working as soon as the heroes learn a skill.
In order to reduce the amount of triggers, I would like to get an efficient system which works like the library SpellEvent of Anitarf .

The way to attach skills would be a simple interface function, such as RegisterSpellFinishResponse('A000',MyFunctionName) works with SpellEvent at map init, and then a struct allows to get the unit data during the game.
So, what I would like is a system allowing me to link Integer codes (ability ID) to functions.

The function name could be:
RegisterLearnEvent('A000',Actions).

The only data returned by the struct are
-the unit which learned the skill
-the level of the skill learned.
-the skill learned

This way, in the trigger, I would get, during the name, something like
JASS:
scope Example initializer init

globals
    private constant integer SPELL = 'A000'
endglobals

      private function Actions takes nothing returns nothing
              local unit hero = LearnEvent.LearningUnit
              local integer level = LearnEvent.AbilityLevel
              local integer skill = LearnEvent.AbilityId
              local player owner = GetOwningPlayer(hero)
                    //blablabla
                    set hero = null
      endfunction

      public function init takes nothing returns nothing
             call RegisterLearnEvent(SPELL,Actions).
      endfunction

endscope


What would be the use of this system?
1-less code lines
2-less triggers
3-link a HERO_SKILL event to an ability id and NOT to a unit, a player or something like this.

Award

+rep
+credits on the dedicated thread of my map, on the website of my map

Thanks a lot.
 
Status
Not open for further replies.
Top