ID:169934
 
I was wondering how do I make a person after they reach a certain level they gain more stats. For example lets say they reach level 50, how do I make it so when they reach level 50 they get more hp, defense etc.
obj
your_training_utility //whatever the training utility is that makes you level up
verb
Use() //whatever the name of the verb is
var/exp //if you have a experience variable
var/maxexp //if you have a maxexp variable
if(usr.exp==usr.maxexp)
usr.Levelup() //just to make it easier, make it a proc

proc
Levelup()
usr << "whatever bla bla you leveled up bla bla get to level 50 to increase your stats and whatever"
var/level += 1
if(usr.level == 50)
usr.Lvl50Up() // make it a proc
if(usr.level == 100)
usr.Lvl100Up // make it a proc
Lvl50Up()
usr << "YOU GOT TO LEVEL 50!!"
usr.maxhp += num //change the number to whatever you want to increase the stats by
usr.str += num
usr.def += num
var/usr.gotlvl50 = 1 //if you want it that they cant level up at 50 more than once, etc.
usr.astat += num //another stat and stuff

Make more procs for every level and stuff, and add vars so that no one can cheat and level up to 50 more than once (unless its a gm with an edit verb).

Hope I solved your question.
In response to Jay1
Thanks, now I'm getting hang of this programming language.Also does this make it so every level after 50 will gain that number of hp, defense etc?
In response to Broly103
Not the one I gave you, but where you see:
if(usr.level == 50)
usr.Lvl50Up()
if(usr.level == 100)
usr.Level100Up()

..you can just add more such as:
if(usr.level == 150)
usr.Level150Up()
if(usr.level == 200)
usr.Level200Up()

..and add more procs called "Level150Up()" and "usr.Level200Up()", and you can copy the Lvl50Up() proc but edit whatever you want. I didn't copy everything because i thought you mightve wanted the stat increases to change every 50 levels and etc. Tell me if you have any problems.
In response to Jay1
Jay1 wrote:
> obj
> your_training_utility //whatever the training utility is that makes you level up
> verb
> Use() //whatever the name of the verb is
> var/exp //if you have a experience variable
> var/maxexp //if you have a maxexp variable
> if(usr.exp==usr.maxexp)
> usr.Levelup() //just to make it easier, make it a proc
>
> proc
> Levelup()
> usr << "whatever bla bla you leveled up bla bla get to level 50 to increase your stats and whatever"
> var/level += 1
> if(usr.level == 50)
> usr.Lvl50Up() // make it a proc
> if(usr.level == 100)
> usr.Lvl100Up // make it a proc
> Lvl50Up()
> usr << "YOU GOT TO LEVEL 50!!"
> usr.maxhp += num //change the number to whatever you want to increase the stats by
> usr.str += num
> usr.def += num
> var/usr.gotlvl50 = 1 //if you want it that they cant level up at 50 more than once, etc.
> usr.astat += num //another stat and stuff
>

Make more procs for every level and stuff, and add vars so that no one can cheat and level up to 50 more than once (unless its a gm with an edit verb).

Hope I solved your question.
Thanks you did, here is another one. I'm haveing mutiple races in my game, I want each race to have unique leveling system. For example the human race will be skilled in attack while an alien race will be skilled in speed for example. How do I make it so each race will gain those stats, do I create mutiple leveling systems?
In response to Broly103
Use an if() statement.

-Ryan
In response to Jay1
You should NEVER EVER use usr in proc.

~>Jiskuha
In response to Jiskuha
Jiskuha wrote:
You should NEVER EVER use usr in proc.

~>Jiskuha

I use src.
In response to Jiskuha
Uses usr in Click() stuff like that... >.<

-Ryan
In response to Jay1
That is such a crappy way of doing it. You could simply just use something like:

mob
var
xp
mxp
str
othervar
level
health
mob/proc/LevelCheck()
if(src.xp>=src.mxp)
src.xp=0
src.mxp *=2 // Multiple the max xp by 2
src.str +=rand(1,2) //A random number from 1-2
src.othervar += rand(5,10) //A random number from 5-10
src.health += src.level // I just saw the other post about this
src.level++
mob
verb
Attack(var/mob/M in oview(1))
M.health -= M.str
src.LevelCheck()
In response to Ryne Rekab
Click(), Dblclick(), North(), Center() and other procedures like them are actually verbs. You can use usr in them safely.

Although... Does North(), South() etc. get called by movement procedures? Maybe they're not safe...
In response to Jp
They are proc not verbs.

-Ryan
In response to N1ghtW1ng
What happens if their exp goes above their max exp?
*cough*>=*cough*
In response to Hell Ramen
Hell Ramen wrote:
*cough*>=*cough*

You seem to be sick. You coughed all over me yesterday. >.>

