ID:789579
 
(See the best response by Albro1.)
Code:
turf
land1
icon = 'icons/land1.dmi'
lava
icon_state = "L1_Lava"
Entered()
usr << "You fell in lava"


Problem description:

when the usr walks on the lava turf, i would like some kind of confirmation. the Entered() proc does not work because i have read that it only enters that proc from a move. how can i get this confirmation. what i would like to do is take away some hit points from the usr when the usr walks on the java turf. keep in mind that i am still new in learning dm.
Why is Entered() not working for you? Entered() is triggered by Enter(), which happens when a person moves on to the turf in question.
i got it working. i had the wrong icon on the map. :)
mob
var
HP = 20

turf
land1
icon = 'icons/land1.dmi'
lava
icon_state = "L1_Lava"
Entered()
..()
var/mob/m = new
m.HP -= 5
usr << "You fell in lava: You lost [m.HP] hit points"
m.DeathCheck()


every time the usr walks on another lava turf, 5 hit points will be lost. at /mob, i have set the HP to 20. yet every time the usr walks on the lava turf, the hp is still at 15. the code seems to be resetting or getting the same value of 20 for the HP. how can i stop this from happening
In response to Kalster
Kalster wrote:
> mob
> var
> HP = 20
>
> turf
> land1
> icon = 'icons/land1.dmi'
> lava
> icon_state = "L1_Lava"
> Entered()
> ..()
> var/mob/m = new
> m.HP -= 5
> usr << "You fell in lava: You lost [m.HP] hit points"
> m.DeathCheck()
>

every time the usr walks on another lava turf, 5 hit points will be lost. at /mob, i have set the HP to 20. yet every time the usr walks on the lava turf, the hp is still at 15. the code seems to be resetting or getting the same value of 20 for the HP. how can i stop this from happening

That would be because you are creating a new mob and not using the player.

mob
var
HP = 20

turf
land1
icon = 'icons/land1.dmi'
lava
icon_state = "L1_Lava"
Entered()
..()
usr.HP -= 5
usr << "You fell in lava: You lost [m.HP] hit points"
usr.DeathCheck()


Which didn't need to be done.
i am starting to understand the language now.

works great. thank you.
Best response
I have no idea why you are using usr in Entered().

turf/land1/lava/Entered(atom/a)
..(a)
if(ismob(a))
var/mob/m = a
var/lost = 5
m.HP -= lost
m << "You fell in lava; you lost [lost] hit points."
// Just want to point out that your current output would just tell them what their current HP is, not how much they lost.
m.DeathCheck()

Albro1, the code works great. now it is time for me to study your code. thank you