108 lines
3.4 KiB
Plaintext
108 lines
3.4 KiB
Plaintext
|
//::////////////////////////////////////////////////////////////////////////////
|
|||
|
/*//
|
|||
|
|
|||
|
Level 1: The Lair of the Dung Beast
|
|||
|
onHeartbeat script
|
|||
|
ra_lvl01_onhb.nss
|
|||
|
|
|||
|
Wandering Monsters: Check once per 30 minutes on 1d20.
|
|||
|
|
|||
|
Detections: Faint evil from the whole place; slightly more to the south east.
|
|||
|
|
|||
|
Continuous Effects: The stench of this level requires all characters to make
|
|||
|
a Fortitude save (DC 10) upon entering the level and every 30 minutes
|
|||
|
thereafter or all rolls are at –2 morale penalty due to the distraction
|
|||
|
caused by the overpowering smell.
|
|||
|
|
|||
|
*///
|
|||
|
//::////////////////////////////////////////////////////////////////////////////
|
|||
|
|
|||
|
|
|||
|
//:: Function to process the stench penalty
|
|||
|
void ApplyStench(object oPC)
|
|||
|
{
|
|||
|
int RA_DEBUG = 0;
|
|||
|
|
|||
|
//:: Check for exising variable on player
|
|||
|
int oldTime = GetLocalInt(oPC, "StenchFortSaveTime");
|
|||
|
|
|||
|
// Get the current system time in seconds
|
|||
|
int newTime = (GetTimeHour()*60*60)+(GetTimeMinute()*60)+GetTimeSecond();
|
|||
|
|
|||
|
// Calculate the time difference in seconds
|
|||
|
int timeDifference = newTime - oldTime;
|
|||
|
|
|||
|
if (RA_DEBUG)
|
|||
|
{
|
|||
|
SendMessageToPC(oPC, "oldTime = " + IntToString(oldTime));
|
|||
|
SendMessageToPC(oPC, "newTime = " + IntToString(newTime));
|
|||
|
SendMessageToPC(oPC, "timeDifference = " + IntToString(timeDifference));
|
|||
|
}
|
|||
|
|
|||
|
//:: Check if the character hasn't made a Fortitude save in the last 3 minutes
|
|||
|
if (oldTime == 0 || timeDifference >= 180) // 180 seconds = 3 real-time minutes
|
|||
|
{
|
|||
|
//:: Check if the character failed the save
|
|||
|
if (!FortitudeSave(oPC, 10))
|
|||
|
{
|
|||
|
//:: Apply a -2 morale penalty to all rolls
|
|||
|
effect eMoralePenalty = EffectAttackDecrease(2);
|
|||
|
effect eVFX = EffectVisualEffect(VFX_DUR_CESSATE_NEGATIVE);
|
|||
|
effect eLink = EffectLinkEffects(eMoralePenalty, eVFX);
|
|||
|
|
|||
|
eLink = SupernaturalEffect(eLink);
|
|||
|
eLink = TagEffect(eLink, "LvlOneStench");
|
|||
|
|
|||
|
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, "StenchFortSaveTime", newTime);
|
|||
|
|
|||
|
if (RA_DEBUG)
|
|||
|
{
|
|||
|
SendMessageToPC(oPC, "Failed StenchFortSave");
|
|||
|
SendMessageToPC(oPC, "Setting StenchFortSaveTime as " + IntToString(newTime));
|
|||
|
}
|
|||
|
|
|||
|
// Send a message to the player
|
|||
|
SendMessageToPC(oPC, "The overpowering stench is distracting you.");
|
|||
|
}
|
|||
|
|
|||
|
//:: Store the current time on player
|
|||
|
SetLocalInt(oPC, "StenchFortSaveTime", newTime);
|
|||
|
|
|||
|
if (RA_DEBUG)
|
|||
|
{
|
|||
|
SendMessageToPC(oPC, "Passed StenchFortSave");
|
|||
|
SendMessageToPC(oPC, "Setting StenchFortSaveTime as " + IntToString(newTime));
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
void main()
|
|||
|
{
|
|||
|
int RA_DEBUG = 0;
|
|||
|
|
|||
|
//:: 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 (RA_DEBUG)
|
|||
|
{
|
|||
|
SendMessageToPC(oPC, "Running Level 1 Area HB");
|
|||
|
}
|
|||
|
|
|||
|
//:: Apply the stench
|
|||
|
ApplyStench(oPC);
|
|||
|
}
|
|||
|
|
|||
|
// Get the next object in the area
|
|||
|
oPC = GetNextObjectInArea(oArea);
|
|||
|
}
|
|||
|
}
|
|||
|
|