ID:271276
 
Im really new and Im reading the DM guide need a little help I got some help from wiz chat but I dont want to bother them with quetions lol.

mob/var
health = 50
max_health = 50

mob/proc/deathcheck()
if(health <= 0)
src<< "Your dead!"
spawn(50)loc = locate (1,1,1)




obj/machine
icon = 'machine.dmi'
verb/touch()
set src in view(1)
usr.health = 0
usr << "The machine has shot your ass with a laser gun!"



Well when I touch the machine my guy doesn't die >_>

And get sent back to 1,1,1

Im not that good its a simple quetion to you people im sure


and if you do answer may you explain how you did everything I want to learn as much as I can from every quetion I ask.

Thank you very much!
put usr.deathcehck() after usr.health=0
In response to Hell Ramen
Ohhh
So lemme get this straight

After every time they lose health I have to put in deathcheck() into the code?
In response to Beatdown_system
Alright well what if I touched him and I didnt want him to just kill me... How would I make it so if I pushed touch 3 times it would then kill me


obj/machine
icon = 'machine.dmi'
verb/touch()
set src in view(1)
usr.health = 0
usr.deathcheck()
usr << "The machine has shot your ass with a laser gun!"


In that code how could I make it so they touch the machine 3 times then they die?
In response to Beatdown_system
Beatdown_system wrote:
Ohhh
So lemme get this straight

After every time they lose health I have to put in deathcheck() into the code?

Yep!

Beatdown_system wrote:
Alright well what if I touched him and I didnt want him to just kill me... How would I make it so if I pushed touch 3 times it would then kill me


obj/machine
icon = 'machine.dmi'
verb/touch()
set src in view(1)
usr.health = 0
usr.deathcheck()
usr << "The machine has shot your ass with a laser gun!"


In that code how could I make it so they touch the machine 3 times then they die?


Well, there's many ways to do this, one, they touch him 3 times and die no matter what:

mob/var/touchme
obj/machine
icon = 'machine.dmi'
verb/touch()
set src in view(1)
usr.touchme+=1
if(touchme<3)return //If touchme isn't equal to 3 (or any number above 3), it won't kill the person. It'll end the verb right here and now.
usr.touchme=0 //This way they have to press it 3 times again
usr.health = 0
usr.deathcheck()
usr << "The machine has shot your ass with a laser gun!"



Another way to do it is to subtract 33% of their health each time (hp-round(maxhp/3)) and just do that.