![]() |
Trying to move NPCs at night to "go home", I blame sectorsleep. - Printable Version +- SphereCommunity (https://forum.spherecommunity.net) +-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d) +--- Forum: Script Help (/Forum-Script-Help) +--- Thread: Trying to move NPCs at night to "go home", I blame sectorsleep. (/Thread-Trying-to-move-NPCs-at-night-to-go-home-I-blame-sectorsleep) Pages: 1 2 |
Trying to move NPCs at night to "go home", I blame sectorsleep. - Rayvolution - 08-10-2012 02:47 PM 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] 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. ![]() RE: Trying to move NPCs at night to "go home", I blame sectorsleep. - Shaklaban - 08-10-2012 03:37 PM if there is no player in the area then you can just teleport it to its house, since no one is seeing the npc there is no difference between walking and teleporting. also you can try to use goto function: "GOTO" location Begins moving the NPC towards the specified location. RE: Trying to move NPCs at night to "go home", I blame sectorsleep. - Rayvolution - 08-10-2012 11:06 PM (08-10-2012 03:37 PM)Shaklaban Wrote: if there is no player in the area then you can just teleport it to its house, since no one is seeing the npc there is no difference between walking and teleporting. Tried GO, GOTO and P already. None of them will fire unless a player is near the NPC. :/ RE: Trying to move NPCs at night to "go home", I blame sectorsleep. - Extreme - 08-11-2012 12:32 AM If the sector sleep, they will do nothing... You can check if they must be in their home when the sector awake, them move them to their home. Or, if they must be in home, but near a player, they walk to home, using GOTO <HOME>. Thats a nice script, your server could be very good if you spent some time in. RE: Trying to move NPCs at night to "go home", I blame sectorsleep. - Rayvolution - 08-11-2012 02:10 AM Well, whats strange is LINK.P *should* work even if the sector is asleep, because that just tells the sphere on the server level to relocate the NPC to the new location, it shouldn't matter if it's current location is sleeping or not. It just rewrites the character's location in the save file to the new spot, so it *should* just magically appear where I tell it to. :/ RE: Trying to move NPCs at night to "go home", I blame sectorsleep. - Mordaunt - 08-11-2012 02:43 AM 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. RE: Trying to move NPCs at night to "go home", I blame sectorsleep. - Rayvolution - 08-11-2012 04:06 AM (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? 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 ![]() Then with their "Home" changed at the same time to the same location, they should stay there. RE: Trying to move NPCs at night to "go home", I blame sectorsleep. - Anarch Cassius - 08-11-2012 05:01 AM Mordaunt. @NPCLookatChar is NOT @NPCSeeNewPlayer as Rayvolution says. The big problem is that sleeping sectors don't have their NPCs move. They are supposed to be moving at a reduced ratio not never: If SECTORSLEEP is 10 then a NPC in a slept sector should be taking one step for every 10 an NPC would if the sector weren't asleep. This seems to work for everything but the movement and causes issues like this and NPCs being found clustered at spawn points. RE: Trying to move NPCs at night to "go home", I blame sectorsleep. - Rayvolution - 08-11-2012 05:37 AM (08-11-2012 05:01 AM)Anarch Cassius Wrote: Mordaunt. @NPCLookatChar is NOT @NPCSeeNewPlayer as Rayvolution says. Hrm, is there anyway to fix this or is it a hardcoded issue in 56b we're stuck with? I don't recall ever having that problem in 51a or 55i and my forests animals were all set to distance 0, with only 4-5 spawngems per large area of forest. It might not matter for my new server because I'm having region-specific animals and I can't let them roam free, so chances are I'll have a ton of spawns set to distance 40-50 this time around. But it still sounds like that could be a problem in certain situations. RE: Trying to move NPCs at night to "go home", I blame sectorsleep. - Extreme - 08-11-2012 06:34 AM Worked perfectly. Code: [EVENTS E_NPCHOMEATNIGHT] |