HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Trigger Newb in need of aid

03-15-2006, 12:40 AM#1
Ares_WarBlade
I'm currently working on a "somewhat" open RPG and I'm still working my way around the trigger editor and just cannot figure out how to accomplish my task so I thought I'd come here for help.

I'm trying to make it so that a hero only gains an ability point to assign if their level is divisible by 3 (IE: Levels: 3,6,9,12,15, etc) and only divisible by 3. (Removing the initial skillpoint via triggers, I don't think I'll have a problem with that part.) I'm a pretty logical guy so if you can explain how it works that'd be great too.
Thusfar I have:

Trigger:
Collapse Events
Unit - A unit Gains a level.
Collapse Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Collapse Then - Actions
Do Nothing
Collapse Else - Actions
Hero - Modify unspent skill points of (Leveling Hero):Subtract 1 points

As you can see, the only part I'm having trouble with is mathematically explaining that I want the level to be divisible by 3.
03-15-2006, 01:12 AM#2
TaintedReality
Trigger:
Collapse Events
Unit - A unit Gains a level
Conditions
Collapse Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
((Level of (Leveling Hero)) mod 3) Not equal to 0
Collapse Then - Actions
Hero - Modify unspent skill points of (Leveling Hero): Subtract 1 points
Else - Actions

The mod function calculates the remainder of a division problem, so if the number is divisible by 3, then the mod will be 0. It's an Integer action under Math - Modulus.
03-15-2006, 01:17 AM#3
Ares_WarBlade
Quote:
Originally Posted by TaintedReality
Trigger:
Collapse Events
Unit - A unit Gains a level
Conditions
Collapse Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
((Level of (Leveling Hero)) mod 3) Not equal to 0
Collapse Then - Actions
Hero - Modify unspent skill points of (Leveling Hero): Subtract 1 points
Else - Actions

The mod function calculates the remainder of a division problem, so if the number is divisible by 3, then the mod will be 0. It's an Integer action under Math - Modulus.

Oh thanks a ton! I had a feeling the mod feature would help, but I was trying to use it on the right side of the equation and things were just not computing in my head!
03-15-2006, 06:08 AM#4
Anitarf
Note that this could bug out if your hero can level up multiple levels at a time (like, if you defeat a high level creep with a low level hero), since it could "jump" over the point where you would get the skill point.