• 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] Need Help With a Math Trigger

Status
Not open for further replies.
Level 4
Joined
May 18, 2004
Messages
60
Ok, so I'm trying to make a trigger that says:

If player gains a level
then if level is multiple of 5
then give 1 skill point if not take 1 skill point away

Trying to make it so, you only get a skill point every 5 levels.

Well I originally made a trigger that says:




The trigger works fine if the Hero only gains a single level, but if the Hero gain's enough EXP to gain multiple levels this trigger doesn't work.

So, someone suggested to do this:

Ok, so his trigger looks like:




But, this doesn't work and he's offline @ the moment... This trigger always removes a skill point and never lets u have one.

I've tried changing various things on this trigger and it's not working...

Does anyone on here know what I'm doing wrong?
 
Level 4
Joined
May 18, 2004
Messages
60
Ok thanks so I changed it to:

  • Removing Ability Points
    • Events
      • Unit - A unit Gains a level
    • Conditions
    • Actions
      • For each (Integer A) from Players_Level[((Player number of (Owner of (Leveling Hero))) + 1)] to (Hero level of (Leveling Hero)), do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Integer A) Not equal to 0
            • Then - Actions
              • Hero - Modify unspent skill points of (Leveling Hero): Subtract 1 points
            • Else - Actions
              • Do nothing
          • Set Players_Level[(Player number of (Owner of (Leveling Hero)))] = (Hero level of (Triggering unit))
It still doesn't work...
 
Level 4
Joined
May 18, 2004
Messages
60
Wow, lol ok keep messing up little things. The reason I'm only subtracting points is the game by default adds 1 point per lv.

Ok it looks like this now:

  • Removing Ability Points
    • Events
      • Unit - A unit Gains a level
    • Conditions
    • Actions
      • For each (Integer A) from Players_Level[((Player number of (Owner of (Leveling Hero))) + 1)] to (Hero level of (Leveling Hero)), do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Integer A) mod 5) Not equal to 0
            • Then - Actions
              • Hero - Modify unspent skill points of (Leveling Hero): Subtract 1 points
            • Else - Actions
              • Do nothing
          • Set Players_Level[(Player number of (Owner of (Leveling Hero)))] = (Hero level of (Triggering unit))
It should work now, hopefully... About to test :)
 
Level 4
Joined
May 18, 2004
Messages
60
Ya, I took the +1 out of the array and fixed so it divides by multiples of 5...

Does it still look wrong?

-Edit- Rofl, I think i see what u mean... Hold up

OK! So here:

  • Removing Ability Points
    • Events
      • Unit - A unit Gains a level
    • Conditions
    • Actions
      • For each (Integer A) from (Players_Level[(Player number of (Owner of (Leveling Hero)))] + 1) to (Hero level of (Leveling Hero)), do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Integer A) mod 5) Not equal to 0
            • Then - Actions
              • Hero - Modify unspent skill points of (Leveling Hero): Subtract 1 points
            • Else - Actions
              • Do nothing
          • Set Players_Level[(Player number of (Owner of (Leveling Hero)))] = (Hero level of (Triggering unit))
AND IT WORKS!! Thanks for your time and help ;)
 
Last edited:
Status
Not open for further replies.
Top