ID:142537
 
Code:
turf
dojopk
icon='dojopk.dmi'
density=0
Enter(mob/M)
if(usr.deathcheck())
usr.loc= locate(1,1,1)


Problem description:

hi, im having some problems with a special turf.

i want it so that if a person kills another person or mob while there on the turf, the mob gets sent to a specific location, but its not like my deathcheck proc, where it gets sent to the spawn (where u die u get sent) i want it so that the person gets sent somewhere else. Another error im having with my code is that a mob cant go through the turf, like it has a density of 1. help will be appreciated
I'm a tad bit confused by the wording of the question, but just looking at the code you posted, I have to ask, does deathcheck() have a return value, otherwise that probably won't work.
In response to Giantpanda
mob
proc
deathcheck()
if(src.Hp <= 0)
if(istype(src.client))
src << "You have died, [usr] killed you!"
usr << "You killed [src]"
src.loc = locate(11,45,2)
src.Hp=src.Mhp
else
src.exp += src.expgive
if(usr.pk==0)
usr<<"your in a non pk place"
return
if(usr.exp>=usr.mexp)
usr.exp=0
usr.kills+=1
usr.Level+=1
usr.mexp*=2
usr.Str+=15
usr.Chakra+=60
usr.Def+=15
usr.expupp()
usr << "You have killed [src]!"
del(src)
else
..()
The reason your mobs can't walk through the turf is because you're using Enter, not Entered. Entered is the proc that fires after the object has entered the turf in this case; Enter is what determines if it can do so in the first place.
In response to Agrey123
This deathcheck() is written wrong. First, and most obviously, it doesn't take an argument as to WHO was doing the killing. usr is the wrong answer here, because it isn't to be used in procs. So, you need to give deathcheck() an argument:

mob/proc/deathcheck(var/mob/killer)
src << "[killer] killed you.


Next, the istype() statement shouldn't be there.

if(src.client)


is all that's needed.

Next, you have this block of code that I really don't get:

                else
src.exp += src.expgive


Why are NPCs gaining experience?

The pk block also is odd:

                if(usr.pk==0)
usr<<"your in a non pk place"
return


is this supposed to be telling players - much too late - that they've just killed someone when they're not allowed?

Next, you've got a whole bunch of code that just doesn't belong here:

                if(usr.exp>=usr.mexp)
usr.exp=0
usr.kills+=1
usr.Level+=1
usr.mexp*=2
usr.Str+=15
usr.Chakra+=60
usr.Def+=15
usr.expupp()
usr << "You have killed [src]!"
del(src)


This belongs in a levelcheck() proc, and del(src) doesn't even belong (as, if this is a player being killed, that would disconnect them).

And, finally, a bit of voodoo coding:

            else
..()


as this is the INITIAL DECLARATION of this proc, there is no possible way for ..() to do anything, which leads me to believe you've put it there because you've got no damn clue what it does.

Actually, we'll call this "cargo cult coding."

Point is, you've seen it, have no clue what it does (except that people who know what they're doing use it), so you've decided to just slather it wherever you feel like in an attempt to... do something. It just doesn't belong here at all.
In response to Garthor
For future reference Aragry only use that to call the parent of a proc that you are overiding for example.

Login()
world << "Everyone say Hi to, [usr]
...()

This calls the original Login() proc and the child which i made asks the parent what to do.

This:
else
..() will give you so many errors and warnings your head will pop off.