//////////////////////////////////////////////////////////////////////////////// // Olander's Realistic Systems - Area On Enter // opw_area_onenter // By Don Anderson // dandersonru@msn.com // // Place this in the Area On Enter Event // // See Builder's Guide on How to Set Up Each // //////////////////////////////////////////////////////////////////////////////// void main() { object oPC = GetEnteringObject(); object oMod = GetModule(); object oArea = GetArea(oPC); //Check for Permanent Lights int nRunOnce = GetLocalInt(oArea,"LIGHT_RUN_ONCE"); int nNth = 1; object oLight = GetNearestObjectByTag("PermLight",oPC,nNth); while(GetIsObjectValid(oLight) && nRunOnce == 0) { AssignCommand(oLight,PlayAnimation(ANIMATION_PLACEABLE_ACTIVATE)); DelayCommand(0.4,SetPlaceableIllumination(oLight, TRUE)); SetLocalInt(OBJECT_SELF,"NW_L_AMION",1); DelayCommand(0.5,RecomputeStaticLighting(oArea)); effect eLight = EffectVisualEffect(VFX_DUR_LIGHT_YELLOW_20); DelayCommand(1.0,ApplyEffectToObject(DURATION_TYPE_PERMANENT, eLight, oLight)); nNth++; oLight = GetNearestObjectByTag("PermLight",oPC,nNth); } SetLocalInt(oArea,"LIGHT_RUN_ONCE",1); //Check for Street Lights int nDayLit = GetLocalInt(oArea,"DAY_LIGHT"); int nNightLit = GetLocalInt(oArea,"NIGHT_LIGHT"); if(GetIsDusk() || GetIsNight()) { if(nNightLit == 0) { //Get All the Street Lights nNth = 1; object oSL = GetNearestObjectByTag("StreetLight",oPC,nNth); while(GetIsObjectValid(oSL)) { AssignCommand(oSL,ExecuteScript("opw_auto_lights",oSL)); nNth++; if(nNth > 2000) break;//Safety Measure oSL = GetObjectByTag("StreetLight",nNth); } } SetLocalInt(oArea,"DAY_LIGHT",0); SetLocalInt(oArea,"NIGHT_LIGHT",1); } if(GetIsDawn() || GetIsDay()) { if(nDayLit == 0) { //Get All the Street Lights nNth = 1; object oSL = GetNearestObjectByTag("StreetLight",oPC,nNth); while(GetIsObjectValid(oSL)) { AssignCommand(oSL,ExecuteScript("opw_auto_lights",oSL)); nNth++; if(nNth > 2000) break;//Safety Measure oSL = GetObjectByTag("StreetLight",nNth); } } SetLocalInt(oArea,"DAY_LIGHT",1); SetLocalInt(oArea,"NIGHT_LIGHT",0); } //Jumping and Climbing if(GetIsPC(oPC) || GetIsDMPossessed(oPC)) { //Jumping and Climbing Boots int nInterior = GetIsAreaInterior(oArea); if(nInterior == FALSE) { SetLocalInt(oPC,"ALLOWJUMP",1); SendMessageToPC(oPC,"This is an Outdoor Area. You can Climb or Jump using boots here."); return; } if(nInterior == TRUE) { SetLocalInt(oPC,"ALLOWJUMP",0); SendMessageToPC(oPC,"This is an Indoor Area. You can NOT Climb or Jump here."); return; } } }