97 lines
3.4 KiB
Plaintext
97 lines
3.4 KiB
Plaintext
//Script Name: onheartbeat
|
|
//////////////////////////////////////////
|
|
//Created By: Genisys (Guile)
|
|
//Created On: 4/20/08 (Updated 8/10/08)
|
|
/////////////////////////////////////////
|
|
/*
|
|
Some parts of this script were taken from
|
|
AW_Olorin's Paths of Ascension Module
|
|
This script goes in the OnHeartbeat
|
|
Event of the Module Properties
|
|
*/
|
|
////////////////////////////////////////
|
|
|
|
//Required Include
|
|
#include "nw_i0_tool"
|
|
|
|
//Main Script
|
|
void main()
|
|
{
|
|
|
|
ExecuteScript("prc_onheartbeat", OBJECT_SELF);
|
|
//IMPORTANT NOTE: If you are using nwnx2 to load your server you will
|
|
//want to open up the OnModuleLoad script to activate the NWNX2 Reset
|
|
//and below you will need to follow the directions to turn off normal reset.
|
|
|
|
object oPC = GetFirstPC();
|
|
|
|
while(GetIsObjectValid(oPC))
|
|
{
|
|
//This function stops trap setting in town. (or wherever you place the invisible
|
|
//object you will create tagnamed "nocrown" at./ located in the pallette)
|
|
object detector = GetNearestObjectByTag("nocrown", oPC, 0);
|
|
if (GetIsObjectValid(detector))
|
|
{
|
|
object trap = GetNearestTrapToObject(detector, FALSE);
|
|
if ( GetTrapCreator(trap) == oPC && !GetIsDM(oPC) && GetIsPC(oPC))
|
|
{
|
|
if (GetArea(oPC) != GetArea(GetObjectByTag("throneofdeath")))
|
|
{
|
|
AssignCommand(oPC, ClearAllActions());
|
|
AssignCommand(oPC, ActionJumpToLocation(GetLocation(GetWaypointByTag("prison"))));
|
|
SendMessageToPC(oPC, "You have been sent to jail for setting a trap in a restricted area.");
|
|
}
|
|
}
|
|
}
|
|
|
|
oPC = GetNextPC();
|
|
}
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
// /* <<Don't touch this
|
|
//Delete the // above this line to deactivate the normal reset function
|
|
//do this only if you are using nwnx2. (See "onmoduleload" script)
|
|
|
|
// Server reset check
|
|
/*
|
|
int timekeeper = GetLocalInt(GetModule(), "loadtimer");
|
|
SetLocalInt(GetModule(), "loadtimer", (timekeeper +1));
|
|
|
|
if (timekeeper >= 2300)
|
|
{
|
|
string time = IntToString(GetLocalInt(GetModule(), "loadtimer"));
|
|
WriteTimestampedLogEntry("Timekeeper = " + time);
|
|
//read the script named server_reset to gain an understanding of reset.
|
|
|
|
//DISABLED (Ran by the Module Time Keeper in town!)
|
|
|
|
//ExecuteScript("server_reset3",OBJECT_SELF);
|
|
}
|
|
|
|
// DM announcement check
|
|
//This feature isn't currently in Use, but DO NOT REMOVE IT!!!
|
|
int iAnnounceTimer = GetLocalInt(GetModule(),"iAnnounceTimer");
|
|
SetLocalInt(GetModule(), "iAnnounceTimer", (iAnnounceTimer +1) );
|
|
|
|
|
|
if(iAnnounceTimer >= GetLocalInt(GetModule(),"iAnnounce_Period"))
|
|
{
|
|
string sAnnouncement = GetLocalString(GetModule(),"Announcement");
|
|
string sAuthor = GetLocalString(GetModule(),"Announcement_Author");
|
|
SetLocalInt(GetModule(),"iAnnounceTimer",0);
|
|
if(sAnnouncement == "") return;
|
|
oPC = GetFirstPC();
|
|
while(GetIsObjectValid(oPC))
|
|
{
|
|
if(GetIsDM(oPC))
|
|
SendMessageToPC(oPC,"Module wide announcement being sent, created by DM " + sAuthor + ".");
|
|
SendMessageToPC(oPC,sAnnouncement);
|
|
oPC = GetNextPC();
|
|
}
|
|
}
|
|
// */
|
|
|
|
//Main Script End
|
|
}
|