The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Trying to move NPCs at night to "go home", I blame sectorsleep.
Author Message
Rayvolution
Journeyman
*

Posts: 135
Likes Given: 0
Likes Received: 2 in 2 posts
Joined: Jul 2012
Reputation: 1

Aetharia

Post: #7
RE: Trying to move NPCs at night to "go home", I blame sectorsleep.
(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 Tongue) 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.

[Image: 4_Logo.png]
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!
(This post was last modified: 08-11-2012 04:16 AM by Rayvolution.)
08-11-2012 04:06 AM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Trying to move NPCs at night to "go home", I blame sectorsleep. - Rayvolution - 08-11-2012 04:06 AM

Forum Jump:


User(s) browsing this thread: 2 Guest(s)