Nepro Posted May 22, 2014 Posted May 22, 2014 Loading a save that was made while a VampireFeed AI package is running (That is to say, a vampire is walking over to a sleeping NPC to feed) will crash Oblivion. This plugin doesn't cause this, but it does make use of the VampireFeed function. It's unlikely to cause any trouble, but if you only keep one or two saves per character (Which is a very bad idea anyways) a lot of your game is liable to be lost. Spreading Vampire let you to make vampires by spreading the infection. You can turn vanilla NPCs into vampires. What script and at what line should I edit so the mod displays the message whenever the NPC vampire feeds on other npc? This would let me know when to not save the game. Perhaps even more fancy thing to edit was adding another message that given NPC finished feeding. LTDsvAttributesScript scn LTDsvAttributesScript Begin ScriptEffectStart if (GetItemCount LTDsvGovernor == 0) ;Just in case multiple NPCs of the same form exist. Better that all of them *behave* as vampires as well than they all have vampire-stats and only one behaves thus. AddItem LTDsvGovernor 1 endif end LTDsvBiteScript scn LTDsvBiteScript Begin ScriptEffectStart if (IsActor && IsCreature == 0) if (GetVampire == 0 && GetItemCount LTDsvGovernor == 0) if (GetDead == 0) if (GetKnockedState != 0 || GetSleeping) if (GetTotalActiveEffectMagnitude RSDI < 100) if (IsActorRespawning == 0 && HasLowLevelProcessing) if (IsEssential == 0) SetFactionRank LTDsvCureFaction -1 ;This faction will properly de-vampirise any beings in it. Removing them from the faction here for cured and infected-again ones. AddItem LTDsvGovernor 1 PlaySound NPCHumanVampireFeed set LTDsvQuest.TempSire to player ;The TempSire variable effects the vampire-to-be's behavior. If they like their sire, they'll become fanatically loyal. else message "The Nine will not allow this being to become a vampire." endif else message "This being's soul is too feeble to withstand vampirism." endif else message "This being is immune to disease." endif else message "Attempting to bite an aware and active being might be a bad idea." endif else message "Vampirism cannot bring people back from the dead." endif else message "This being is already a vampire." endif else message "Only humanoids can be turned into vampires." endif end LTDsvCureScript scn LTDsvCureScript float OldFatigue Begin ScriptEffectStart if (IsActor && IsCreature == 0) if (GetVampire) if (GetItemCount LTDsvGovernor > 0) set OldFatigue to (((GetAV Fatigue) * -1) - 200) ModAV2 fatigue OldFatigue SetFactionRank LTDsvCureFaction 0 else message "This being has been a vampire for too long, and cannot be cured with this power." endif else message "This being isn't a vampire." endif else message "This power only works on vampiric humanoids." endif end LTDsvFavouredFeedScript scn LTDsvFavouredFeedScript ref Biter ref self float RandomNumber Begin ScriptEffectStart set self to GetSelf set biter to LTDsvQuest.FavouredVampire ;Basic check to see if we have a potential vampire on our hands if (IsActor && IsCreature == 0 && IsEssential == 0 && IsActorRespawning == 0 && HasLowLevelProcessing && GetVampire == 0) if (HasMagicEffect RSDI == 0 || ( (GetRace == HighElf || GetRace == Argonian || GetRace == WoodElf || GetRace == Redguard) && GetTotalActiveEffectMagnitude RSDI <= 75) ) ;Feeding can't turn beings resistent to disease. Lots of races start with Resist Disease 75, though, so they need special treatment, set RandomNumber to GetRandomPercent if (biter.GetDisposition self >= 70) set RandomNumber to RandomNumber + 30 endif if (RandomNumber >= 90) if (self != player) ;Can't very well turn the *player* into a vampire by these methods set LTDsvQuest.TempSire to biter ;The combat will end if the favoured's target becomes a vampire as well. ModDisposition biter 100 if (IsInCombat && GetCombatTarget == biter) StopCombat endif biter.ModDisposition self 100 biter.StopCombat AddItem LTDsvGovernor 1 else AddSpell VampDisease endif endif endif set LTDsvQuest.FavouredFed to 1 elseif (IsActor && GetVampire == 0) set LTDsvQuest.FavouredFed to 1 endif end LTDsvGovernorScript scn LTDsvGovernorScript ;TODO: Remove ShelterStopper. ref VampSelf ref OldVampSelf ref sire ref CurrentWeather ref victim short DoOnce float SearchTimer float OldAggression float BaseAggression float BaseResponsibility short EVPTimer short SearchDelay float FeedTimer1 float FeedTimer2 short RandomInfection short UnconsciousDefense float FeedingAngle ref ShelterCell float ShelterX float ShelterY float ShelterZ short ShelterType short ShelterMode short VampireLocation float VictimX float OldVictimX float VictimY float OldVictimY float VictimZ float OldVictimZ ref HuntCell float HuntX float HuntY float HuntZ short HuntMode short VampState short IsLoyal short HasVampireDust short LastFedDay short LastCheckedDay Begin GameMode set VampSelf to GetContainer if (VampSelf.IsActor && VampSelf.IsCreature == 0 && (OldVampSelf == 0 || VampSelf == OldVampSelf) && VampSelf.GetDead == 0) ;It might cause trouble to run this script on anything other than the original victim. set OldVampSelf to VampSelf ;For removing vampirism safely, and if, say, someone uses inventory sharing to keep track of the original vampire. if (DoOnce == 0) ;Initiate vampirism VampSelf.AddSpell LTDsvAttributes VampSelf.AddSpell LTDsvEmbraceofShadows if (VampSelf.GetSleeping) VampSelf.AddItem LTDsvNightmare 1 ;LTDsvNightmare, as well as showing if the new vampire has woken up yet for certain parts of this script, changes his sleeping animation. endif set OldAggression to VampSelf.GetAV aggression VampSelf.SetAV vampirism 1 ;They don't assume full vampiric appearance until they've had some time and loaded again. This changes the eyes and allows VampireFeeding. set LastFedDay to (GameDaysPassed - 1) set LastCheckedDay to GameDaysPassed set sire to LTDsvQuest.TempSire if (sire) ;Not sure what would happen if it tried to check a nonexistant being's disposition. if (VampSelf.GetDisposition sire >= 70 || (sire == player && VampSelf.GetInFaction PlayerFaction == 1) ) ;If the new vampire's disposition towards their sire is 70 or more, or they're otherwise a friend of the player (who turned them)... set IsLoyal to 1 if (sire == player) VampSelf.AddItem LTDsvOrders 1 ;If they have any number of "Orders" items, it means they're loyal to the player. If they have 2 it means follow, and 3 means wait. if (VampSelf.GetAV Aggression <= 5) VampSelf.SetAV Aggression 6 endif endif endif endif set LTDsvQuest.TempSire to 0 VampSelf.SetFactionRank VampireFaction 0 set BaseAggression to VampSelf.GetAV Aggression set BaseResponsibility to VampSelf.GetAV responsibility VampSelf.SetAV responsibility 0 ;These vampires don't "do" responsibility. For one thing, they'd be screaming about the assault when a fellow vampire feeds. set DoOnce to 1 endif ;"Loyal" vampires always remain at maximum disposition towards the one who turned them. if (IsLoyal) if (VampSelf.GetDisposition sire < 100) VampSelf.ModDisposition sire 100 endif endif ;Gotta give vampires the benefit of the doubt on their ability to find blood. Can't have it so, if the player leaves for a few days, they go crazy. if (LastCheckedDay < (GameDaysPassed - 1) ) set LastFedDay to (GameDaysPassed - 1) set LastCheckedDay to (GameDaysPassed - 1) endif ;Checking to see if this vampire is favoured, and the Combat Feeding spell that favoureds get has been used. if (LTDsvQuest.FavouredFed == 1) set LastFedDay to GameDaysPassed set LTDsvQuest.FavouredFed to 0 endif if (VampSelf.GetItemCount LTDsvNightmare == 1 && (VampSelf.GetSleeping == 0 || LastFedDay != GameDaysPassed - 1) ) VampSelf.RemoveItem LTDsvNightmare 1 ;Vampires will normally hunt instead of sleeping. This is to make sure they don't wake up right after the player transforms them. endif ;After one day without blood they'll look for feeding opportunities, and their aggression will go through the roof after three. if (LastFedDay < GameDaysPassed) if (LastFedDay < (GameDaysPassed - 2) && VampState != 2) set VampState to 2 ; VampSelf.SetAV aggression 99 elseif (VampState != 1) if (VampState == 2) VampSelf.SetAV aggression BaseAggression endif set VampState to 1 endif elseif (VampState != 0) if (VampState == 2) VampSelf.SetAV aggression BaseAggression endif set VampState to 0 endif if (VampSelf.GetInSameCell player) set LastCheckedDay to GameDaysPassed endif if (VampSelf.IsInInterior || GetCurrentTime < 6 || GetCurrentTime >= 20) ;If the vampire isn't in the sunlight ;If Shelter Mode is on and it's night time, turn it off. if (ShelterMode == 1) if (GetCurrentTime < 6 || GetCurrentTime >= 20) ;If the vampire was sheltering during the day, they can exit "Shelter Mode" if ordered to by the player or when night falls. set ShelterMode to 0 VampSelf.RemoveScriptPackage VampSelf.evp endif endif ;If Hunt Mode is on and it's day time, turn it off. Shouldn't happen all that often, since it also gets turned off by being caught outside in the sun... ;And "outside" is usually where the vampire will be if he's hunting. if (HuntMode == 1) if (GetCurrentTime >= 6 && GetCurrentTime < 21) set HuntMode to 0 VampSelf.RemoveScriptPackage VampSelf.evp endif endif if (VampSelf.IsInInterior) set ShelterCell to VampSelf.GetParentCell set ShelterX to VampSelf.GetPos X set ShelterY to VampSelf.GetPos Y set ShelterZ to VampSelf.GetPos Z ;This batch of variables shows the vampire a "safe" interior location if they get caught in the sunlight. set ShelterType to 1 else if (GetInSameCell player) set ShelterType to 0 else set ShelterType to 1 endif ;ShelterType will, when the vampire does get caught in the sunlight, show if it turned to sunlight while the player/vampire was there or not. ;If it turned to sunlight while the vampire and player were there, it's possible the player saw the vampire, and they need to flee realistically. set HuntCell to LTDsvHuntMarker.GetParentCell if (VampSelf.GetParentCell != HuntCell) LTDsvHuntMarker.MoveTo VampSelf endif set HuntCell to VampSelf.GetParentCell set HuntX to VampSelf.GetPos x set HuntY to VampSelf.GetPos y set HuntZ to VampSelf.GetPos z ;Working on a similar principle to the Shelter Markers and Cells, if they're in a potential hunting location, save it as a marker and co-orindates. endif if (VampSelf.GetItemCount LTDsvOrders > 1) ;LTDsvOrders is an "invisible" clothing item designed to keep track of the player's orders for a loyal vampire. ;If the vampire has one of the "orders", they should follow the player. If they have two, they should wait at their current location. if (VampSelf.GetCurrentAIPackage != 27 && LTDsvQuest.searcher != VampSelf) if (VampSelf.IsInCombat) ;For some reason, checking if IsInCombat is 0 instead seems to cause trouble... ;Feeding/combat behavior takes priority over keeping up with the player or staying put. ;Well... Ideally combat behavior. Getting it to work properly is being a bastard. elseif (VampSelf.GetItemCount LTDsvOrders == 2 && VampSelf.GetIsCurrentPackage LTDsvFollow == 0) VampSelf.RemoveScriptPackage VampSelf.AddScriptPackage LTDsvFollow VampSelf.evp elseif (VampSelf.GetItemCount LTDsvOrders == 3 && VampSelf.GetIsCurrentPackage LTDsvWait == 0) VampSelf.RemoveScriptPackage VampSelf.AddScriptPackage LTDsvWait vampself.evp endif endif elseif (VampSelf.GetIsCurrentPackage LTDsvFollow || VampSelf.GetIsCurrentPackage LTDsvWait) VampSelf.RemoveScriptPackage elseif (ShelterMode == 1 && VampSelf.GetIsCurrentPackage LTDsvShelter == 0) VampSelf.RemoveScriptPackage VampSelf.AddScriptPackage LTDsvShelter VampSelf.evp elseif ( (VampSelf.GetCurrentAIPackage == 4 || HuntMode == 1 || VampSelf.GetIsCurrentPackage LTDsvShelter) && (GetCurrentTime < 6 || GetCurrentTime >= 20) && VampSelf.GetItemCount LTDsvNightmare == 0 ) ;AI package 4 is for sleeping. This checks if the vampire is currently hunting or sleeping at night, and has yet awakened as a vampire. if (VampSelf.GetInCell Anvil) ;Specific cities get the first check. Not the Imperial City, since it's so big/densely populated. Best to let vampires find their own way there. if (VampSelf.GetIsCurrentPackage LTDsvHuntAnvil == 0) VampSelf.RemoveScriptPackage VampSelf.AddScriptPackage LTDsvHuntAnvil VampSelf.evp endif elseif (VampSelf.GetInCell Bravil) if (VampSelf.GetIsCurrentPackage LTDsvHuntBravil == 0) VampSelf.RemoveScriptPackage VampSelf.AddScriptPackage LTDsvHuntBravil VampSelf.evp endif elseif (VampSelf.GetInCell Bruma) if (VampSelf.GetIsCurrentPackage LTDsvHuntBruma == 0) VampSelf.RemoveScriptPackage VampSelf.AddScriptPackage LTDsvHuntBruma VampSelf.evp endif elseif (VampSelf.GetInCell Cheydinhal) if (VampSelf.GetIsCurrentPackage LTDsvHuntCheydinhal == 0) VampSelf.RemoveScriptPackage VampSelf.AddScriptPackage LTDsvHuntCheydinhal VampSelf.evp endif elseif (VampSelf.GetInCell Chorrol) if (VampSelf.GetIsCurrentPackage LTDsvHuntChorrol == 0) VampSelf.RemoveScriptPackage VampSelf.AddScriptPackage LTDsvHuntChorrol VampSelf.evp endif elseif (VampSelf.GetInCell Leyawiin) if (VampSelf.GetIsCurrentPackage LTDsvHuntLeyawiin == 0) VampSelf.RemoveScriptPackage VampSelf.AddScriptPackage LTDsvHuntLeyawiin VampSelf.evp endif elseif (VampSelf.GetInCell Skingrad) if (VampSelf.GetIsCurrentPackage LTDsvHuntSkingrad == 0) VampSelf.RemoveScriptPackage VampSelf.AddScriptPackage LTDsvHuntSkingrad VampSelf.evp endif elseif (HuntCell) ;If the vampire has registered a hunting cell... This check comes second, since it can cause trouble with the player watching. if (VampSelf.IsInInterior && player.GetInSameCell VampSelf == 0) ;If there's no risk of the vampire vanishing into thin air when the player is watching... if (VampSelf.GetIsCurrentPackage LTDsvShelter) ;Gotta restart the shetler package so our vampire doesn't try to walk back. VampSelf.RemoveScriptPackage endif VampSelf.PositionCell HuntX, HuntY, HuntZ, 0, HuntCell if (VampSelf.GetIsCurrentPackage LTDsvShelter == 0) VampSelf.RemoveScriptPackage VampSelf.AddScriptPackage LTDsvShelter VampSelf.evp endif else if (VampSelf.IsInInterior) ;If the vampire is at risk of being seen by the player during the teleport, move the marker and have them walk out orderly-like. if (LTDsvHuntMarker.GetParentCell != HuntCell) LTDsvHuntMarker.PositionCell HuntX, HuntY, HuntZ, 0, HuntCell endif if (VampSelf.GetIsCurrentPackage LTDsvHunt == 0) VampSelf.RemoveScriptPackage VampSelf.AddScriptPackage LTDsvHunt VampSelf.evp endif elseif (VampSelf.GetIsCurrentPackage LTDsvShelter == 0) VampSelf.RemoveScriptPackage VampSelf.AddScriptPackage LTDsvShelter VampSelf.evp endif endif elseif (LTDsvHuntMarker.GetParentCell != LTDsvHoldingPen) ;Any new references I use start off in a holding pen. If it's moved, that means a different vampire has found an exterior cell to hunt in. if (VampSelf.GetIsCurrentPackage LTDsvHunt == 0) VampSelf.RemoveScriptPackage VampSelf.AddScriptPackage LTDsvHunt VampSelf.evp endif elseif (VampSelf.GetIsCurrentPackage LTDsvShelter == 0) VampSelf.RemoveScriptPackage VampSelf.AddScriptPackage LTDsvShelter VampSelf.evp endif if (HuntMode == 0) set HuntMode to 1 endif endif elseif (VampSelf.GetIsCurrentPackage LTDsvShelter2 == 0) set HuntMode to 0 set HuntCell to LTDsvHuntMarker.GetParentCell if (VampSelf.GetParentCell != HuntCell) LTDsvHuntMarker.MoveTo VampSelf endif if (VampSelf.GetItemCount LTDsvOrders == 3) VampSelf.RemoveItem LTDsvOrders 2 elseif (VampSelf.GetItemCount LTDsvOrders == 2) VampSelf.RemoveItem LTDsvOrders 1 endif if (VampSelf.GetIsCurrentPackage LTDsvFollow || VampSelf.GetIsCurrentPackage LTDsvWait) VampSelf.RemoveScriptPackage endif if (ShelterCell) ;If the vampire has previously memorized a safe location to hide from the sunlight... set ShelterMode to 1 ;This will make the vampire wander about when they find shelter, instead of just walking back out. if (ShelterType == 1 || GetInSameCell player == 0) ;If the player/vampire is just entering the sunlit cell, we can just move the vampire to safety. VampSelf.PositionCell ShelterX, ShelterY, ShelterZ, 0, ShelterCell VampSelf.RemoveScriptPackage VampSelf.AddScriptPackage LTDsvShelter vampself.evp ;PositionCell is a pain, but since multiple vampires have to be reliant on these variables, I don't want to use MoveTo unless I have to. elseif (VampSelf.GetIsCurrentPackage LTDsvShelter2 == 0) LTDsvShelterMarker.PositionCell ShelterX, ShelterY, ShelterZ, 0, ShelterCell if (LTDsvShelterMarker.GetParentCell == ShelterCell) VampSelf.RemoveScriptPackage VampSelf.AddScriptPackage LTDsvShelter2 vampself.evp endif endif elseif (VampSelf.GetIsCurrentPackage LTDsvPanic == 0) ;Vampires who haven't memorized a shelter will first check to see if any other vampires "marked" one for fleeing. If so, they'll head there. if (LTDsvShelterMarker.GetParentCell != LTDsvHoldingPen) VampSelf.RemoveScriptPackage VampSelf.AddScriptPackage LTDsvShelter2 else ;Failing that, they'll just panic. VampSelf.RemoveScriptPackage VampSelf.AddScriptPackage LTDsvPanic VampSelf.evp endif endif endif if (GetFactionRank LTDsvFeedingFaction != -1 && LTDsvQuest.searcher != VampSelf) ;If a vampire was left off corpse-feeding and, due to an anomaly, didn't "finish" properly... VampSelf.SetRestrained 0 VampSelf.SetFactionRank LTDsvFeedingFaction -1 set UnconsciousDefense to 0 endif ;After fifty frames go by on a thirsty vampire, if no other vampires are searching or feeding.. if ( (VampState > 0 || LTDsvQuest.searcher == VampSelf) && VampSelf.GetSleeping == 0) if (LTDsvQuest.searcher == VampSelf && LTDsvQuest.FeedVictim == 0) if (SearchDelay <= 0) set LTDsvQuest.searcher to 0 if (GetFactionRank LTDsvFeedingFaction != -1) VampSelf.SetRestrained 0 VampSelf.SetFactionRank LTDsvFeedingFaction -1 set UnconsciousDefense to 0 endif else set SearchDelay to SearchDelay - 1 endif endif if (SearchTimer < 150 ) set SearchTimer to SearchTimer + 1 elseif (LTDsvQuest.searcher == 0 && VampSelf.GetKnockedState == 0 && LTDsvQuest.SearcherDetected == 0) set LTDsvQuest.searcher to VampSelf LTDsvCaster.MoveTo VampSelf 0, 0, 30 LTDsvCaster.cast LTDsvSearch VampSelf set SearchTimer to 0 set SearchDelay to 10 set FeedTimer1 to 50 set FeedTimer2 to 0 VampSelf.SetFactionRank LTDsvFeedingFaction -1 set LTDsvQuest.ResetSearcher to 1 ;Only one vampire can be searching/feeding at a time, since this is dependent on quest/ref variables. If no meal is found, searcher will ;change back to 0 next quest-tick. ;LTDsvSearch is an AoE spell that checks for sleeping victims and fresh corpses. Since the searcher was passed to the quest, it ;can be known who to "give" a potential victim to. endif if (LTDsvQuest.searcher == VampSelf) if (LTDsvQuest.FeedVictim != 0) ;^Should be the case any time Searcher also has a value. set victim to LTDsvQuest.FeedVictim if (victim.GetSleeping && VampSelf.GetCurrentAIPackage == 27) ;27 is the Vampire Feeding package. if (LTDsvQuest.SearcherDetected != 0 && VampState != 2) ;If the vampire is being watched by a non-vampire and not crazed with thirst, abort feeding. VampSelf.evp set SearchTimer to 0 endif if (SearchTimer < 50) set SearchTimer to SearchTimer + 1 else LTDsvCaster.MoveTo VampSelf 0, 0, 30 LTDsvCaster.cast LTDsvSearch VampSelf set SearchTimer to 0 endif if (VampSelf.GetDistance victim < 200) set LastFedDay to GameDaysPassed set LTDsvQuest.searcher to 0 set LTDsvQuest.FeedVictim to 0 ; VampSelf.SetForceSneak 0 if (victim.IsEssential == 0 && victim.IsActorRespawning == 0 && victim.HasLowLevelProcessing) ;Checking to see if the potential vampire would cause trouble as one. if (victim.HasMagicEffect RSDI == 0 || ( (victim.GetRace == HighElf || victim.GetRace == Argonian || victim.GetRace == WoodElf || victim.GetRace == Redguard) && victim.GetTotalActiveEffectMagnitude RSDI <= 75) ) ;Feeding can't turn beings resistent to disease. Altmer still should need a boost to avoid it, though, and start with 75% Resist. ;If the vampire likes their victim, they might decide to purposefully pass vampirism on. Otherwise, it's less likely they get turned. set RandomInfection to GetRandomPercent if (VampSelf.GetDisposition victim >= 70) set RandomInfection to RandomInfection + 30 endif if (RandomInfection >= 90) set LTDsvQuest.TempSire to VampSelf victim.AddItem LTDsvGovernor 1 endif endif endif endif elseif (victim.GetDead && FeedTimer1 >= -400 && (VampState == 2 || LTDsvQuest.SearcherDetected == 0) ) if (FeedTimer2 == 0 && VampSelf.IsInCombat == 0) set VictimX to victim.GetPos X set VictimY to victim.GetPos Y set VictimZ to victim.GetPos Z ;Recording the victim's current location, to compare it againt their location last frame. Gotta wait until the victim is still to feed. if (VictimX == OldVictimX && VictimY == OldVictimY && VictimZ == OldVictimZ) VampSelf.MoveTo victim 0, 80, 10 set FeedTimer2 to 180 else set OldVictimX to VictimX set OldVictimY to VictimY set OldVictimZ to VictimZ set FeedTimer1 to FeedTimer1 - 1 endif elseif (Feedtimer2 > 0) if (FeedTimer2 == 180) ;A special idle animation was made off one of the VampireFeed animations. Its condition is being in LTDsvFeedingFaction. ;The vampire will be restrained and join the faction. ;Five frames later, the vampire will perform an idle animation. Since he's in the feeding faction, it will be the feeding animation. ;174 frames later, about the time the animation finishes, the vampire leaves the faction and is no longer restrained. set FeedingAngle to (VampSelf.GetAngle z) + (VampSelf.GetHeadingAngle victim) VampSelf.SetAngle z FeedingAngle VampSelf.SetRestrained 1 VampSelf.SetFactionRank LTDsvFeedingFaction 0 elseif (FeedTimer2 == 175) VampSelf.PickIdle set LastFedDay to GameDaysPassed elseif (FeedTimer2 ==1) VampSelf.SetFactionRank LTDsvFeedingFaction -1 VampSelf.SetRestrained 0 set LTDsvQuest.searcher to 0 set LTDsvQuest.FeedVictim to 0 endif set FeedTimer2 to FeedTimer2 - 1 endif elseif (FeedTimer1 <= 0) ;No luck feeding. Reset so more searches can be made. set LTDsvQuest.Searcher to 0 set LTDsvQuest.FeedVictim to 0 if (GetFactionRank LTDsvFeedingFaction != -1) VampSelf.SetRestrained 0 VampSelf.SetFactionRank LTDsvFeedingFaction -1 set UnconsciousDefense to 0 endif else set FeedTimer1 to FeedTimer1 - 1 endif endif else if (GetFactionRank LTDsvFeedingFaction != -1) VampSelf.SetRestrained 0 VampSelf.SetFactionRank LTDsvFeedingFaction -1 set UnconsciousDefense to 0 endif ; if (LTDsvQuest.ShouldForceSneak == 0) ; VampSelf.SetForceSneak 0 ; endif endif endif if (VampSelf.GetFactionRank LTDsvCureFaction != -1) ;De-Vampirise VampSelf.RemoveScriptPackage VampSelf.RemoveItem LTDsvOrders 3 VampSelf.RemoveSpell LTDsvAttributes VampSelf.RemoveSpell LTDsvEmbraceOfShadows VampSelf.SetAV responsibility BaseResponsibility VampSelf.SetFactionRank VampireFaction -1 VampSelf.SetFactionRank LTDsvFeedingFaction -1 VampSelf.SetAV aggression OldAggression VampSelf.SetAV vampirism 0 VampSelf.RemoveItem LTDsvNightmare 1 if (LTDsvQuest.FavouredVampire == VampSelf) set LTDsvQuest.FavouredVampire to 0 endif RemoveMe endif elseif (VampSelf.GetDead) if (HasVampireDust != 5) ;Checking if HasVampireDust is 0 doesn't work for some reason. If the vampire dies, this will give them vampire dust. VampSelf.AddItem VampireDust 1 set HasVampireDust to 5 endif elseif (VampSelf == 0) disable endif end Begin OnDrop ;De-Vampirise OldVampSelf.RemoveScriptPackage OldVampSelf.RemoveItem LTDsvOrders 3 OldVampSelf.RemoveSpell LTDsvAttributes OldVampSelf.RemoveSpell LTDsvEmbraceOfShadows OldVampSelf.SetAV responsibility BaseResponsibility OldVampSelf.SetFactionRank VampireFaction -1 OldVampSelf.SetFactionRank LTDsvFeedingFaction -1 OldVampSelf.SetAV aggression OldAggression OldVampSelf.SetAV vampirism 0 OldVampSelf.RemoveItem LTDsvNightmare 1 if (LTDsvQuest.FavouredVampire == OldVampSelf) set LTDsvQuest.FavouredVampire to 0 endif end LTDsvInventoryScript scn LTDsvInventoryScript short timer ref tradee Begin ScriptEffectUpdate set tradee to LTDsvQuest.FavouredVampire set timer to timer + 1 if (timer == 1) tradee.RemoveAllItems LTDsvInventoryCont return elseif (timer == 2) LTDsvInventoryCont.activate player return elseif (timer == 3) LTDsvInventoryCont.RemoveAllItems tradee tradee.AddItem ArenaRaimentHeavy 1 tradee.EquipItem ArenaRaimentHeavy tradee.RemoveItem ArenaRaimentHeavy 1 ; player.RemoveSpell LTDsvInventory return endif player.removespell LTDsvInventory end LTDsvQuestScript scn LTDsvQuestScript ;Nothing wrong with determining Essentialness, as far as I can tell. ref searcher ref FeedVictim ref TempSire ref FavouredVampire ref OldFavouredVampire short AlreadyEssential short DoOnce short ResetSearcher short FavouredFed short SearcherDetected short ShouldForceSneak float FavouredConfidence short PlayerHasBite Begin GameMode if (DoOnce == 0) ;Initiate the mod AddTopic LTDsvFollowMe AddTopic LTDsvWaitHere AddTopic LTDsvFavourBestow AddTopic LTDsvFavourRemove AddTopic LTDsvDismiss AddTopic LTDsvAccessInventory set DoOnce to 1 endif ;Reset the searcher's detected status, so feeding is a possibility again. if (SearcherDetected != 0 || ShouldForceSneak > 0) set SearcherDetected to 0 ; if (FeedVictim) ; set ShouldForceSneak to 2 ; endif ;elseif (ShouldForceSneak > 0) ; set ShouldForceSneak to ShouldForceSneak - 1 endif ;ShouldForceSneak helps govern vampires' force sneaking. If they're being seen while they have their eye on a sleeping victim... ;...best to put them into forced-sneaking so they can't be detected from outright ridiculous distances/angles. ;We can't just add it once, what with vampire overhauls and cures... The spell will be removed/added depending on whether the player is a "vampire". if (PlayerHasBite == 0 && player.GetVampire) player.AddSpell LTDsvBite set PlayerHasBite to 1 elseif (PlayerHasBite == 1 && player.GetVampire == 0) player.RemoveSpell LTDsvBite set PlayerHasBite to 0 endif if (HasTheTouch == 1) ;For messing around or whatnot, the console command "Set HasTheTouch to 1" gives you easier infection/cure lesser powers.. player.AddSpell LTDsvTouch player.AddSpell LTDsvCure set HasTheTouch to 0 endif ;This will "refresh" the searching NPC so another vampire can take a go. ResetSearcher is set to 1 every time a vampire searches for potential meals. if ( ((ResetSearcher == 1 && FeedVictim == 0) || searcher.GetInSameCell player == 0) && searcher ) set searcher to 0 set FeedVictim to 0 set ResetSearcher to 0 endif ;The below lines concern changing the player's favoured vampire. The parts changing the old favoured vampire and the new one are separate. ;This means that changing FavouredVampire while there is no old one is fine, as is just changing FavouredVampire to 0. if (FavouredVampire != OldFavouredVampire) if (OldFavouredVampire) OldFavouredVampire.SetAV confidence FavouredConfidence OldFavouredVampire.RemoveSpell LTDsvFavour OldFavouredVampire.RemoveSpell LTDsvFavouredFeed ; if (AlreadyEssential == 0) ; set OldFavouredVampire to OldFavouredVampire.GetBaseObject ; SetEssential OldFavouredVampire 0 ; endif endif ;The original intent was for the favoured vampire to go essential, but that would be very troublesome if someone uninstalled carelessly... ;And, for some reason, SetEssential OldFavouredVampire 0-or anything similar-doesn't seem to want to work... if (FavouredVampire) if (FavouredVampire.IsEssential) set AlreadyEssential to 1 ; else ; set OldFavouredVampire to FavouredVampire.GetBaseObject ; SetEssential OldFavouredVampire 1 endif FavouredVampire.AddSpell LTDsvFavour FavouredVampire.AddSpell LTDsvFavouredFeed set FavouredConfidence to FavouredVampire.GetAV confidence FavouredVampire.SetAV confidence 100 endif set OldFavouredVampire to FavouredVampire endif end LTDsvSearchScript scn LTDsvSearchScript ref self ref searcher ref victim Begin ScriptEffectStart set self to GetSelf set searcher to LTDsvQuest.searcher ;Checking for things that, logically speaking, wouldn't be a good supply of blood. And the player, so he doesn't see the magic effect. if (GetFactionRank UndeadFaction == -1 && NameIncludes Atronach == 0 && GetVampire == 0 && IsActor && (self != player || GetDead) ) ;A faction rank of -1 means they're not in the faction in question. I always found the GetInFaction function a bit superfluous. ;They shouldn't go off feeding if a non-vampire is watching... set victim to LTDsvQuest.FeedVictim if (GetDetected searcher && GetLOS searcher && LTDsvQuest.SearcherDetected == 0 && searcher.GetDistance victim < 400) set LTDsvQuest.SearcherDetected to 1 endif ;Checking for a sleeping victim. The actual process of feeding is covered in the governor object's script. if (GetSleeping && LTDsvQuest.FeedVictim == 0) set LTDsvQuest.FeedVictim to self ; searcher.SetForceSneak 1 searcher.VampireFeed self ;Checking for a corpse that hasn't yet been dead for an hour, and is thus still fresh. elseif (GetDead && GetTimeDead < 1 && LTDsvQuest.FeedVictim == 0 && GetBaseAV Health > 0) set LTDsvQuest.FeedVictim to self endif ;Gotta keep checking FeedVictim, since this is also used while they're in the process of feeding to check for witnesses. elseif (self == player) dispel LTDsvSearch endif end LTDsvTouchScript scn LTDsvTouchScript Begin ScriptEffectStart if (GetVampire == 0 && IsActor && IsCreature == 0) AddItem LTDsvGovernor 1 SetFactionRank LTDsvCureFaction -1 PlaySound NPCHumanVampireFeed set LTDsvQuest.TempSire to player ;The TempSire variable effects the vampire-to-be's behavior. If they like their sire, they'll become fanatically loyal. endif end
WappyOne Posted May 23, 2014 Posted May 23, 2014 In script LTDsvSearchScript the line 'searcher.VampireFeed self' is what triggers adding the VampireFeed AI script. There's nothing in there that you can directly hook to watch for it ending.
Nepro Posted July 31, 2014 Author Posted July 31, 2014 In the LTDsvSearchScript: If after searcher.VampireFeed self I would add if searcher.VampireFeed self message "DO NOT SAVE! WAIT FOR A VAMPIRE TO FINISH FEEDING" Would that work?
Symon Posted August 1, 2014 Posted August 1, 2014 A less intrusive way to do this might be to dispense with the message and disable the keys for saving the game, as long as you then re-enable them of course.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.