//:://////////////////////////////////////////////////////////////////////////// /*// Level 1a: Latrene 3 onHeartbeat script ra_lvl01a_onhb.nss Wandering Monsters: None 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 26) upon entering the level and every 2 minutes thereafter become Nauseated due to the overpowering smell. */// //:://////////////////////////////////////////////////////////////////////////// #include "prc_inc_spells" //:: Function to process the stench penalty void ApplySick(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 >= 15) { //:: Check if the character failed the save if (!FortitudeSave(oPC, 26)) { //:: Apply Nausea effect eNauseated = EffectNausea(oPC, 12.0f); effect eVFX = EffectVisualEffect(VFX_DUR_CESSATE_NEGATIVE); effect eLink = EffectLinkEffects(eNauseated, eVFX); eLink = SupernaturalEffect(eLink); eLink = TagEffect(eLink, "LatreneStench"); ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oPC, 12.0f); // 12 seconds = 2 in-game minutes. //:: Store the current time on player SetLocalInt(oPC, "LatreneFortSaveTime", newTime); if (RA_DEBUG) { SendMessageToPC(oPC, "Failed LatreneFortSave"); SendMessageToPC(oPC, "Setting LatreneFortSaveTime as " + IntToString(newTime)); } // Send a message to the player SendMessageToPC(oPC, "The overpowering stench is nauseating you."); } //:: Store the current time on player SetLocalInt(oPC, "LatreneFortSaveTime", newTime); if (RA_DEBUG) { SendMessageToPC(oPC, "Passed LatreneFortSave"); SendMessageToPC(oPC, "Setting LatreneFortSaveTime 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 1a Area HB"); } //:: Apply the stench ApplySick(oPC); } // Get the next object in the area oPC = GetNextObjectInArea(oArea); } }