davidb
Senior Member
Posts: 300
|
Post by davidb on Oct 10, 2008 15:16:29 GMT -5
I have a concept question. Is it correct that when the last player exists a zone, it stops running in the server, so, when someone enters it again, it will be completely initialized? traps set again, all doors closed and locked, etc.
Or that only happens on a server reset?
Thanks in advance.
|
|
|
Post by otomotetsuo on Oct 10, 2008 15:36:56 GMT -5
davidb"Is it correct that when the last player exists a zone, it stops running in the server" If your question is "are all areas within the module active at all times or only when there are players in them?" Then that is a great question. Frankly I don't know the answer to that one yet. In a single player run game, it looks like all of the areas are loaded at once. I do not believe that is the case with MP. Unless the case is that the server then will load all of the areas, allowing the client to simply load one at a time. (This is all theory though, like I said, I don't know yet.) "so, when someone enters it again, it will be completely initialized? traps set again, all doors closed and locked, etc." Almost all of the scripting you will find in NWN/2 is object-oriented and event-driven as well. There is such a thing as an OnEnter event that allows a specified script to run each time something enters the area. Similarly there is an OnExit event and quite a few others. If one were to set up an OnEnter event that armed traps, locked doors, etc ... it could do so. But if your question was more along the lines of "Will the area naturally reset itself to its original state once everyone leaves it?" Then the answer is no. It takes special considerations to do things like reset traps, door locks, and cleanup remains, etc once a player has come through. "Or that only happens on a server reset?" A server reset will discard any changes that have been made after loading the module (this represents in-game changes). There are only a few exceptions to this and they are usually things like database entries that are stored outside of the module itself. HTH, -OT **EDIT** About OO. My apologies, I am not using OO as it is understood as an industry term. My intention was to suggest that it is object oriented in the sense that most of the events involve one object interacting with another - an object in this sense could be a creature, a placeable, an area or the module as a whole. It was not my intention to mislead or misclassify.
|
|
|
Post by CartMid on Oct 10, 2008 15:52:03 GMT -5
Hmmm so the scripts are OO and not procedural? I was pretty sure when I oppened it once on NWN1 that it was almost C. Anyone knows about a tutorial on scripting? I think I could help with it.
|
|
|
Post by DEV Driller on Oct 10, 2008 16:20:29 GMT -5
A correction, the scripting language is C like and is not OO.
Thanks, -driller
|
|
davidb
Senior Member
Posts: 300
|
Post by davidb on Oct 10, 2008 16:31:57 GMT -5
Thanks Otomo, that makes it harder, I think... as I believe the whole trap object is destroyed when it is disarmed, and CreateTrapAtLocation is not supported in NWN2, only in NWN1.
One of the things I try to do is traps that respawn after x time of being disarmed or triggered.
|
|
|
Post by loudent2 on Oct 10, 2008 16:47:46 GMT -5
The entire module is loaded into memory on the server. A client loads only one area at a time.
CreateTrapAtLocation exists for both NWN1 and NWN2. It was added a number of patches ago.
to answer the orginal question:
An empty zone, void of players, will not stop running. However, the priority of certain events there will be set low enough that they are only executed if the server has extra cycles to spare.
The zone will not, by default, "initialize itself" again once players return. That must be handled via scripting on the onenter and onexit events (or via HB or pseudo-HP)
|
|
davidb
Senior Member
Posts: 300
|
Post by davidb on Oct 10, 2008 17:54:42 GMT -5
Thanks loudent.
Is there a command I can place on OnExit that will completely reset the zone? (after checking noone is inside)
|
|
|
Post by loudent2 on Oct 10, 2008 18:18:11 GMT -5
Is there a command I can place on OnExit that will completely reset the zone? Not unless you write one (or one is supported by the spawn script, if any, that you use)
|
|
davidb
Senior Member
Posts: 300
|
Post by davidb on Oct 10, 2008 20:28:37 GMT -5
OK... thanks for all.
|
|
|
Post by otomotetsuo on Oct 10, 2008 20:38:37 GMT -5
davidbI am understanding your question to mean "Can we basically force a reload of the saved version of the area via in-game scripting?" This is a question that I would like to know the answer to as well. The "manual" scripting method to simulate an area "reset" would have to reference each of the individual points that you wanted refreshed. I worked on a trap-recreating system for NWN1 for a short time. The basic flowchart of the functions was: -OnEnter IsPC? (if no stop the script) (if yes check the timer) IsTimerExpired? (if no stop the script) (if yes spawn a trap at XYZ location or on object X, Y and Z) This is of course not NWScript and is a complete oversimplification of events. But is just to give you an idea of what is involved. -OT
|
|
|
Post by loudent2 on Oct 10, 2008 20:59:39 GMT -5
I assumed you guys are using a spawn system, but looked around and couldn't find details. How are you handling your creature/object spawning. The solution really depends on what's causing the problem
|
|
|
Post by otomotetsuo on Oct 10, 2008 21:34:50 GMT -5
Creature spawning is the mmorpg_spawner system. I am currently working on a sister system to that one for lootable spawning. The prototype is already finished. -OT
|
|
|
Post by loudent2 on Oct 10, 2008 22:09:13 GMT -5
Not familiar with the mmorpg_spawner system, but I would have to assume it has the ability to clean up it's spawns. If it doesn't, you might want to think about switching to a system that does.
I'm surprised that you'd have to write a seperate one for loot spawning. Why exactly did you guys go with this particular spawn system?
|
|
|
Post by otomotetsuo on Oct 10, 2008 22:36:22 GMT -5
This system does cleanup its spawns if you ask it to.
The reason for the sister project is simply because the base code was written to specifically deal with Creatures, not placeables or items. But the adaptation was relatively quick and painless.
What this system will offer us is a randomized positioning of lootable containers. We can control the potential spawn points, the maximum number of lootables to spawn, the spawn frequency and great control over which placeable is actually created. The settings can vary greatly from area to area and it is very simple.
-OT
|
|
davidb
Senior Member
Posts: 300
|
Post by davidb on Oct 11, 2008 6:36:46 GMT -5
Well, loot indeed must be separately spawned in a PW, to avoid any form of exploiting.
What I am doing to reset loot in chests is this:
// Generates 2 low treasure items, respawns content every hour #include "NW_O2_CONINCLUDE" void main() { float fDelay = 3600.0; if (GetLocalInt(OBJECT_SELF,"NW_DO_ONCE") != 0) { return; } object oLastOpener = GetLastOpener(); GenerateLowTreasure(oLastOpener, OBJECT_SELF); GenerateLowTreasure(oLastOpener, OBJECT_SELF); SetLocalInt(OBJECT_SELF,"NW_DO_ONCE",1); DelayCommand(fDelay,SetLocalInt(OBJECT_SELF,"NW_DO_ONCE",0)); }
Something like that should work, my only doubt is if DelayCommand is an efficient function or not.
|
|