Added Mine & Caverns raise & lower functionality. Revamped Level 1 events to match PnP. Updated Level 1: Core. Added new Footcatcher trap type. Added Underwater heartbeat to Glop Lake Underwater. Full compile.
45 lines
1.7 KiB
Plaintext
45 lines
1.7 KiB
Plaintext
// Stench Area OnEnter Script - stench_onenter.nss
|
|
|
|
// Function to apply the stench penalty
|
|
void ApplyStenchPenalty(object oPC)
|
|
{
|
|
// Calculate the current time in minutes
|
|
int currentTime = GetTimeHour() * 60 + GetTimeMinute();
|
|
|
|
// Check if the character hasn't made a Fortitude save in the last 30 minutes
|
|
if (!GetLocalInt(oPC, "FortitudeSaveTime") || currentTime >= GetLocalInt(oPC, "FortitudeSaveTime") + 30)
|
|
{
|
|
// Roll a Fortitude save (DC 10)
|
|
int fortitudeSaveResult = FortitudeSave(oPC, 10, SAVING_THROW_TYPE_NONE, OBJECT_SELF);
|
|
|
|
// Check if the character failed the save
|
|
if (fortitudeSaveResult < 1)
|
|
{
|
|
// Apply a -2 morale penalty to all rolls
|
|
effect eMoralePenalty = EffectAttackDecrease(2, ATTACK_BONUS_MISC);
|
|
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eMoralePenalty, oPC, 90.0f); // 90 seconds = 3 real time minutes & .5 hours in game.
|
|
|
|
// Store the current time as the last Fortitude save time
|
|
SetLocalInt(oPC, "FortitudeSaveTime", currentTime);
|
|
|
|
// Send a message to the player
|
|
SendMessageToPC(oPC, "The overpowering stench distracts you, imposing a -2 morale penalty to your rolls for the next 30 minutes.");
|
|
}
|
|
}
|
|
}
|
|
|
|
void main()
|
|
{
|
|
// Get the entering object (usually a PC)
|
|
object oPC = GetEnteringObject();
|
|
|
|
// Check if the entering object is a valid creature and is a player character
|
|
if (GetIsObjectValid(oPC) && GetObjectType(oPC) == OBJECT_TYPE_CREATURE && GetIsPC(oPC))
|
|
{
|
|
// Start the periodic script to apply the stench penalty
|
|
ApplyStenchPenalty(oPC);
|
|
}
|
|
|
|
DelayCommand(90.0f, ExecuteScript("stench_onenter"));
|
|
}
|