ID:139527
 
Code:
        Return2()
for(var/mob/m in world)
if("[m.name]([m.keyn])" == src.trainer)
var/pokemon/p = src
src.client.mob = m
m.PokeParty += p
m.CanSend = 1
return m
Sendout(mob/m)
src.loc = locate(m.x,m.y,m.z)
src.trainer = "[m.name]([m.keyn])"
src.owner = m
m.client.mob = src


Problem description:
Basically, I can send out the pokemon fine, all is well.

But when I goto return it, the pokemon stays at it's location, and there's one extra in the list (As if it duplicated.). How do I make it vanish like it was when you first got the pokemon (IE, only in list), and how do I prevent duplication?

Edit: Fixed the duplicates, but what about it not vanishing?
Instead of looping through all the mobs in the world, just use src.owner.

As for "returning" it, set its loc to null.

Also, instead of locate(m.x,m.y,m.z), just use m.loc.
In response to Garthor
I just want to state that sometimes the object may be referenced by some obscure porcedure that didn't end properly, due to either coding fault of timig issues, as a result they could end up not getting garbage collected and deleted, even though they would be moved out of sight. This isn't a big problem but it could cause lots of lag on a long running server.

If Asellia gets this circumstance too then they may want to just use del() instead. I'd also suggest setting loc to null as well, especially if you include periodic server refreshes.

just wanted to throw them that warning.