2024-04-07 01:06:57 -04:00
|
|
|
//::////////////////////////////////////////////////////////////////////////////
|
|
|
|
/*//
|
|
|
|
|
|
|
|
Labyrinth of Undeath
|
|
|
|
onHeartbeat script
|
|
|
|
labyrinth_hb.nss
|
|
|
|
|
|
|
|
Wandering Monsters: Check once per 30 minutes on 1d20.
|
|
|
|
|
|
|
|
Detections: Strong evil from the whole place.
|
|
|
|
|
|
|
|
Continuous Effects: The evil energy of the labyrinth makes all PC's
|
|
|
|
require a Will save or be cursed. This check occurs every half
|
|
|
|
hour and the curse vanishes if the PC leaves the area.
|
|
|
|
|
|
|
|
*///
|
|
|
|
//::////////////////////////////////////////////////////////////////////////////
|
|
|
|
#include "inc_debug"
|
2024-04-07 18:07:07 -04:00
|
|
|
#include "spawn_main"
|
2024-04-07 01:06:57 -04:00
|
|
|
|
|
|
|
//:: Function to process the curse
|
|
|
|
void ApplyCurse(object oPC)
|
|
|
|
{
|
|
|
|
//:: Check for exising variable on player
|
|
|
|
int oldTime = GetLocalInt(oPC, "CurseWillSaveTime");
|
|
|
|
|
2024-04-07 18:07:07 -04:00
|
|
|
//:: Get the current system time in seconds
|
2024-04-07 01:06:57 -04:00
|
|
|
int newTime = (GetTimeHour()*60*60)+(GetTimeMinute()*60)+GetTimeSecond();
|
|
|
|
|
2024-04-07 18:07:07 -04:00
|
|
|
//:: Calculate the time difference in seconds
|
2024-04-07 01:06:57 -04:00
|
|
|
int timeDifference = newTime - oldTime;
|
|
|
|
|
|
|
|
if (DEBUG)
|
|
|
|
{
|
|
|
|
SendMessageToPC(oPC, "oldTime = " + IntToString(oldTime));
|
|
|
|
SendMessageToPC(oPC, "newTime = " + IntToString(newTime));
|
|
|
|
SendMessageToPC(oPC, "timeDifference = " + IntToString(timeDifference));
|
|
|
|
}
|
|
|
|
|
2024-04-07 18:07:07 -04:00
|
|
|
//:: Check if the character hasn't made a Will save in the last 3 minutes
|
2024-04-07 01:06:57 -04:00
|
|
|
if (oldTime == 0 || timeDifference >= 180) // 180 seconds = 3 real-time minutes
|
|
|
|
{
|
|
|
|
//:: Check if the character failed the save
|
|
|
|
if (!WillSave(oPC, 20))
|
|
|
|
{
|
|
|
|
//:: Apply a curse
|
2024-04-07 18:07:07 -04:00
|
|
|
effect eCurse = EffectCurse(1, 1, 1, 1, 1, 1);
|
2024-04-07 01:06:57 -04:00
|
|
|
effect eVFX = EffectVisualEffect(VFX_DUR_CESSATE_NEGATIVE);
|
|
|
|
effect eVis = EffectVisualEffect(VFX_IMP_REDUCE_ABILITY_SCORE);
|
|
|
|
effect eLink = EffectLinkEffects(eCurse, eVFX);
|
2024-04-07 18:07:07 -04:00
|
|
|
|
|
|
|
eLink = EffectLinkEffects(eCurse, eVis);
|
2024-04-07 01:06:57 -04:00
|
|
|
eLink = SupernaturalEffect(eLink);
|
|
|
|
eLink = TagEffect(eLink, "LabyrinthCurse");
|
|
|
|
|
|
|
|
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oPC, 180.0f); // 180 seconds = 3 real-time minutes & .5 hours in-game.
|
|
|
|
|
|
|
|
//:: Store the current time on player
|
|
|
|
SetLocalInt(oPC, "CurseWillSaveTime", newTime);
|
|
|
|
|
|
|
|
if (DEBUG)
|
|
|
|
{
|
|
|
|
SendMessageToPC(oPC, "Failed CurseWillSave");
|
|
|
|
SendMessageToPC(oPC, "Setting CurseWillSaveTime as " + IntToString(newTime));
|
|
|
|
}
|
|
|
|
|
2024-04-07 18:07:07 -04:00
|
|
|
//:: Send a message to the player
|
2024-04-07 01:06:57 -04:00
|
|
|
SendMessageToPC(oPC, "The very air you breathe in this labyrinth is cursed.");
|
|
|
|
}
|
|
|
|
|
|
|
|
//:: Store the current time on player
|
|
|
|
SetLocalInt(oPC, "CurseWillSaveTime", newTime);
|
|
|
|
|
|
|
|
if (DEBUG)
|
|
|
|
{
|
|
|
|
SendMessageToPC(oPC, "Passed CurseWillSave");
|
|
|
|
SendMessageToPC(oPC, "Setting CurseWillSaveTime as " + IntToString(newTime));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
|
|
|
//:: Declare major variables
|
|
|
|
object oArea = OBJECT_SELF;
|
|
|
|
object oPC = GetFirstObjectInArea(oArea, OBJECT_TYPE_CREATURE);
|
|
|
|
|
|
|
|
while (GetIsObjectValid(oPC))
|
|
|
|
{
|
|
|
|
if (GetIsPC(oPC) || (GetMaster(oPC) != OBJECT_INVALID && GetIsPC(GetMaster(oPC))))
|
|
|
|
{
|
|
|
|
if (DEBUG)
|
|
|
|
{
|
|
|
|
SendMessageToPC(oPC, "Running Labyrinth of Undeath Area HB");
|
|
|
|
}
|
|
|
|
|
|
|
|
//:: Apply the curse
|
|
|
|
ApplyCurse(oPC);
|
|
|
|
}
|
|
|
|
|
2024-04-07 18:07:07 -04:00
|
|
|
//:: Get the next object in the area
|
2024-04-07 01:06:57 -04:00
|
|
|
oPC = GetNextObjectInArea(oArea);
|
|
|
|
}
|
|
|
|
}
|