• 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.

[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