ID:1746536
 
(See the best response by Kumorii.)
Code:
action(t)

if(dead)
moved = 0
if(!client)
spawn(60)
respawn()
loc = locate(initial(x), initial(y), initial(z))


Problem description:Hello byond developers, i need a bit of help, im using Forum_account's Action RPG Framework library and i want to make the ingame ai/monsters respawn after die to his initial possition, but i cant, i used the code that you can see in the top of this description but when the mob respawns still gots me as target and he comes from his initial poss to me, i can be far and he still comes to kill me.

Best response
You'll need to manually reset any variables the ai has to track who it's persuing. I'm not sure how forum_account's library works but something like target = null should be added so the ai "forgets" about you.

Also, instead of loc = locate(initial(x), initial(y), initial(z)), I think you could also do loc = initial(loc) to avoid unnecessary computing.
I dont think in that code is the problem, sounds like even thought the mob dies he still has you as his target so he still comes aftar you once he respawns. The problem has to be somewhere in the code where he targets you.
ok i applyed the target=null and remplaced loc for loc=initial(loc) and now works fine, i added this new code under dead() proc instead of action(t).
Final code:
if(!client)
spawn(res)
respawn()
loc = initial(loc)
target = null
Glad to be of help. (: