UW2_PRC8/_module/nss/onheartbeat.nss
Jaysyn904 f69e979e53 Updated event system
Added caller scripts to the PC events.  Full compile.  Updated release.
2023-11-13 13:16:17 -05:00

76 lines
2.7 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 "x3_inc_horse"
//#include "nw_i0_tool"
//Main Script
void main()
{
//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();
}
/////////////////////////////////////////////////////////////[ MAIN ]///////////
//x3 Function!
oPC=GetFirstPC();
int nRoll;
int bNoCombat=GetLocalInt(GetModule(),"X3_NO_MOUNTED_COMBAT_FEAT");
while(GetIsObjectValid(oPC))
{ // PC traversal
if (GetLocalInt(oPC,"bX3_STORE_MOUNT_INFO"))
{ // store
DeleteLocalInt(oPC,"bX3_STORE_MOUNT_INFO");
HorseSaveToDatabase(oPC,X3_HORSE_DATABASE);
} // store
if (!bNoCombat&&GetHasFeat(FEAT_MOUNTED_COMBAT,oPC)&&HorseGetIsMounted(oPC))
{ // check for AC increase
nRoll=d20()+GetSkillRank(SKILL_RIDE,oPC);
nRoll=nRoll-10;
if (nRoll>4)
{ // ac increase
nRoll=nRoll/5;
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,EffectACIncrease(nRoll),oPC,7.0);
} // ac increase
} // check for AC increase
oPC=GetNextPC();
} // PC traversal
}
/////////////////////////////////////////////////////////////[ MAIN ]///////////