ID:142535
 
Code:
turf
dojopk
icon = 'NONPK.dmi'
density=0
Entered()
..()
if(usr.Hp<=0)
usr.loc=locate(1,1,1)


Problem description:

my problem is that i want the mob to get sent to a specific location when they die on a specific turf, any help?
You might try this.
turf
dojopk
icon = 'NONPK.dmi'
density=0
Entered(mob/M)
..()
if(istype(M))
if(M.Hp<=0)
M.loc=locate(1,1,1)
In response to Oasiscircle
While that is the proper way to write Entered(), that wasn't the question. His question was, "How do I define where a mob goes to when he dies, and have it dependent on the turf they are on?"

My suggestion is to use areas for this, and it would go something like this:

area
//yes, I know it's declared as a turf, bear with me here
var/tmp/turf/graveyard = "" as text
New()
graveyard = locate(graveyard)
if(!isturf(graveyard))
graveyard = null

mob/player/proc/die()
var/area/A = loc.loc
//if we can't find the area (rare case) or it has no graveyard
if(!istype(A) || !A.graveyard)
//default case:
loc = locate(1,1,1)
else
loc = A.graveyard


Now, you need to go to the map editor to change the tags of the turfs that you want to be the "graveyards". The tag has to be something unique. So, perhaps, you'd set one's tag to "dojopkgraveyard". Next, your area must be set to have its graveyard variable be the same as that tag. You can either do this in the map editor, by:

1) Click on the area in the tree on the left
2) Right-click the image of the area in the box below the minimap
3) Select "New Instance..."
4) Edit the tag from there (to "dojopkgraveyard")
5) Once you're done, select the new instance from the box below the map editor, and place it on the map

Or, if you don't want Xooxer to throw a hissy-fit, just changing the graveyard variable of a subtype of area:

area
dojopk
graveyard = "dojopkgraveyard"
In response to Garthor
Garthor wrote:
While that is the proper way to write Entered(), that wasn't the question. His question was, "How do I define where a mob goes to when he dies, and have it dependent on the turf they are on?"

My suggestion is to use areas for this, and it would go something like this:

area
> //yes, I know it's declared as a turf, bear with me here
> var/tmp/turf/graveyard = "" as text
> New()
> graveyard = locate(graveyard)
> if(!isturf(graveyard))
> graveyard = null
>
> mob/player/proc/die()
> var/area/A = loc.loc
> //if we can't find the area (rare case) or it has no graveyard
> if(!istype(A) || !A.graveyard)
> //default case:
> loc = locate(1,1,1)
> else
> loc = A.graveyard

Now, you need to go to the map editor to change the tags of the turfs that you want to be the "graveyards". The tag has to be something unique. So, perhaps, you'd set one's tag to "dojopkgraveyard". Next, your area must be set to have its graveyard variable be the same as that tag. You can either do this in the map editor, by:

1) Click on the area in the tree on the left
2) Right-click the image of the area in the box below the minimap
3) Select "New Instance..."
4) Edit the tag from there (to "dojopkgraveyard")
5) Once you're done, select the new instance from the box below the map editor, and place it on the map

Or, if you don't want Xooxer to throw a hissy-fit, just changing the graveyard variable of a subtype of area:

area
> dojopk
> graveyard = "dojopkgraveyard"




thanks mate my problem is fixed :D