UW2_PRC8/_module/nss/naptime.nss
Jaysyn904 5197ad9a4d Initial upload
Initial upload
2023-09-25 20:24:01 -04:00

67 lines
2.3 KiB
Plaintext

/*--------------------------------------------------------
Script Name: securedoorscript
----------------------------------------------------------
Created By: Genisys(Guile)
Created On: 4/9/09
----------------------------------------------------------
This script is executed from 2 places, first, the
OnClientEnter Event, and secondly, when the player
aquires the token tagnamed "napper", which is given by
a DM from a tagbased item script...
----------------------------------------------------------*/
void main()
{
object oPC = OBJECT_SELF;
int nNapTime = GetLocalInt(oPC, "NAP_TIME");
object oNapper = GetItemPossessedBy(oPC, "napper");
float fInt;
int nCut = GetCutsceneMode(oPC);
string sMsg = "My world is fading to black, I cannot see the world or hear it anymore!";
string sMsg2 = "You MUST complete the FULL 1 hour rest!";
string sMsg3 = "If you log out time starts all over again!";
//If it's a DM stop here!
if(GetIsDM(oPC) || GetIsDMPossessed(oPC))
{ return; }
//Note monsters can be put to sleep!(Though not like the sleep spell!)
if(nNapTime >=1)
{
nNapTime -=1;
fInt = IntToFloat(nNapTime)*60; //minutes to seconds...
SetLocalInt(oPC, "NAP_TIME", nNapTime);
//If not in cutscene already!
if(nCut==FALSE)
{
SetCutsceneMode(oPC, TRUE, FALSE);
SetCameraMode(oPC, CAMERA_MODE_STIFF_CHASE_CAMERA);
AssignCommand(oPC, ActionSpeakString(sMsg, TALKVOLUME_SHOUT));
AssignCommand(oPC, ActionPlayAnimation(ANIMATION_LOOPING_DEAD_FRONT,1.0, fInt));
FloatingTextStringOnCreature("Your character has been put to sleep by a DM for 1 Hour!", oPC, FALSE);
DelayCommand(1.2, FloatingTextStringOnCreature("Your character has been put to sleep by a DM for 1 Hour!", oPC, FALSE));
DelayCommand(2.4, FloatingTextStringOnCreature(sMsg2, oPC, FALSE));
DelayCommand(3.6, FloatingTextStringOnCreature(sMsg2, oPC, FALSE));
DelayCommand(4.8, FloatingTextStringOnCreature(sMsg3, oPC, FALSE));
DelayCommand(6.0, FloatingTextStringOnCreature(sMsg3, oPC, FALSE));
DelayCommand(10.0, FadeToBlack(oPC, FADE_SPEED_SLOW));
}
//After 60 seconds, run it again!
DelayCommand(60.0, ExecuteScript("naptime", oPC));
}
else
{
DelayCommand(2.0, SetCutsceneMode(oPC, FALSE));
FadeFromBlack(oPC, FADE_SPEED_SLOW);
SetCameraMode(oPC, CAMERA_MODE_TOP_DOWN);
DestroyObject(oNapper, 0.0f);
}
}