ID:150144
 
Is there a way to make it to where you cannot have stats lower that 0
because I have a verb that takes exp and when I use it I get -500 exp :>

How do you make it to where you get different amounts of exp when attacking different mobs?
Vermolius wrote:
Is there a way to make it to where you cannot have stats lower that 0
because I have a verb that takes exp and when I use it I get -500 exp :>

When subtracting from someone's exp, do it like this:
M.exp=max(M.exp-500,0)

This ensures it will never drop below 0.

How do you make it to where you get different amounts of exp when attacking different mobs?

That's easy. Just set the amount of exp (or a range of exp, depending on how you do it) for each different mob.
mob
var/exp_min
var/exp_max

proc/EarnExp(mob/M)
M.exp+=rand(exp_min,exp_max)

Lummox JR
In response to Lummox JR
the exp thing inst working it says M is bad var?
In response to Vermolius
M.exp that is
In response to Vermolius
nm I recoded it and it works, but how do I make it to where if they do not have the required 500 exp they cannot use the verb?
In response to Vermolius
post your verb
In response to Darke Rage
if(usr.exp<=500)
usr<<"You do not have enough exp to use this"
return
In response to Vermolius
You need to learn the basics of coding... this (and half of the questions you can probably think of) calls for a simple "if" statement. Whenever you want someone to only be able to do something IF some other condition is true, you use "if".
In response to Darke Rage
About my post add that to your code.
In response to Darke Rage
I'd really rather use prompt than alert because alert is screwy.

But when I try to use prompt I always get a use input instead of prompt since prompt is phasing...
Its confusing :>
In response to Vermolius
Prompt is phasing, that's telling you that in a few more versions prompt won't even exist, which would be bad for your code. Alert and Input are the ones you want to use. Alert is for a button-answered popup box, and Input is for choosing an item from a list.