ID:138752
 
Code:
proc
DeathCheck()
if (HP <= 0)
world << "[src] dies!"
del(src)


Problem description:my player does not die just goes to minus HP and how do i set a spawn location for when the player dies ?

mob
proc
DeathCheck()
if(HP<=0)
world<<"[src] died!"
for(var/obj/Spawn_Point/S in world)
src.loc=S:loc
obj
Spawn_Point


Make sure the procs which take down the mob's hp call the death proc aswell.
In response to Eternal_Memories
thanks but what var would i make for?



src.loc=S:loc
ln .dm:44:error: S/:/loc: undefined var
In response to PlucvbYoutube1
Guess it was a typo, it should be S.loc, not S:loc
In response to Kccmt
Kccmt wrote:
Guess it was a typo, it should be S.loc, not S:loc

ln .dm:44:error: S.loc: undefined var
In response to PlucvbYoutube1
mob/var
HP=100
mob/proc
DeathCheck()//proc called DeathCheck
if(src.HP<=0)//their HP is 0 or less
src.loc=locate(1,1,1)//take it to 1,1,1 which is bottom left in 1st z
mob/verb/Test()
src.HP-=rand(10,30)
src.DeathCheck()
In response to Hassanjalil
PlucvbYoutube1 has Logged In
Connection died.

it works in respect but the connection dies, and when a enemy attacks and hp goes below 0 i don't die
In response to PlucvbYoutube1
PlucvbYoutube1 wrote:
PlucvbYoutube1 has Logged In
Connection died.

it works in respect but the connection dies, and when a enemy attacks and hp goes below 0 i don't die

Make sure there are no procs which stop mob/Login.

They must have ..() after the lines.
Also verify there are not del (src) randomly spreaded on your source.

By the way, did you paste the few lines I posted about Spawn_Point? It was needed.
In response to Eternal_Memories
Eternal_Memories wrote:
> mob
> proc
> DeathCheck()
> if(HP<=0)
> world<<"[src] died!"
> for(var/obj/Spawn_Point/S in world)
> src.loc=S:loc
> obj
> Spawn_Point

Make sure the procs which take down the mob's hp call the death proc aswell.


That
src.loc=S:loc
.
Why are you using ":" instead of "." ? I don't know if this makes any difference but I'm curious since "." just works fine.
Please see here for an implementation that fixes some of these problems. Additionally, read the code. Try and understand what it does. Don't just copy and paste it, but learn from it to see how it works and how you can fix your problem.
In response to TheProductions
TheProductions wrote:
Eternal_Memories wrote:
> > mob
> > proc
> > DeathCheck()
> > if(HP<=0)
> > world<<"[src] died!"
> > for(var/obj/Spawn_Point/S in world)
> > src.loc=S:loc
> > obj
> > Spawn_Point

Make sure the procs which take down the mob's hp call the death proc aswell.


That
src.loc=S:loc
.
Why are you using ":" instead of "." ? I don't know if this makes any difference but I'm curious since "." just works fine.

I've always used : instead of . after for(var...) I don't remember why xD
In response to Eternal_Memories
It's a bad habit, use the dot.