ID:166143
 
So I'm in the process of learning the DM language, and i find it easiest for me to learn by actually making things and seeing how it works. I've been working on a mud-style rpg(with graphics), and i've run into a problem i can't find the answer for.

I'm making it so that moving drains your movement(mv) stat. When you sit, you regain your mv. I want it so that different types of turfs regain mv at different rates.

here is an example of what i have so far:

turf/var
mvregen = 5



turf/grass
icon = 'grass.dmi'

turf/dirt
icon = 'dirt.dmi'
mvregen = 2


the turfs. mvregen defaults to 5, but on dirt you only regen 2

mob/proc
regenMove(mob/M, amount)


M << "You gain [amount] moves"
M.mv += amount
if(M.mv >= M.maxmv)
M << "You feel fully refreshed"
M.mv = M.maxmv
M.resting = 0
sleep(CBT_ROUND*2)



mob/pc/verb

Sit()
usr.resting = 1
usr << "You sit down."
sleep(CBT_ROUND*2)
while(resting)
regenMove(usr, ?) //what do i put here?


The verbs and proc, everything works great with a static amount being passed to regenMove(), but how do i pass whatever turf the usr is sitting on?
:)
var/turf/T = src.loc
src.mvrege += T.mvrege


Make a var for a turf in your loc, then you can modify the vars of the var.
In response to Gooseheaded
Gooseheaded wrote:
:)
> var/turf/T = src.loc
> src.mvrege += T.mvrege
>

Make a var for a turf in your loc, then you can modify the vars of the var.

Thanks, worked like a charm!
In response to Kack
You are a good person, because you at least looked for help.

Whenever you need help, please ask on the forums!
;)