-Ryan
In response to Hell Ramen
Good catch =P. I meant to do that, I guess my hand slipped >.>
As opposed to doing what Jay1 suggested, a far more efficient system is to have a formula for the amount of each statistic a character gains upon gaining a level. Something like this:

mob
var/leetness=0
var/wootness=0
var/garthorness=0
var/exp=0
var/level=1
verb/GainExp(var/a as num)
exp+=a
usr << "You gain [a] exp"
if(exp>=(level*10)**2) LevelUp()
proc/LevelUp()
level++
leetness+=level
wootness+=level
garthorness+=level
src << "You are now level [level]"
if(garthorness>100) src << "You are Garthor"
In response to Ryne Rekab
The way Click() and DblClick() occurs means that they are verbs. They are only ever triggered by player input, so usr is always the player doing the input.

I think North(), South(), Center() etc. work in the same way too.

Anyway, verbs are procs. :P.
In response to Ryne Rekab
Ryne Rekab wrote:
They are proc not verbs.

This is kind of splitting hairs. atom/Click() is a proc, but it's called directly by client/Click() so its behavior can be entirely assumed to be verb-safe as long as you haven't screwed with client/Click().

Lummox JR
In response to Jay1
Jay1 wrote:
Hope I solved your question.

Unfortunately you haven't. I appreciate that you're trying to help, but you just don't know what you're doing. Let's examine:

proc
Levelup()
usr << "whatever bla bla you leveled up bla bla get to level 50 to increase your stats and whatever"
var/level += 1
if(usr.level == 50)
usr.Lvl50Up() // make it a proc
if(usr.level == 100)
usr.Lvl100Up // make it a proc
Lvl50Up()
usr << "YOU GOT TO LEVEL 50!!"
usr.maxhp += num //change the number to whatever you want to increase the stats by
usr.str += num
usr.def += num
var/usr.gotlvl50 = 1 //if you want it that they cant level up at 50 more than once, etc.
usr.astat += num //another stat and stuff


There's way too much wrong with this. For starters, making these procs global is totally bogus. They should belong to a mob. When they're defined correctly as belonging to a mob, you can use src. In any case you should not use usr for this, because it's not safe in procs.
Rule of thumb:
No put usr in proc. Ungh.
And this line makes no sense, since it won't even compile:
var/usr.gotlvl50 = 1

It's a bit late to define mob vars, so that will fail. But if you had mob/var/highestlevel which just kept track of the highest level gained, you could simply check that every time you wanted to detrmine if stats should increase or not. Having on/off vars like gotlvl50, gotlvl100, etc. is bad; having a var that says you got up to level 55 so far (even if you've lost levels since) is good. For example:

if(++level > highestlevel)
src << "Welcome to level [level]."
highestlevel = level
... // raise stats
else
src << "Welcome back to level [level]."


As for something happening at level 50, you don't need separate procs for that sort of thing. In fact, it's more common to do something every nth level, like perhaps gain certain innate skills at level 5, 10, 15, etc. In those cases you have the handy % operator.

So all in all, none of this is good code and needs to be seriously redone. It's great that you want to help, but you really need to learn more before you can do that.

Lummox JR
In response to Broly103
Broly103 wrote:
Jay1 wrote:
> > obj
> > your_training_utility //whatever the training utility is that makes you level up
> > verb
> > Use() //whatever the name of the verb is
> > var/exp //if you have a experience variable
> > var/maxexp //if you have a maxexp variable
> > if(usr.exp==usr.maxexp)
> > usr.Levelup() //just to make it easier, make it a proc
> >
> > proc
> > Levelup()
> > usr << "whatever bla bla you leveled up bla bla get to level 50 to increase your stats and whatever"
> > var/level += 1
> > if(usr.level == 50)
> > usr.Lvl50Up() // make it a proc
> > if(usr.level == 100)
> > usr.Lvl100Up // make it a proc
> > Lvl50Up()
> > usr << "YOU GOT TO LEVEL 50!!"
> > usr.maxhp += num //change the number to whatever you want to increase the stats by
> > usr.str += num
> > usr.def += num
> > var/usr.gotlvl50 = 1 //if you want it that they cant level up at 50 more than once, etc.
> > usr.astat += num //another stat and stuff
> >

Make more procs for every level and stuff, and add vars so that no one can cheat and level up to 50 more than once (unless its a gm with an edit verb).

Hope I solved your question.
Thanks you did, here is another one. I'm haveing mutiple races in my game, I want each race to have unique leveling system. For example the human race will be skilled in attack while an alien race will be skilled in speed for example. How do I make it so each race will gain those stats, do I create mutiple leveling systems?

Okay, that gets a little harder now
mob/Login()
if(src.race=="Race1")
src.Race1LevelUpSys()

Thats where my knolwage of the situation goes out of reach. Ask one of these other peoples.
Page: 1 2