Hero Level Multiple

Status
Not open for further replies.
Level 1
Joined
Jul 1, 2020
Messages
2
Hi all i new and i working in a map but i have a problem that I can't find a solution anywhere else
i can't find a solution anywhere else
i tried to do somethig with the level of heroes but i dont find the way
my idea is about a gain level and get something
but my idea is that the hero obtain the item when the level gained is multiple of 2 and that it always happens, for example at level 2, level 4, level 6, etc.

thanks for your help.
 
Level 25
Joined
Mar 29, 2020
Messages
1,466
hey,

there are probably better ways to go about it, but this works:

  • even levels
    • Events
      • Unit - A unit Gains a level
    • Conditions
    • Actions
      • Set Integer = 0
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • Set Integer = (Integer + 1)
          • Set EvenLevels = (Integer x 2)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Hero level of (Triggering unit)) Equal to EvenLevels
            • Then - Actions
              • Hero - Create Cheese and give it to (Triggering unit)
            • Else - Actions
right now this will work till level 20. If you need more than that, just switch the number 10, with half of your max level.

(both of the variables here are of type "integer")
 
Level 13
Joined
May 10, 2009
Messages
868
Use "math - modulo" function.
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • ((Hero level of (Triggering unit)) mod 2) Equal to 0
    • Then - Actions
      • -------- even - add item --------
    • Else - Actions
      • -------- odd --------
 
Status
Not open for further replies.
Top