• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[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 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 7
Joined
Oct 20, 2010
Messages
184
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