ID:140862
 
Code:
mob
icon = 'player.dmi'
Login()
loc = locate(3,3,1)
world << "[usr] Has logged in."
proc
deathcheck()
if (HP <= 0)
usr << "[src] has been killed."
usr.HP += usr.hurt
usr.hurt -= usr.hurt
if (key)
loc = locate(3,3,1)
else
del(src)
Del()
var/obj/gold/G = new(loc)
G.amount = rand(1,10)
..()
verb
Smile()
world << "[usr] smiles."
Laugh()
world << "[usr] laughs."
Say(msg as text)
world << "[usr] says: [msg]"
Change_name(N as text)
set desc = "(\"new name\") Change your name."
name = N
world << "[usr] has changed \his name"
Whisper(M as mob,msg as text)
M << "[usr] Whispers : [msg]"
Punch(mob/M as mob in oview(1))
var/damage = rand(1,10)+ Strength
usr << "You attack [M] and do [damage] damage!"
M.HP -= damage
M.hurt += damage
M.deathcheck()
M << "You were punched by [src],you now have [M.HP] Health left!"
Change_Character_Blue()
icon = 'Blue mob.dmi'
Change_Character_Red()
icon = 'Red mob.dmi'
Change_Character_Yellow()
icon = 'Yellowmob.dmi'
Bug
icon = 'bug.dmi'

var
HP = 100
wealth
Strength = 10
hurt = 0


Problem description:
Ok what I want my code to do is that when a player is killed he gets sent back to the start and if its a NPC it just gets deleted,that works fine but I also want it that when you are hit it takes away HP and adds to your hurt,once you die your hurt is added to your health therefore healing you to your max health,it won't work though,idk why not I'm still kinda new to this but I've looked over it a thousand times and don't get whats wrong...

You're doing it wrong. Get rid of anything that has hurt in it. Instead use damage and do a death check after every damage.

And in the death check you should put ur respawning code and add usr.Health = MaxHealth.

You would need to add a new variable called MaxHealth and it should work.
In response to Gamemakingdude
Hmm...I think I have an idea of how that might work...
In response to Jordan1794
Btw do you have msn, So i can help you with any other request you need?

I don't mind teaching you as well.
In response to Gamemakingdude
I have a windows live,I only use it when I'm on my xbox though :P
You could add me here on byond and we could talk :D
mob
proc
DeathCheck()
if(src.health >= 0 && src.NPC)
del(src)
if(src.health >= 0)
src.health=100
src.loc=locate(3,3,1)
In response to Kyubi742
That's rather poor formatting, there. There's no reason to be checking health twice, aside from using the wrong comparison. You should instead have something like this:

if(health <= 0)
if(src.NPC)
del(src)
else
health = maxhealth
loc = locate()