ID:179122
 
I'm having a little trouble getting started with my AI:


proc/create_opponent()
var/mob/player/NPC = new
NPC.name = input("Please name the new NPC","Name") as text
NPC.join_game()
usr.verbs += /mob/player/proc/delete_opponent
spawn() NPC.Control_npc()


When i execute this proc, I'm the one who joins the game rather than the NPC. I was thinking that maybe i need to set usr = src inside join_game or something like that, but then in my list of players it just shows dramstud twice (instead of dramstud and NPC.name), so it seems like i'm doing this wrong altogether. any advice would be appreciated.
We'd have to see what happens in join_game() to really be able to diagnose the problem.

You also want to be careful with usr. Unless you actually clicked on the verb then there is no guarantee that there will be a usr. It's usually best to stick with src and mobs passed as paramaters unless you have to use usr, such as with the Click() proc.