ID:144136
 
Code:
mob/proc/LevelCheck()
if(src.exp > src.maxexp)
src.exp = 0
src.maxexp += rand(5,20)
src.level++
var/healthadd = rand(1,5)
var/magicadd = rand(1,2)
var/strengthadd = rand(1,2)
src.health += src.level+healthadd
src.magic += src.level+magicadd
src.strength += src.level+strengthadd


How would I make it to where a person would gain 1 stat point every 10 levels?

Something like...

mob/proc/LevelCheck()
if(src.exp > src.maxexp)
src.exp = 0
src.maxexp += rand(5,20)
src.level++
var/healthadd = rand(1,5)
var/magicadd = rand(1,2)
var/strengthadd = rand(1,2)
src.health += src.level+healthadd
src.magic += src.level+magicadd
src.strength += src.level+strengthadd
if(src.level % 10 == 0)
/add stat point here
In response to KirbyAllStar
Ah! Gracias mi amigo
This is an explanation about Kirby's post:

%, which is modulo in BYOND, returns the remainder value of the numbers tested.

What does that mean? Well, here's a few samples:

5%2 = 1 <-- Reason how it becomes one is it acts like this: 5-2 = 3-2 = 1 (can't do -2 because it'll be less than 0, thus the remainder of 5 when we take away all "2 values" is 1... sorry but this is the best way I can define it

52%10 = 2 <-- 52-10=42-10=32-10=22-10=12-10=2

23%3 = 2<-- 23-3=20-3=17-3=14-3=11-3=8-3=5-3=2

20%10 = 0 <-- 20-10 = 10-10 = 0

326827362836%1 = 0 <-- since we are taking away 1, it'll lead to 0 eventually


So you can see if a person reached a 10th level (not just level 10) by doing usr.level%10 and if that value is 0

You can also use this type of method to check if a number is odd by doing: n%2... an even number would return 0 (as it would equally add up to n) while an odd number will always return 1:
4%2 = 4-2 = 2-2 = 0
5%2 = 5-2 = 3-2 = 1


- GhostAnime
In response to GhostAnime
Or you could just tell him to thing back to fourth grade long division.
In response to Popisfizzy
I totally forgot about that :O
_03______
4V 15
---
- 12

= 3 remainder