(08-11-2012 02:43 AM)Mordaunt Wrote: Why would the NPC teleport home when there is no player if the entire function is under @NPCLookatChar?
How do you expect it to fire to send an NPC home with no player present? Your script will only run if that trigger is... triggered.
What you should do is have it look at the time of day in the gameworld, or a lightlevel to do the teleport home function. Of course then you will have to script it so that before it teleports it looks to see if it can indeed be seen by a player.
Further more is the trigger not @NPCSeeNewPlayer on @SeeNewPlayer? It's been a while since I did any serious scripting with sphere so I don't know whether your trigger is one they added or one I forget, but I don't recall seeing it before.
NPCLookAtChar is only for initiation to creation/equip of the memory. For some reason you can't seem to tell an NPC to equip a memory on @create or @npcrestock. Since the NPC's initially is in the store the players will naturally trigger the memory to be created when they get near the store, if for some reason the NPC dies and needs to respawn. It'll actually work when the NPC looks at *any* character, but inside a small store thats unlikely.
Once the memory is created, the timer goes off and it checks the light level and triggers as required, then resets the timer back to 10. So, once the memory is created the script will run completely indepentantly of the NPCLookAtChar trigger.
Chances are once I clean up the script I'll just have the NPCs all have one common random item that actually holds the trigger, like an invisible ring or something. That way I can skip the NPCLookAtChar function. But I havent gotten past the sectorsleep problem.
An idea im going to try when I get home is make the "serv" run a P function instead, it could be that the NPC isnt firing LINK.P because he isnt awake, but if I can do a serv.link.p (I know thats not a correct command
) instead it might fire it even if the sector is asleep, and since P is just writing the coordinates of the NPC to a new location, not actually teleporting him, it should work.
Then with their "Home" changed at the same time to the same location, they should stay there.
An MMORPG based on the Ultima Online engine.
Completely Custom Map, GUI, AI, Combat, Skills, Crafts, Art, Music and so much more.
http://aetharia.com - Home of Ambition!