Saturday, April 21, 2012

Need only 1 skill point per 2 levels for the hero

Hello,

I'm making a map where the heroes (under normal conditions) gain to much attributes to fill all the levels, so what I want is that you only get 1 attribute per 2 levels.

Now I had a trigger that when

(EVENT:) a unit gains a level

then the

(ACTION:) Substract 1 skill point



Now I do not know what Condition is needed,

or if I'm thinking this all the wrong way.

I was searching in the Gameplay Constants, but that did not help me. (was hoping there was a Hero skill point per level thingy)



The maximum hero level is quite high (100)

Thanks in advance.|||If I understand you would want to write a code through triggers, that will substract one skill point every 2 levels, so you basically have 1 skill point every 2 levels.

Is so you can use a sorta alike example I wrote below here.


Code:
your trigger name
Events
Unit - A unit Gains a level
Conditions
Actions
Set Integervariable = ((your hero <gen>) mod 2)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Integervariable Equal to 0
Then - Actions
Hero - Modify unspent skill points of Paladin 0021 <gen>: Subtract 1 points
Else - Actions

Explanation:

The IntergerVariable obviously is a integer variable to store a number in.

It checks the current level of your selected hero, then it mod's it with 2, mod stands for Modulo.

If you want to know more about Modulo, I'd suggest opening up a wikipedia page.

then a condition is set to check if the variable you just declared is equal to 0 or not, if it is, it will subtract 1 skill point, else it will do nothing and thus add a skill point.

A list of the modulo.

level2: (2 mod 2 = 0) 1 point is subtracted

level3: (3 mod 2 = 1) nothing happens

leve4: (2 mod 2 = 0) 1 point is subtracted

level5: (3 mod 2 = 1) nothing happens

etc

This can be used on any level, it will always output 0 or 1.

So there you go.|||Great thanks man, that's really useful!

No comments:

Post a Comment