ID:178875
 
I'm trying to gem my character to move to a location after they die. Sometimes it works, but usually it doesn't. Here is the code.

--------

playerdeathcheck(mob/P as mob, mob/M as mob)
var
tempgold
location
if (P.hp <=0)
alert (P, "You have been killed!")
usr << "You lose half your gold"
tempgold = P.gold % 2
P.gold = P.gold - tempgold
P.gold -= (P.gold / 2)
var/turf/battlearea/T = P.battlearea
T.occupied = 0
P.battlearea = null
P.onbattlefield = null
P.oldbattlefield = null
P.hp = 1
P.battlestart = 0
usr<<"[P.savex] [P.savey] [P.savez]"
location = locate(P.savex,P.savey,P.savez)
P.Move(location)
P.invisibility = 0
del (M)
//Player is still alive, so go back to main combat menu
else
maincombat(P, M)

--------

There are values in the savex,savey,savez, so that isn't the problem. Any help would be appreciated.
Rubius wrote:
I'm trying to gem my character to move to a location after they die. Sometimes it works, but usually it doesn't. Here is the code.

--------

playerdeathcheck(mob/P as mob, mob/M as mob)
var
tempgold
location
if (P.hp <=0)
alert (P, "You have been killed!")
usr << "You lose half your gold"
tempgold = P.gold % 2
P.gold = P.gold - tempgold
P.gold -= (P.gold / 2)
var/turf/battlearea/T = P.battlearea
T.occupied = 0
P.battlearea = null
P.onbattlefield = null
P.oldbattlefield = null
P.hp = 1
P.battlestart = 0
usr<<"[P.savex] [P.savey] [P.savez]"
location = locate(P.savex,P.savey,P.savez)
P.Move(location)
P.invisibility = 0
del (M)
//Player is still alive, so go back to main combat menu
else
maincombat(P, M)

--------

There are values in the savex,savey,savez, so that isn't the problem. Any help would be appreciated.

change this line:
location = locate(P.savex,P.savey,P.savez)
to:
P.loc = locate(P.savex,P.savey,P.savez)

and see if that works any better.
In response to Darkness
It didn't, but I think I have it working better.
In response to Rubius
Actually, it doesn't work now, so any help???