ID:154980
 
      Level_Up()
if(src.level == 200)
src.level = 200
src.exp = maxexp
return
if(src.exp >= src.maxexp)
src.level ++
var/max_exp = src.level * 312
var/rollover_exp = src.exp - src.maxexp
var/plgain = src.level * 3928
var/kigain = rand(1,100)
src.exp = 0
src.maxexp = max_exp
src.exp += rollover_exp
src.maxpowerlevel += plgain
src.maxki += kigain
src.battlepoints += 2
src.techpoints ++
src<<"<font color=yellow>You have reached Level [src.level]"
src<<"<font color=yellow>You gain [cn(plgain)] Powerlevel and [kigain] Ki"
src<<"<font color=yellow>You gain 1 Tech Point 2 Battle Points"
src.Learn_Techs()
spawn(5) src.Level_Up()


How can i make that you gain techpoints every 5th lvl and not every single. Ty
<code> if ((level % 5) == 0) // behaviour for when level is divisible by 5 here </code>
In response to Toadfish
Toadfish wrote:
<code> > if ((level % 5) == 0) > // behaviour for when level is divisible by 5 here > </code>

what does == 0 mean ?
In response to LaNuiit
In response to Toadfish
Dude, you totally helped me out here. I've been using this weird if(x/y == round(x/y)) biz!
In response to LaNuiit
LaNuiit wrote:
Toadfish wrote:
<code> > > if ((level % 5) == 0) > > // behaviour for when level is divisible by 5 here > > </code>

what does == 0 mean ?

To break it down a bit.

% is the modulus operator, it works like / (divide), except it returns the remainder of the equation. So if the remainder is the same as 0, then go inside the if statement.

Example:
-Level 5, 5 can be divided by 5 with no remainder.
-Level 7, there will be a remainder of 2 if you tried to put 5 in 7, thus skipping the if() contents.
-Level 10, 10 can be divided by 5 with no remainder. (So every 5 level, you'd execute that if() statement.)

Hope this helps.