1. Find your way through the deepest dungeon in the 18th Mini Mapping Contest Poll.
    Dismiss Notice
  2. A brave new world lies beyond the seven seas. Join the 34th Modeling Contest today!
    Dismiss Notice
  3. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
Hive 3 Remoosed BETA - NOW LIVE. Go check it out at BETA Hive Workshop! Post your feedback in this new forum BETA Feedback.
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Catch an ability level up

Discussion in 'World Editor Help Zone' started by DaneTheBeast, Oct 14, 2018.

  1. DaneTheBeast

    DaneTheBeast

    Joined:
    Dec 11, 2014
    Messages:
    608
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Is there a way to know when a hero has leveled up an ability? (NOT when he first learns it)
    If not, what are the best workarounds?
     
  2. Sieben

    Sieben

    Joined:
    Nov 23, 2013
    Messages:
    661
    Resources:
    0
    Resources:
    0
    Perhaps you could use a periodic events that checks the current ability level, using a integer condition?

    • Conditions
      • (Level of <Some Ability> for (<Some Hero>)) Equal to X
     
  3. DaneTheBeast

    DaneTheBeast

    Joined:
    Dec 11, 2014
    Messages:
    608
    Resources:
    1
    Maps:
    1
    Resources:
    1
    It looks like the best option is to use
    • Unit - A unit Learns a skill
    and then just check which level it is or just use it directly since it must be bigger than 0.
     
    Last edited: Oct 14, 2018
  4. Pyrogasm

    Pyrogasm

    Joined:
    Feb 27, 2007
    Messages:
    3,788
    Resources:
    1
    Spells:
    1
    Resources:
    1
    With the event Dane posted, there is the event response Learned Hero Skill. And when the event fires the skill has already been leveled up, so if it was being learned the first time its level will be 1, and it's being leveled up the first time (second click) it will be level 2+.
     
  5. IcemanBo

    IcemanBo

    Joined:
    Sep 6, 2013
    Messages:
    6,549
    Resources:
    23
    Maps:
    3
    Spells:
    11
    Template:
    1
    Tutorials:
    5
    JASS:
    3
    Resources:
    23
    From common.j:
    Code (vJASS):
    // EVENT_PLAYER_HERO_SKILL
    // EVENT_UNIT_HERO_SKILL
    constant native GetLearningUnit     takes nothing returns unit
    constant native GetLearnedSkill     takes nothing returns integer // ability id
    constant native GetLearnedSkillLevel takes nothing returns integer // new ability level
     
  6. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    26,189
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    An alternative approach is to make your system recreate the state when levelling up rather than tracking deltas. This means that when you level from level 1 to level 2 you destroy the level 1 state and then create a level 2 state instead. This is useful as you can apply the logic directly if the ability level gets set, eg by trigger, instead of having to iterate through all levels up to the appropriate one.