ID:174688
 
I would like to be able to make turfs (i.e. lava) deal damage when stepped on.
turf
Lava
icon = 'Lava.dmi'
Entered(mob/M)
if(istype(M))
M.health -= 20
turf
Lava
icon = 'icon.dmi'
icon_state = "state"
density = 0
usr.hp -= [damage here without bractes]
usr << " You Where burnt by the lava"
In response to SSChicken
SSChicken wrote:
> turf
> Lava
> icon = 'Lava.dmi'
> Entered(mob/M)
> if(istype(M))
> M.health -= 20
>


Just wondering, but why use istype(M) without specifying a path? Couldn't you use ismob? I don't use ismob,istype, etc often, so Im just wondering.
turf
lava
icon='lava.dmi'
Entered(atom/movable/M)
if(ismob(M))
src.Damage(M)
return ..()
proc
Damage(mob/Damaged)
while(Damaged in src.loc)
Damaged.hp-=20
sleep(10)
mob/var/lava = 0
turf/Lava
icon stuff ect
Enter()
usr.lava = 1
usr.lava(usr)
Exit()
usr.lava = 0

mob/proc/Lave(N)
if(usr.lava == 1)
usr.hp -= 5
spawn(10)
usr.lava(usr)
else
return 1

that might work made it in the post so tabing isnt right
In response to Goku72
what does the sleep do?
In response to Hendrix
Hendrix wrote:
mob/var/lava = 0
turf/Lava
icon stuff ect
Enter()
usr.lava = 1
usr.lava(usr)
Exit()
usr.lava = 0

mob/proc/Lave(N)
if(usr.lava == 1)
usr.hp -= 5
spawn(10)
usr.lava(usr)
else
return 1
Since you are helping people, and I want people to be helped, I am going to correct you here so you can help people better :D
NEVER use usr in procs. Especially in Enter(), Entered(), Exit(), and Exited().

Airjoe
In response to Polaris139
Polaris139 wrote:
what does the sleep do?
It makes it so if you u had sleep(30) when it hits 30(3 seconds) it will do the command
In response to Sisc0
No offense but why do people bother posting responces when they really have no idea what they're talking about?