• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Detect how many levels a unit gained

Status
Not open for further replies.
Level 6
Joined
Jul 14, 2020
Messages
128
Greetings Hive

I want to save in a variable the number of levels a unit gains. For example, I use the event unit gains a level, after that, a variable increases by 1.

But it does not detect when a unit goes up a single level, instead of that , he also does it when he gain many levels.

That is, if a unit goes from level 1 to 4, what will be stored in my levels variable will be 1. I would like to know if there is any way to detect how many levels a unit has gained, thanks. :grin:
 
Level 20
Joined
Feb 27, 2019
Messages
592
Hello Rasamayu. I dont understand what you want in the trigger. Can you post and share your current trigger so that I can better understand what you want in the trigger?

Can you tell me simple what you want the trigger to do again? I dont understand.
 
Level 6
Joined
Jul 14, 2020
Messages
128
Hello Rasamayu. I dont understand what you want in the trigger. Can you post and share your current trigger so that I can better understand what you want in the trigger?

Can you tell me simple what you want the trigger to do again? I dont understand.
Hello,
I would like to know if there is any way to detect how many levels a unit has gained, thanks.
 
Level 20
Joined
Feb 27, 2019
Messages
592
Hello,
I would like to know if there is any way to detect how many levels a unit has gained, thanks.
The event "Unit - A unit gains a level" should work for that if there is no trigger that sets hero level or anything that resets levels.

Unit - A unit gains a level
Set Level = Level + 1
 
Level 7
Joined
Oct 20, 2010
Messages
182
This is not MUI, but I think I get what you're saying.
1. You will need to store the level of the unit so you can later reference it. This way you'll have access to the new and old level of the unit upon level up.
2. You will need to calculate the difference between the new level of the unit (after leveling up) and the old level of the unit (before leveling up). This will tell you how many levels were granted.

I highly recommend using Unit Indexer and saving the level of the hero as an array if you intend to use this for more than 1 unit.
  • Init
    • Events
      • Unit - A unit Gains a level
    • Conditions
    • Actions
      • Set VariableSet v_difLevel = ((Hero level of (Triggering unit)) - v_level)
      • Set VariableSet v_level = (Hero level of (Triggering unit))
      • For each (Integer A) from 1 to v_difLevel, do (Actions)
        • Loop - Actions
          • -------- do something for each level gained --------
 
Status
Not open for further replies.
Top