//Optional Sun system. This one wont take as much cpu time as original. //This script loops as long as vampire is in same area and he is living. #include "vamp_checkarmor" //Get Module to get LocalInteger object oMod = GetModule(); void vamp_sundamage(object oPC) { // To what area he is coming. object oArea = GetLocalObject(oPC, "VampArea"); PrintString("vamp_sunsystem: vamp_sundamage() called for " + GetName(oPC) + " in "+GetName(oArea)+"."); // End scipt if object is not vampire // vampire is not anymore on same area or if vampire is dead. if (GetSubRace(oPC)!="Vampire" || GetArea(oPC) != oArea || GetIsDead(oPC) || GetIsAreaInterior(oArea)==TRUE || GetIsAreaAboveGround(oArea)==FALSE ) { PrintString("SUN HALT! vamp_sunsystem: vamp_sundamage() - " + GetName(oPC) + " is dead, not a vampire, not in "+GetName(GetLocalObject(oPC, "VampArea"))+" anymore, or "+GetName(oArea)+" does not apply to SunDamage."); // Sunsystem is no longer running. return; } string sItem = vamp_checkArmor(oPC); //If area is aboveground and sun is shining and oPC is vampire and vampire has on proper helmet/hood. Make vampire blind and give ability penalties. if (GetIsDay()==TRUE // if you don't include this next line, indoors can kill you if you add the script to on enter. && GetIsAreaInterior(oArea)==FALSE && GetIsAreaAboveGround(oArea)==TRUE //&& GetWeather(oArea)==WEATHER_CLEAR && GetSubRace(oPC)=="Vampire" && GetIsDead(oPC)==FALSE && (sItem == "Vamp")) { //Lets apply -2 to attack and saves. effect eAttack = EffectAttackDecrease(2); effect eSave = EffectSavingThrowDecrease(SAVING_THROW_ALL,2); effect eBlind = EffectBlindness(); effect eLink = EffectLinkEffects(eAttack,eSave); ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eLink,oPC,5.0f); ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eBlind,oPC,5.0f); } //If area is aboveground and sun is shining and oPC is vampire and vampire dont have helmet/hood. Deal some damage to vampire. if (GetIsDay()==TRUE // if you don't include this next line, indoors can kill you if you add the script to on enter. && GetIsAreaInterior(oArea)==FALSE && GetIsAreaAboveGround(oArea)==TRUE //&& GetWeather(oArea)==WEATHER_CLEAR && GetSubRace(oPC)=="Vampire" && GetIsDead(oPC)==FALSE && (GetItemInSlot(INVENTORY_SLOT_HEAD,oPC)==OBJECT_INVALID || sItem != "Vamp")) { //Lets apply -2 to attack and saves. effect eAttack = EffectAttackDecrease(2); effect eSave = EffectSavingThrowDecrease(SAVING_THROW_ALL,2); effect eBlind = EffectBlindness(); effect eLink = EffectLinkEffects(eAttack,eSave); ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eLink,oPC,5.0f); ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eBlind,oPC,5.0f); PrintString("SUN DAMAGE! vamp_sunsystem: vamp_sundamage() - " + GetName(oPC) + " - It is daytime, the area is above ground and a natural area, the weather is clear, the object's subclass is Vampire and they are not dead (yet) so they will take DAMAGE!"); //Is Sun system set to kill instant? //If yes kill vampire. if ( GetLocalInt(oMod, "iSunKillInstant")==1 ) { //And kills vampire. ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDeath(),oPC); //Applies death effect effect vDamage = EffectVisualEffect(VFX_IMP_SUNSTRIKE); ApplyEffectToObject(DURATION_TYPE_INSTANT,vDamage,oPC); } //If not do x damage. else { int iDamage = GetLocalInt(oMod, "iSunDamageX"); effect eDamage = EffectDamage(iDamage,DAMAGE_TYPE_MAGICAL,DAMAGE_POWER_NORMAL); ApplyEffectToObject(DURATION_TYPE_INSTANT,eDamage,oPC); effect eSunDamage = EffectVisualEffect(VFX_FNF_GAS_EXPLOSION_FIRE); ApplyEffectToObject(DURATION_TYPE_INSTANT,eSunDamage,oPC); } } // if they are not dead keep checking if (GetIsDead(oPC)!=TRUE) { DelayCommand(5.0f,vamp_sundamage(oPC)); } } void vamp_sunsystem(object oPC) { PrintString("SUN START: vamp_sunsystem: " + GetName(oPC) + "| Function called."); DelayCommand(5.4f, SetLocalObject(oPC, "VampArea", GetArea(oPC))); DelayCommand(5.5f, vamp_sundamage(oPC)); }