Initial upload
Initial upload. PRC8 has been added. Module compiles, PRC's default AI & treasure scripts have been integrated. Started work on top hak for SLA / Ability / Scripting modifications.
This commit is contained in:
64
_module/nss/sc_rest.nss
Normal file
64
_module/nss/sc_rest.nss
Normal file
@@ -0,0 +1,64 @@
|
||||
//::///////////////////////////////////////////////
|
||||
//:: sc_rest
|
||||
//:: sc_rest
|
||||
//:://////////////////////////////////////////////
|
||||
/*
|
||||
*/
|
||||
//:://////////////////////////////////////////////
|
||||
//:: Created By:
|
||||
//:: Created On:
|
||||
//:://////////////////////////////////////////////
|
||||
|
||||
// Script limits player resting to once every 8 hours. The assumption here is
|
||||
// though, that every NWN month has 30 days. There is also a module variable DMRestOK checked,
|
||||
// which allows the GM to turn on unlimited resting.
|
||||
|
||||
void main()
|
||||
{
|
||||
if (GetLastRestEventType() == REST_EVENTTYPE_REST_STARTED)
|
||||
{
|
||||
object oPC = GetLastPCRested();
|
||||
int nLastRest = GetLocalInt(oPC, "LastRest");
|
||||
int nLastDay = GetLocalInt(oPC, "LastDay");
|
||||
int nHour = GetTimeHour();
|
||||
int nDay = GetCalendarDay();
|
||||
|
||||
// check to see if this is the very first time resting
|
||||
if (((nLastRest == 0) && (nLastDay == 0)) ||
|
||||
(GetLocalInt(GetModule(),"DMRestOK") == 1) ||
|
||||
(GetLocalInt(oPC,"DMRestOK") == 1))
|
||||
{
|
||||
SetLocalInt(oPC, "LastRest", nHour);
|
||||
SetLocalInt(oPC, "LastDay", nDay);
|
||||
SetLocalInt(oPC, "DMRestOK", 0);
|
||||
}
|
||||
|
||||
// check to see if it is the same day as the last rest
|
||||
else if (nDay == nLastDay)
|
||||
{
|
||||
if ((nHour - nLastRest) < 8)
|
||||
{
|
||||
AssignCommand(oPC, ClearAllActions());
|
||||
SendMessageToPC(oPC, "You may only rest once every eight hours.");
|
||||
}
|
||||
}
|
||||
// if not the same day, but it's just the next day
|
||||
else if (((nDay - nLastDay) == 1) || ((nDay - nLastDay) == -29))
|
||||
{
|
||||
if ((nLastRest - nHour) < 16)
|
||||
{
|
||||
AssignCommand(oPC, ClearAllActions());
|
||||
SendMessageToPC(oPC, "You may only rest once every eight hours.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SetLocalInt(oPC, "LastRest", nHour);
|
||||
SetLocalInt(oPC, "LastDay", nDay);
|
||||
SetLocalInt(oPC, "DMRestOK", 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user