ID:269479
 
Can someone gimme a resting and stamina code,i ned it for my game
Please refrain from 'asking for code' in this forum. It is better to ask the general idea of how to do something, and atleast make an attempt to do something yourself first.
In response to Flerix
Flerix wrote:
Please refrain from 'asking for code' in this forum. It is better to ask the general idea of how to do something, and atleast make an attempt to do something yourself first.
I did attempt it,i'm not that good at coding
In response to Joe Tickle-Me
Joe Tickle-Me wrote:
Flerix wrote:
Please refrain from 'asking for code' in this forum. It is better to ask the general idea of how to do something, and atleast make an attempt to do something yourself first.
I did attempt it,i'm not that good at coding

Stamina & Resting System

You should ask your self some questions on how you want this system to work. Like, What is the max and min stamina a being could poses? Or even if there should be a limit. Often you at least have a lowest point. Like the number zero.

So are lowest stamina will be zero and are highest will be as high as it can go. We are going to add a variable to are players mob called stamina.
mob/player/var/stamina=0
// Or we could declare it for all mobs.
mob/var/stamina=0


Now we move to a reason for stamina. Like an action that uses it up. But are stamina is 0 right now. So lets make it 80 instead. Just change the 0 too 80. Now to are action.

I know! lets use up some stamina each time are player moves. 1 to be exact.
mob/player/Move()
if(src.stamina<=0)
src << "Your to tired to move."
return 0
src.stamina--
return ..()


Now we add are rest. This could be used any which way. But lets just make a verb called rest.
mob/player/verb/rest()
src.stamina+=80
src << "You rest up."


Hope that helps.

-- Green Lime
In response to Joe Tickle-Me
I did attempt it,i'm not that good at coding

http://www.byond.com/docs/guide/ <-- get better at it then. if you want to become a coder you shouldn't be asking people to write a code for you.

so a better version of your question would be:
Can anyone give me a way to make a resting and a stamina system?

O-matic
In response to Green Lime
I'm not very good at coding but I had a thought and figured this would be a good place to put it.

Say that the user of the rest verb has full stamina and we wanted to punish (yeah I'm evil) them for sitting around resting all day instead of playing. Would this code suffice?

mob/verb/rest()
if(usr.stamina < 100)
usr.stamina ++
usr.focus ++
else
usr.strength --
usr.speed --


If this code is valid I believe it would make people actually pay attention when they are resting. Note: This idea was born when I played a DBZ rip and realized people would sit around and rest,meditate, or train all day with macros and such and boast about being 1337 gamers and such.