ID:1749235
 
(See the best response by Kaiochao.)
Code:
mob
Login()
var/mob/NewWraith =
new/mob/Enemy/Wraith(locate(rand(1, 100), rand(1, 100), 1))


Problem description:
Is there a way to get it so that it doesn't treat the new Wraith as part of the player? It spawns correctly, but whenever I use a Teleport() or Summon() command, it Teleports me to me, or Summons me to me...
Best response
That sounds like an issue with the Teleport and Summon commands.
i mean

I don't see anything wrong with those 2 lines, other than it triggering my tendencies to hijack New() for those sorts of things. need more info.
Teleport(mob/M as mob in world)
usr.loc = M.loc

Summon(mob/M as mob in world)
M.loc = usr.loc


Given how simple that is, there can't be anything wrong, can there?
Teleport(mob/M as mob in world)
usr.loc = locate(M.x,M.y,M.z)

Summon(mob/M as mob in world)
M.loc = locate(usr.x,usr.y,usr.z)


try that instead
Tried that, but it didn't work...would it matter if it changes the name of the NewWraith to "[src.name]'s Wraith"?

Edit: Apparently it does matter, anyone know how to get around this so it still works when you set the NewWraith's name to "[src.name]'s Wraith"?
Input() as implemented by byond cannot recognize more than one mob with the same name when using verbs that select from list.

You said you already changed the wraith's name so your teleport/summon commands work now, so i'm not sure what you're asking now.
Whenever I used teleport I get a list of all the differently named mobs, like "Seiryuu" and "Seiryuu's Wraith", however, when I choose to teleport to "Seiryuu's Wraith" it simply teleports me to myself, and not the Wraith.
The behavior sounds to me that at some point the wraith is being added to the player's contents list.

Try this:

Login()
var/mob/Enemy/Wraith/NewWraith = new(locate(rand(1, 100), rand(1, 100), 1))
NewWraith.name="[src]'s New Wraith"


If this doesn't work, then the problem is a line of code that you aren't telling us.
That didn't work either, i'll post all the code pertaining to the Wraith though, in case that'll help any.
Login()
var/mob/Enemy/Wraith/NewWraith = new(locate(rand(1, 100), rand(1, 100), 1))
NewWraith.name = "[src]'s Wraith"
NewWraith.wraithtarget = src
NewWraith.exp = (src.lvl * 5) - 5

var
isWraith = 0
wraithtarget = ""

Enemy
Wraith
icon = 'Wraith.dmi'
icon_state = "Wraith"
isWraith = 1
New()
src.hp = src.maxhp
spawn(-1)
src.TargetAI()
return ..()
proc
TargetAI()
while(src)
while(wraithtarget in world)
if(get_dist(src, wraithtarget) <= 1)
src.dir = get_dir(src, wraithtarget)
src.NPCAttack(wraithtarget)
else
step_to(src, wraithtarget)
break
sleep(5)


Edit: Tried usr.contents -= NewWraith but that didn't fix it either.

Edit2: Finally got it to work, just changed NewWraith.name = "[src]'s Wraith" to NewWraith.name = "Wraith ([src])"...if anyone knows why the first doesn't work properly, would be nice to hear the explanation with that.