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
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 786 - File: showthread.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/showthread.php 786 errorHandler->error






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: #1
Trying to move NPCs at night to "go home", I blame sectorsleep.
I am trying to force my NPCs to "go home" at night, and return to their stores in the daytime. I setup a basic test script attached to my test vendor's event, and the script works fine and WILL fire even if a player is not around, but the NPC won't move unless there is a player in the area.

I find it odd that the timer will still fire even if a player is no where in the area, but the NPC won't teleport/walk back to his home/store until after a player walks near the NPC.

The only thing I can think of, is the timer is still ticking when the sector is sleeping but the NPC himself won't move until the sector is woken up.

So, is there anyway to "wake up" a sector when the memory timer fires? Really, I'd like to disable sectorsleep entirely, but that doesn't seem like an option for some strange reason.

Code:
[EVENTS e_AI_Vendor]
ON=@NPCLookAtChar  //Just the initial first-time setup.
IF (<RESTEST i_mem_vendor_home>)
ELSE
   SERV.NEWITEM i_mem_vendor_home
   EQUIP <NEW>
   NEW.TIMER=5
ENDIF

[ITEMDEF i_mem_vendor_home]
ID=i_memory
NAME=Test
TYPE=t_eq_script
on=@equip
LINK=<SRC.UID>

on=@timer
if <sector.isdark>
LINK.SAY Time to go home! //Test-fire to make sure it works.
LINK.HOME 2537,2154,0 //Changes "Home" to his house, making him walk to or teleport to it.
ELSE
LINK.SAY Open the store!
LINK.HOME 2460,2062,0 //Same as above, for the store
ENDIF
TIMER=10 //reset the timer to check the area again.
RETURN 1

Note: I have tried using @EnvironChange, it won't work when a sector is sleeping. That's why I opted to use a timer instead. Smile

[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-10-2012 02:49 PM by Rayvolution.)
08-10-2012 02:47 PM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Messages In This Thread
Trying to move NPCs at night to "go home", I blame sectorsleep. - Rayvolution - 08-10-2012 02:47 PM

Forum Jump:


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