ID:155145
 
Ok, so a var that reaches or is over a var that is the maximum for it shall raise up another bar(yes, a levelup proc), but what if the var is over the maximum var? I have been trying to make remainders for my levelup procs, but it only works once. Here's what Ive got:
    proc/LevelUp()
if(src.XP == src.MaxXP)
src.lvl += 1
src.MaxXP += src.MaxXP
src.XP = 0
src.INT += 4
src.DA += 2
src.str += 3
src.MaxHP += 5
src.HP = MaxHP
src << "<b>YOU HAVE LEVELED UP, YOU ARE NOW LEVEL [src.lvl]"
if(src.lvl == 3)
src << "<b>You learned Orchideous!"
src.verbs += new/mob/mage/verb/Orchideous
if(src.lvl == 550)
src << "<b>You learned Avada Kedavra!"
src.verbs += new/mob/mage/verb/Avada_Kedavra
if(src.XP>src.MaxXP)
src.XPremainder = src.XP - src.MaxXP
src.XP += src.XPremainder
LevelUp()


it half works, it raises the MaxXP, but it doesn't raise your stats and level
Dear god, no. Just no. Stats should be handled via datum.

stat // Stat datum
var
value // Current value
mvalue // Max value
uvalue // Upgrade value

New(X,Y) // X and Y are numbers
value = X ; mvalue = X
uvalue = Y

proc
Upgrade()
var/X = mvalue + uvalue
src.New(X,src.uvalue)


That should cover what you're asking for. By expanding this code you should be able to do everything you want to do with stats.
In response to Lugia319
wait, if I do stat/var, then it will no longer be a mob variable, so I will get errors
In response to BeignetLover
In response to Lugia319
stat
var/value = 0
var/max_value = 0

mob/var
stat/XP
stat/HP
stat/MaxHP
stat/MaxXP
stat/INT
stat/DA
stat/str
stat/lvl
stat/year


for some reason, it hates the lvl and XP vars ;(

EDIT:Yeah, gonna get some comments about the indentation on those, but they aren't like that in the code, just in browser
In response to BeignetLover
I recommend reading the link that I posted.
In response to Lugia319
I did
In response to BeignetLover
BeignetLover wrote:
for some reason, it hates the lvl and XP vars ;(

EDIT:Yeah, gonna get some comments about the indentation on those, but they aren't like that in the code, just in browser

It's almost like.. they may be related!

The reason it's doing that (both displaying incorrectly, and giving you an indentation error) is because you've mixed tabs and spaces. Choose one or the other.
In response to Lugia319
It's bad design to manually call New() like that. You should create another process (Set() would be a typical name, but that's close to a reserved token, so Assign() might be a better choice) that handles setting the variables. Then you call that one process in New() and Upgrade(). That way, the code is more readable, because it's immediately obvious what the call is doing, unlike New(). Although, it's a bit overkill to write a process just for assigning three variables.

Also, you never defined 'x' (lowercase) in your New() process.
In response to DarkCampainger
Hmmm. Well that's the way I've been doing it. Thanks for the notes though!

Also, sorry about the (x):( I wrote this right after my Physics class.