//:://///////////////////////////////////////////// //:: Name Demetrious' Supply Based Rest //:: FileName SBR_onrest //::////////////////////////////////////////////// // http://nwvault.ign.com/Files/scripts/data/1055903555000.shtml /* This script belongs in the module level properties in the OnPlayerRest event script. Includes an alert to all DMs. */ //::////////////////////////////////////////////// //:: Created By: Demetrious //::////////////////////////////////////////////// //:: Credit to: Timo "Lord Gsox" Bischoff (NWN Nick: Kihon) //:: and the HCR team for the subroutines and effects //:: If not copied, at least I used their ideas. :) #include "prc_alterations" #include "sbr_include" void ApplySleepEffects(object oPC) { if (GetIsDM(oPC) || GetIsDMPossessed(oPC)) return; // Signal the module that a player is resting. SignalEvent(GetModule(), EventUserDefined(SBR_EVENT_REST)); LogMessage(LOG_DM_40, oPC, "Rest Alert: "+GetName(oPC) + " is resting."); SetLocalInt(oPC,SBR_RESTING,1); effect eSnore = EffectVisualEffect(VFX_IMP_SLEEP); ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eSnore, oPC, 7.0); //insert special effects here. I tried EffectSleep along with different //animations. They either get overrode by the rest anim or cancel the rest. ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eSnore, oPC, 7.0); FadeToBlack(oPC); SetPanelButtonFlash(oPC,PANEL_BUTTON_REST,0); } void RemoveSleepBlindness(object oPC) { FadeFromBlack(oPC); } // The main function placed in the onRest event void main() { // Script Settings (Variable Declaration) object oPC = GetLastPCRested(); object oArea = GetArea(oPC); int nLastRestType = GetLastRestEventType(); if (nLastRestType == REST_EVENTTYPE_REST_STARTED) { int Supplykit=FALSE; object oItem = GetFirstItemInInventory(oPC); while (GetIsObjectValid(oItem)) { if ((GetTag(oItem)==SBR_KIT_REGULAR)|| (GetTag(oItem)==SBR_KIT_WOODLAND)) { Supplykit =TRUE; break; } else { oItem = GetNextItemInInventory(oPC); } } // if you have supplies in your inventory - this is TRUE int n=1; string sTag; int SupplyNearby=FALSE; while (n<5) { switch (n) { case 1: sTag = "campingbedroll";break; case 2: sTag = "restfulbed";break; case 3: sTag = "restfulbedroll";break; case 4: sTag = "restfulcot";break; } object oN = GetNearestObjectByTag(sTag, oPC, 1); if (GetIsObjectValid(oN) && (GetDistanceBetween(oN, oPC)