• 🏆 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] Help with Hero level detection trigger

Status
Not open for further replies.
Level 3
Joined
May 5, 2009
Messages
25
I need a trigger which give lumber to a player each time his hero gains a level.

I already have a trigger, a simple one:

Events
Unit - A unit Gains a level
Conditions
Actions
Player - Add 2 to (Owner of (Triggering unit)) Current lumber

But there's a problem, in my map, if a hero kill a boss, it will get more than 1 level at once, and the trigger will not give the propper amount of lumber, for exemple, if the hero gains 3 levels at once, the trigger will detect just one level, and will give only 1 lumber.

Hope somebody can help me, thanks.
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
Make an integer variable called LastLevel (default value 1), and a temp integer, let's call it LevelChange.

Code:
Events
 Unit - Unit gains a level
Actions
 Set LevelChange = hero level of triggering unit - LastLevel
 Player - add (2 * LevelChange) lumber to owner of triggering unit lumber
 Set LastLevel = hero level of triggering unit

That should fix it, but if I may, I think gaining more than one level at a time is bad design and should be avoided.
 
Status
Not open for further replies.
Top