Levels 2
Events
Unit - Any Unit gains an experience level
Local Variables
Conditions
((Triggering player) is in Players) == True
((Unit type of (Triggering unit)) has Heroic attribute) == True
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
(Experience level of (Triggering unit)) < 63
((Experience level of (Triggering unit)) mod 3) == 0
Then
UI - Display "+1 Ability Point" for (Player group((Triggering player))) to Subtitle area
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
((Experience level of (Triggering unit)) mod 5) == 0
Then
UI - Display "+1 Mutation Point" for (Player group((Triggering player))) to Subtitle area
Else
Ok. So if hero X goes out and kills a monster and said monster gives enough EXP for the hero to skip a level, the skipped level will BYPASS this trigger causing the modulus to do nothing and essentially screwing over the hero as no ability points or mutation are awarded for said skipped level.
Create a global integer variable to track the unit's current level. When this event fires, subtract the value of your global variable from the unit's current level. Use a repeat loop, repeating for (level_tracking_variable - unit's current level). At the end of the trigger, set the tracking variable to the unit's current level.
It should, since if it fires again and the unit's level is the same as the variable then nothing should happen. You just need to make sure everything is included in your Repeat X loop. Basically you're just having the game check how many levels the unit gets when the level-up event occurs, so the number of times that event occurs is irrelevant if the unit doesn't actually gain any levels.
How should the global variable be regulated? It can't be hero gains a level. I don't like the idea of a periodic event either. Maybe it could be tracked threw the exp system trigger? When a hero gains exp from killing a unit, set the level variable there?
It doesn't really matter. You could have it checked periodically on an infinite loop, if you wanted. You only need to do the level-up functions when the variable != the unit's level.
Levels
Events
Unit - Any Unit gains an experience level
Local Variables
Player = (Owner of (Triggering unit)) <Integer>
Conditions
((Triggering player) is in Players) == True
Actions
General - Repeat (Actions) ((Experience level of (Triggering unit)) - Hero Current Level[Player]) times
Actions
Variable - Set Hero Current Level[Player] = (Hero Current Level[Player] + 1)
General - If (Conditions) then do (Actions) else do (Actions)
If
(Hero Current Level[Player] mod 3) == 0
Then
UI - Display "+1 Ability Point" for (Player group((Triggering player))) to Subtitle area
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
(Hero Current Level[Player] mod 5) == 0
Then
UI - Display "+1 Mutation Point" for (Player group((Triggering player))) to Subtitle area
Else
Just a tip for future reference, though. You can save a few precious seconds by using the Modify Variable function to increment a variable. For example, you could have used Modify (Hero Current Level[Player] + 1) instead of Variable - Set Hero Current Level[Player] = (Hero Current Level[Player] + 1).
Alternatively, you could have set Hero Current Level[Player] = Experience level of (Triggering unit) at the end of the trigger, outside of the Repeat loop. To make this work, you would have to reference Experience level of (Triggering unit) instead of Hero Current Level[Player] inside your Repeat loop. Either way is fine :)
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Ok. So if hero X goes out and kills a monster and said monster gives enough EXP for the hero to skip a level, the skipped level will BYPASS this trigger causing the modulus to do nothing and essentially screwing over the hero as no ability points or mutation are awarded for said skipped level.
How can this be fixed :?
@Zero0018: Go
Create a global integer variable to track the unit's current level. When this event fires, subtract the value of your global variable from the unit's current level. Use a repeat loop, repeating for (level_tracking_variable - unit's current level). At the end of the trigger, set the tracking variable to the unit's current level.
@BasharTeg: Go
That should do the trick. Thank you.
I also forgot to mention, some times the trigger will fire multiple times off of one level up. I've had the mondo 5 fire twice in a single level up.
Will this fix that as well?
@Zero0018: Go
It should, since if it fires again and the unit's level is the same as the variable then nothing should happen. You just need to make sure everything is included in your Repeat X loop. Basically you're just having the game check how many levels the unit gets when the level-up event occurs, so the number of times that event occurs is irrelevant if the unit doesn't actually gain any levels.
@BasharTeg: Go
How should the global variable be regulated? It can't be hero gains a level. I don't like the idea of a periodic event either. Maybe it could be tracked threw the exp system trigger? When a hero gains exp from killing a unit, set the level variable there?
It doesn't really matter. You could have it checked periodically on an infinite loop, if you wanted. You only need to do the level-up functions when the variable != the unit's level.
This is how I got it working.
@Zero0018: Go
Swell :)
Just a tip for future reference, though. You can save a few precious seconds by using the Modify Variable function to increment a variable. For example, you could have used Modify (Hero Current Level[Player] + 1) instead of Variable - Set Hero Current Level[Player] = (Hero Current Level[Player] + 1).
Alternatively, you could have set Hero Current Level[Player] = Experience level of (Triggering unit) at the end of the trigger, outside of the Repeat loop. To make this work, you would have to reference Experience level of (Triggering unit) instead of Hero Current Level[Player] inside your Repeat loop. Either way is fine :)