ID:178041
Jun 26 2002, 11:53 am
|
|
how do i make it so when the usr gets within 1 tile of an obj his/her str gets decreased by one every 2 seconds
|
In response to Aleis
|
|
that doesn't help me much
|
In response to midevilOz
|
|
mob/var/onturf = 0
turf/onetileawayturf Entered(O) usr.onturf = 1 usr.str += 2 usr.srgiven() Exited(O) usr.onturf = 0 mob/proc/strgiven() if(usr.onturf == 1) sleep(20)//2 seconds.:/ usr.str += 2 usr.strgiven() else ..() |
In response to Aleis
|
|
Aleis wrote:
for grass you could do someting like this This is really horrific, for two reasons:
|
In response to ShadowSiientx
|
|
ShadowSiientx wrote:
mob/var/onturf = 0 Egads, SS, how many times do I have to tell you this? DO NOT use usr in Entered(). In this case, the correct var would be O. You'd have to cast it to a mob first, though, like this: turf/onetileawayturf mob/proc/strgiven() This should be src, not usr, because the proc belongs to the mob it's happening to. During the sleep period, usr could change to something else. Also, you have to use spawn() to call strgiven() again, or else you'll eventually overflow the stack because the same proc keeps calling itself recursively. Lummox JR |
turf
grass
icon = 'grass.dmi'
Entered()
usr.hp -= 2
sleep(20)
Exited()
usr.hp == usr.hp
something like that... but you have to get it to repeat somehow.
~Aleis~