Questions about NPCs and PWs.
#1
Posté 03 juin 2012 - 11:33
(Pathways and professions) to Deva's NPC Activities 6.1. The issues I"m finding, and this is probably no news to you, is that NPCs don't operate very well when no PC is in the area, or not in the module at all.
Is there any workaround for this? I'd like to make a PW where the NPCs continue to move and perform their actions while no PC is present. How can I keep them performing as if a PC is present? I see come complex workarounds in Deva's Harvest of Souls, but there are other issues. Like when you save a game and reload it, the NPCs seem to continue to perform as if no PC is present.
The other possible option, if it is possible, is to basically freeze the module when the last PC logs out. Sort of like a module-wide Timestop. Any joining PC would be put in a holding area where Timestop has no influence until things are started moving again.
Any ideas? I"m moving on for now to an SP story where I don't have to worry about these things, but in the end would like to find a way to keep creatures moving when no PCs are on the server.
- Qlippoth
#2
Posté 03 juin 2012 - 11:52
The only suggestion I can make without looking at the scripts is to make sure the NPC's AI level is set to either AI_LEVEL_NORMAL or AI_LEVEL_HIGH. You may find that you just end up creating more lag then needed though.
#3
Posté 04 juin 2012 - 09:01
Any ideas for "freezing" a PW when no PCs are logged in? I know it sounds weird, just wondering.
#4
Posté 04 juin 2012 - 09:21
just place timestop effect on any placeable and remove it when its over, im using this long time ago and the server wont run any script at allQlippothVI wrote...
Thanks, I just didn't know what to look for and that gave me a place to start.
Any ideas for "freezing" a PW when no PCs are logged in? I know it sounds weird, just wondering.
there is a little issue if you are using mysql though
#5
Posté 04 juin 2012 - 11:02
What issues does this Timestop method cause such a module?
I'll have to figure out how to run Timestop when the last PC exits in every area but the Holding/Start area. I'm glad to know that this is possible, I have plans for a "Build an outpost" with wandering groups "entering and exiting" the module. I just have to work out the kinks when a PC isn't present and things get wonky... Mainly this is my lack of experience with scripting.
EDIT: Ooops, I was thinking of adding Timestop (area specific) to every area but one (start/re-enter). Are you talking about the module-wide timestop? So I could have a placable cast Timestop, halt everything in the module, then dismiss or expire the Timestop when a PC enters?
Modifié par QlippothVI, 04 juin 2012 - 11:26 .
#6
Posté 04 juin 2012 - 11:59
#7
Posté 05 juin 2012 - 07:06
yes this is module wide timestop, the issue with MySQL is that MySQL tent to shutdown when not used in specific ammount of time - to workaround it you must call some query each X hours.QlippothVI wrote...
EDIT: Ooops, I was thinking of adding Timestop (area specific) to every area but one (start/re-enter). Are you talking about the module-wide timestop? So I could have a placable cast Timestop, halt everything in the module, then dismiss or expire the Timestop when a PC enters?
If your PW is very populated then this isn't option for you anyway. Solution could be to despawn/spawn all NPCs when area is empty or kill them (with setdestroyable so they won't disappear) and resurect them after or to remove all scripts from them via NWNX.
well no delaycommands run, so time should be stopped as well but I never checked out actually so can't tell for surehenesua
#8
Posté 11 juin 2012 - 01:40
#9
Posté 11 juin 2012 - 01:54
#10
Posté 11 juin 2012 - 02:39
I suspect that the scripts that detect the lack of a PC for special NPC creature handling are not detecting a PC when a save game is loaded. Some pretty interesting handling of AI when little AI resources are availanble, I think he assigned them to the module? Loading a save game will display creatures that jump around the screen, even during combat with a PC present in the area/server. This doesn't occur at any other time. And if this is occuring with your own NPC followers you can tell them to stay put and then ask them to follow you again and things are fine, but only for them. You can't exactly do the same thing with hostil creatures that want to kill you.
I'm not sure a PC exists during the save game loading phase. I might be totally wrong, but it severely hampers the game (that can span HOURS/DAYS/ETC). Currently I run an XP virtual machine witha NWServer in VMWare Workstation, then suspend the VM for resuming it later. VERY handy, but not everyone have a beefy machine with a ton of RAM to throw at this issue like myself. I'd like to solve it in the module.
Otherwise I'm just knocking out some easy bugs, a typo here in a waypoint name, an additional script fix in a dialog, some pathing issues in the Drow Tileset, etc.
I have a few ideas for additional features, but want the bugfix release as a base for the feature expansion.
The next big issue is figuring out why the LootCorpse script doesn't work when no PC is present on a running server... The little fixes are still all worthy of an update to my unofficial bugfix release. I've had so much fun with it, and RTS/RPG/etc game with battling creatures running about the living module.
The two big issue are the save game gameplay sabotage and the fact that too many lootbags after a a day of playing start to bring the server to a halt, then an untimely demise... I was hoping Lootcorpse would work as well when no PC was present. PC ingame, it's all working. Log out and return and loot bags are all over... <_<
Anyway, the Timestop solution could allow the PC to exit the server, Timestop kicks in, then you save the game in stasis to resume later. Load save, log in, and the world resumes... Hopefully with all of the creatures never knowing the PC is missing and causing the bug (as is my theory anyway).
Modifié par QlippothVI, 11 juin 2012 - 02:48 .
#11
Posté 11 juin 2012 - 12:11
Call this in OnClientEnter:
void UnpauseModule()
{
object o = GetObjectByTag("SYSTEM_NPC");
if(GetIsObjectValid(o))
{
effect e = GetFirstEffect(o);
while(GetIsEffectValid(e))
{
if(GetEffectType(e) == EFFECT_TYPE_TIMESTOP)
{
PrintString(">> A player just logged in, exiting sleep mode. <<");
RemoveEffect(o,e);
}
e = GetNextEffect(o);
}
}
}
And call this in both OnModuleLoad and OnClientExit
void SleepMode()
{
if(GetFirstPC() == OBJECT_INVALID)
{
SetPersistentString(GetModule(),"PERSISTENT_TIME",GetTimeStamp());
PrintString(">> Last player exited game, entering sleep mode. <<");
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,EffectTimeStop(),GetObjectByTag("SYSTEM_NPC"),14400.0);
DelayCommand(0.1,SleepMode());
}
}
The SetPersistentString line is very important (at least if you using NWNX2), it doesnt matter what you will store, it might be any MySQL call afterall even 1+1. The purpose is to keep MySQL running - there is a known issue, when MySQL will shutdown if there are no calls within certain ammount of time. To compile it you need "aps_include", if you dont have it in your module than you can safely comment the line out.
Also you need system npc to create the timestop effect.
Modifié par ShaDoOoW, 11 juin 2012 - 12:13 .
#12
Posté 12 juin 2012 - 03:44
#13
Posté 18 juin 2012 - 04:09





Retour en haut






