Applied npc spawning logic to the tile scripting editor