A lot of you guys want a learn ability to give a point only every other level or only at specific levels, like 1 - 4 - 7- 10, like I wanted. Yes you can make abilities require those levels with requirements but you will have unspent points that look ugly in the interface and the player will say "is there nothing I can do with those?"
Fear not, here is the solution to that problem.
Make a learn ability, set the points per level to 0, set the points (at start) to whatever you want - for this example we want our unit to start with 1 point, so set points to 1.
Make a trigger.
Event -> Unit - Any unit gains an experience level
Variables -> None
Conditions -> Comparison, Unit Type of Unit, (Unit Type of (Triggering Unit)) == <insert your hero unit type>
Actions -> General If Then Else If Action, make as many "if then" actions in this as you have levels that grant points, the condition is always "Experience Level of Triggering Unit == X" where X is the level you want the unit to gain a point. The action is "Catalog Field Value Set". Set Value of "Abilities" "<name of your learn ability>" "Points" for player ("triggering player") to Y where Y is the the current points on your learn ability (in this example 1) plus the number you want your unit to gain.
So you basically set the starting points of the learn ability to a higher amount whenever your unit reaches one of the levels where you have a if then else if condition. If you have like 100 levels and want the unit to gain a point every 5 levels, use some math to make the trigger simpler, but my method is more versatile, for example when you want a unit to gain 1 point at level 1, 2 at level 5, 10 points at level 20 and one more at 23 - or something crazy like that.
I hope this helped someone. I couldn't find a good solution with the search so I wrote this.
I have to add something. What I described will work in most cases, but if you have huge spikes of experience and you skip the level that would grant a point, you need to add something.
Change the condition from "Experience Level of Triggering Unit == X" to "Experience Level of Triggering Unit >= X" - and add another condition "Experience Level of Triggering Unit < Y" - where X is the first level that shall grant a point and Y the second. You need to do this for all but the last level that grant points.
This way, even if you skip levels, you will get the points. Even if you jump from Level 1 to e.g. 16 and there are several points inbetween.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
A lot of you guys want a learn ability to give a point only every other level or only at specific levels, like 1 - 4 - 7- 10, like I wanted. Yes you can make abilities require those levels with requirements but you will have unspent points that look ugly in the interface and the player will say "is there nothing I can do with those?"
Fear not, here is the solution to that problem.
Make a learn ability, set the points per level to 0, set the points (at start) to whatever you want - for this example we want our unit to start with 1 point, so set points to 1.
Make a trigger.
Event -> Unit - Any unit gains an experience level
Variables -> None
Conditions -> Comparison, Unit Type of Unit, (Unit Type of (Triggering Unit)) == <insert your hero unit type>
Actions -> General If Then Else If Action, make as many "if then" actions in this as you have levels that grant points, the condition is always "Experience Level of Triggering Unit == X" where X is the level you want the unit to gain a point. The action is "Catalog Field Value Set". Set Value of "Abilities" "<name of your learn ability>" "Points" for player ("triggering player") to Y where Y is the the current points on your learn ability (in this example 1) plus the number you want your unit to gain.
So you basically set the starting points of the learn ability to a higher amount whenever your unit reaches one of the levels where you have a if then else if condition. If you have like 100 levels and want the unit to gain a point every 5 levels, use some math to make the trigger simpler, but my method is more versatile, for example when you want a unit to gain 1 point at level 1, 2 at level 5, 10 points at level 20 and one more at 23 - or something crazy like that.
I hope this helped someone. I couldn't find a good solution with the search so I wrote this.
I have to add something. What I described will work in most cases, but if you have huge spikes of experience and you skip the level that would grant a point, you need to add something.
Change the condition from "Experience Level of Triggering Unit == X" to "Experience Level of Triggering Unit >= X" - and add another condition "Experience Level of Triggering Unit < Y" - where X is the first level that shall grant a point and Y the second. You need to do this for all but the last level that grant points.
This way, even if you skip levels, you will get the points. Even if you jump from Level 1 to e.g. 16 and there are several points inbetween.