Spawn Point Woes
Posted: Sun Nov 09, 2008 12:34 pm
I'm trying to finish off my system for handling encounters generated on the scaled down travel map for 011 and have hit a wall, so could do with some fresh eyes looking at the scripts... The encounter system works fine in that any PC or party in a travel area is checked every minute or so and if an encounter is rolled they are moved to a "real" area where the encounter takes place. In the encounter area are two spawn points (day and night) that use group scripts to generate a random encounter from a table. So far so good. My problem is that I need to clean up after the encounter so that the next encounter re-rolls a new set of creatures.
At the moment I have a counter running that counts the number of PCs in the encounter area. When that counter hits 0 (ie all PCs have exited or been killed and moved to the morgue) I want the spawn points to reset. So I have an OnExit script that says:
Thanks,
Teric
At the moment I have a counter running that counts the number of PCs in the encounter area. When that counter hits 0 (ie all PCs have exited or been killed and moved to the morgue) I want the spawn points to reset. So I have an OnExit script that says:
So basically if when a PC exits the area and there are no more PCs left then "ACR_SetIsSpawnPointEnabled(oWP, 0, 1);" runs in order to reset the spawn points ready for the next encounter. I have the reverse of this running on the OnEnter script so that when the first PC enters the area the spawn points are turned on. Alas, this is not happening in that when you re-enter the encounter area the spawn from the previous encounter is still there. If anyone can see any errors in the above then I would appreciate some help in fixing it.////////////////////////////////////////////////////////////////////////////////
//
// System Name : ACR Configuration File
// Filename : acf_area_onexit.nss
// Version : 0.1
// Date : 7/25/06
// Author : Ronan
//
// Local Variable Prefix =
//
//
// Dependencies external of nwscript:
//
// Description
// This script calls the ACR's OnAreaExit code, and any custom code a server
// may need. It is not updated in ACR updates.
//
// Revision History
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// Includes ////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
#include "acr_area_i"
#include "acr_spawn_i"
////////////////////////////////////////////////////////////////////////////////
// Constants ///////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// Structures //////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// Global Variables ////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// Function Prototypes /////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// The main event handler.
void main();
////////////////////////////////////////////////////////////////////////////////
// Function Definitions ////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
void main() {
ACR_AreaOnExit();
// Custom code goes below this line.
object oExiter = GetExitingObject();
if (GetIsPC(oExiter) && !GetIsDM(oExiter))
{
int iPCCount = GetLocalInt(OBJECT_SELF, "sjc_PCCount");
iPCCount--;
string sPCCount = IntToString(iPCCount); //Debug
SendMessageToPC(GetFirstPC(), sPCCount); //Debug
SetLocalInt(OBJECT_SELF, "sjc_PCCount", iPCCount);
}
if (GetLocalInt(OBJECT_SELF, "sjc_PCCount") == 0)
{
object oArea = OBJECT_SELF;
object oWP = GetFirstObjectInArea(oArea);
while (GetIsObjectValid(oWP))
{
string sTag = GetTag(oWP);
if (sTag == "ACR_SPAWN_WP")
{ACR_SetIsSpawnPointEnabled(oWP, 0, 1);
}
object oWP = GetNextObjectInArea();
}
}
}
Thanks,
Teric