Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Scriptname SCS_FeedManager_Quest extends Quest
- ; -----
- playervampirequestscript Property PlayerVampireQuest Auto
- dlc1vampireturnscript Property DLC1VampireTurn Auto
- Actor Property PlayerRef Auto
- SPELL Property SCS_Abilities_Racial_Spell_Altmer_Proc Auto
- SPELL Property SCS_Abilities_Racial_Spell_Altmer_Proc_Long Auto
- MagicEffect Property SCS_Abilities_Racial_Effect_Altmer_Ab Auto
- MagicEffect Property SCS_Abilities_Racial_Effect_Orc_Ab Auto
- Idle Property IdleVampireStandingFront Auto
- Message Property SCS_Mechanics_Message_VampireFeed_Failed_PathObstructed Auto
- GlobalVariable Property SCS_VampireSpells_VampireLord_Global_XP_LethalFeed_Base Auto
- GlobalVariable Property SCS_VampireSpells_VampireLord_Global_XP_LethalFeed_Level Auto
- Keyword Property Vampire Auto
- SPELL Property SCS_Mechanics_Spell_Amaranth Auto
- SPELL Property SCS_Mechanics_Spell_Amaranth_Target Auto
- SPELL Property SCS_Abilities_Mechanics_Spell_Ab_AddRemoveHemomancySpells Auto
- GlobalVariable Property SCS_VampireSpells_Hemomancy_Global_Stage Auto
- GlobalVariable Property SCS_VampireSpells_Hemomancy_Global_Stage_Steps Auto
- GlobalVariable Property SCS_VampireSpells_Hemomancy_Global_Stage_StepsToNext Auto
- GlobalVariable Property SCS_VampireSpells_Hemomancy_Global_Stage_StepsToNext_AddPerStep Auto
- FormList Property SCS_Mechanics_FormList_HemomancyExpanded Auto
- Message Property SCS_Mechanics_Message_HemomancyStageUp Auto
- SPELL Property SCS_Mechanics_Spell_SneakFeed_Target Auto
- Perk Property SCS_LethalFeedXP Auto
- Message Property DLC1BloodPointsMsg Auto
- GlobalVariable Property DLC1VampireBloodPoints Auto
- GlobalVariable Property DLC1VampireNextPerk Auto
- GlobalVariable Property DLC1VampirePerkPoints Auto
- Message Property DLC1VampirePerkEarned Auto
- GlobalVariable Property DLC1VampireMaxPerks Auto
- GlobalVariable Property DLC1VampireTotalPerksEarned Auto
- GlobalVariable Property SCS_Mechanics_Global_BlockFeed Auto
- GlobalVariable Property SCS_VampireSpells_Vanilla_Power_Message_CanLamaesWrath Auto
- SPELL Property SCS_Abilities_Racial_Spell_OrcNew_Proc Auto
- SPELL Property SCS_Abilities_Racial_Spell_OrcNew_Proc_Long Auto
- SPELL Property SCS_Abilities_Racial_Spell_Dunmer_Spell Auto
- MagicEffect Property SCS_Abilities_Racial_Effect_Dunmer_Ab Auto
- SPELL Property SCS_Mechanics_Spell_PsychicVampire_Target Auto
- Perk Property SCS_PsychicVampire_Perk Auto
- SPELL Property SCS_Mechanics_Spell_SeductionFeed_Target Auto
- Faction Property PotentialFollowerFaction Auto
- Spell Property SCS_Mechanics_Spell_FeedEmbrace_Target Auto
- Faction Property PotentialMarriageFaction Auto
- Message Property SCS_Mechanics_Message_BloodBond Auto
- Perk Property SCS_Mechanics_Perk_Amaranth Auto
- SPELL Property SCS_Abilities_Vanilla_Spell_Ab_ReverseProgression_Stage2 Auto
- GlobalVariable Property SCS_Mechanics_Global_KissOfDeath_Amount Auto
- MagicEffect Property SCS_Abilities_Vanilla_Effect_Ab_ReverseProgression_Stage3 Auto
- FormList Property SCS_Mechanics_FormList_StrongBlood Auto
- FormList Property SCS_Mechanics_FormList_StrongBlood_Track Auto
- Message Property SCS_Mechanics_Message_StrongBlood auto
- Spell[] Property SCS_Spell Auto
- Quest Property SCS_Sommelier_Quest Auto
- GlobalVariable Property SCS_Mechanics_Global_DisableScriptsBroken Auto
- Message Property SCS_Mechanics_Message_ScriptsBroken Auto
- Sound Property SCS_Mechanics_Marker_FeedSound Auto
- GlobalVariable Property SCS_Mechanics_Global_BloodKnight_Cost Auto
- Message Property SCS_Mechanics_Message_VampireFeed_Failed_Essential Auto
- Message Property SCS_Help_CantFeedOnEssential Auto
- Message Property SCS_Help_GetHemomancyByFeeding Auto
- Message Property SCS_Help_StrongBlood Auto
- GlobalVariable Property SCS_Mechanics_Global_ForceUniqueCheck Auto
- GlobalVariable Property SCS_Mechanics_Global_Wassail_Current Auto
- Potion Property DLC1BloodPotion Auto
- String Property SCS_Stat0 Auto
- String Property SCS_Stat1 Auto
- String Property SCS_Stat2 Auto
- GlobalVariable Property SCS_Mechanics_Global_Wassail_NerfAmount Auto
- Spell Property SCS_Abilities_Vanilla_Spell_Ab_ReverseProgression_Stage2N_Proc Auto
- ; -----
- Int StrongBloodCounter = 0
- ; -----
- Function InitFeedList()
- Int i = 0
- While i < SCS_Mechanics_FormList_StrongBlood.GetSize()
- SCS_Mechanics_FormList_StrongBlood_Track.AddForm(SCS_Mechanics_FormList_StrongBlood.GetAt(i))
- i += 1
- EndWhile
- EndFunction
- ; -----
- ; feed animations
- Idle Property pa_HugA Auto
- Idle Property IdleSearchBody Auto
- ; -----
- Function ProcessFeed(Actor akTarget, Bool akIsLethal, Bool akIsSleeping, Bool akIsSneakFeed, Bool akIsParalyzed = false, Bool akIsCombatFeed = false, Bool akIsEmbrace = false)
- ; the meat of the feed functionality
- ; this is called by the feed perk
- If akIsLethal && akTarget.IsEssential()
- SCS_Help_CantFeedOnEssential.ShowAsHelpMessage("SCS_CantFeedOnEssentialEvent",5.0, 0, 1)
- SCS_Mechanics_Message_VampireFeed_Failed_Essential.Show()
- Return;
- EndIf
- If GetStage() < 10
- SetStage(10)
- EndIf
- Debug.Trace("SACROSANCT DEBUG: Player feeds on target " + akTarget + ": Lethal " + akIsLethal + "; Sleeping " + akIsSleeping + "; Sneaking " + akIsSneakFeed, 0)
- DLC1VampireTurn.PlayerBitesMe(akTarget)
- ; animation
- ; If akIsCombatFeed
- ; Game.DisablePlayerControls(false, true, false, false, false, false)
- ; akTarget.SetRestrained()
- ; Utility.Wait(1.0)
- ; PlayerRef.PlayIdleWithTarget(pa_HugA, akTarget)
- ; ElseIf akIsParalyzed
- ; Game.DisablePlayerControls(false, true, false, false, false, false)
- ; akTarget.SetRestrained()
- ; Utility.Wait(1.0)
- ; PlayerRef.PlayIdle(IdleSearchBody)
- ; Else
- If akIsCombatFeed || akIsParalyzed
- akTarget.SetRestrained()
- EndIf
- ; yum
- PlayerRef.StartVampireFeed(akTarget)
- SCS_Mechanics_Marker_FeedSound.Play(akTarget)
- SCS_Mechanics_Spell_Feed_Target.Cast(PlayerRef, akTarget)
- ; amaranth (lethal)
- If akIsLethal && akTarget.HasKeyword(Vampire)
- SCS_Mechanics_Spell_Amaranth.Cast(PlayerRef)
- SCS_Mechanics_Spell_Amaranth_Target.Cast(PlayerRef, akTarget)
- EndIf
- ; handle hunger
- PlayerVampireQuest.VampireFeed()
- ; racial vampire abilities
- If PlayerRef.HasMagicEffect(SCS_Abilities_Racial_Effect_Dunmer_Ab)
- SCS_Abilities_Racial_Spell_Dunmer_Spell.Cast(PlayerRef, akTarget)
- ElseIf PlayerRef.HasMagicEffect(SCS_Abilities_Racial_Effect_Altmer_Ab)
- If akIsSleeping
- SCS_Abilities_Racial_Spell_Altmer_Proc_Long.Cast(PlayerRef)
- Else
- SCS_Abilities_Racial_Spell_Altmer_Proc.Cast(PlayerRef)
- EndIf
- ElseIf PlayerRef.HasMagicEffect(SCS_Abilities_Racial_Effect_Orc_Ab)
- If akIsSleeping
- SCS_Abilities_Racial_Spell_OrcNew_Proc_Long.Cast(PlayerRef)
- Else
- SCS_Abilities_Racial_Spell_OrcNew_Proc.Cast(PlayerRef)
- EndIf
- EndIf
- ; sneak feeding counts as assault
- If akIsSneakFeed
- akTarget.SendAssaultAlarm()
- SCS_Mechanics_Spell_SneakFeed_Target.Cast(PlayerRef, akTarget)
- EndIf
- ; lethal feed kills the target and grants restoration xp (lethal)
- If akIsLethal
- akTarget.Kill(PlayerRef)
- Game.AdvanceSkill("Restoration", SCS_VampireSpells_VampireLord_Global_XP_LethalFeed_Base.GetValue() + (akTarget.GetLevel() * SCS_VampireSpells_VampireLord_Global_XP_LethalFeed_Level.GetValue()))
- EndIf
- ; prevent the player from trivially breaking the feed animation
- If akIsParalyzed || akIsCombatFeed
- Utility.Wait(1.0)
- akTarget.SetRestrained(false)
- Game.EnablePlayerControls()
- Game.SetPlayerAIDriven(false)
- EndIf
- ; -----
- ; end of speed sensitive part
- ; -----
- ; combat feed should cost stamina
- If akIsCombatFeed
- PlayerRef.DamageActorValue("Stamina", SCS_Mechanics_Global_BloodKnight_Cost.GetValue())
- EndIf
- ; kiss of death (lethal/sleeping)
- If akIsSleeping && akIsLethal && PlayerRef.HasSpell(SCS_Abilities_Vanilla_Spell_Ab_ReverseProgression_Stage2)
- PlayerRef.ModActorValue("Magicka", SCS_Mechanics_Global_KissOfDeath_Amount.Value)
- PlayerRef.ModActorValue("Stamina", SCS_Mechanics_Global_KissOfDeath_Amount.Value)
- PlayerRef.ModActorValue("Health", SCS_Mechanics_Global_KissOfDeath_Amount.Value)
- EndIf
- ; restore stats
- Int TargetLevel = akTarget.GetLevel()
- PlayerRef.RestoreActorValue("Health", 100 + (TargetLevel * 20))
- PlayerRef.RestoreActorValue("Magicka", 100 + (TargetLevel * 20))
- PlayerRef.RestoreActorValue("Stamina", 100 + (TargetLevel * 20))
- ; foster childe
- If akIsEmbrace && !akIsLethal
- SCS_Mechanics_Spell_FeedEmbrace_Target.Cast(PlayerRef, akTarget)
- EndIf
- ; ----
- ; end of speed moderately sensitive part
- ; -----
- ; psychic vampire (not lethal)
- If !akIsLethal && PlayerRef.HasPerk(SCS_PsychicVampire_Perk)
- SCS_Mechanics_Spell_PsychicVampire_Target.Cast(PlayerRef, akTarget)
- EndIf
- ; dispel wassail
- PlayerRef.DispelSpell(SCS_Abilities_Vanilla_Spell_Ab_ReverseProgression_Stage2N_Proc)
- PlayerRef.DispelSpell(SCS_VampireSpells_Vanilla_Power_Spell_BloodIsPower)
- ; hemomancy (lethal)
- If akIsLethal
- Int HemoSize = SCS_Mechanics_FormList_HemomancyExpanded.GetSize()
- If SCS_VampireSpells_Hemomancy_Global_Stage.GetValue() < HemoSize
- ; only if stage less than the number of hemomancy spells
- If !SCS_Sommelier_Quest.IsRunning()
- SCS_Sommelier_Quest.Start()
- SCS_Help_GetHemomancyByFeeding.ShowAsHelpMessage("SCS_GetHemomancyByFeedingEvent",5.0, 0, 1)
- EndIf
- If SCS_VampireSpells_Hemomancy_Global_Stage.GetValue() == 0
- ; this only happens once but the ab never goes away anyway
- PlayerRef.AddSpell(SCS_Abilities_Mechanics_Spell_Ab_AddRemoveHemomancySpells, false)
- EndIf
- SCS_VampireSpells_Hemomancy_Global_Stage_Steps.Mod(1)
- If SCS_VampireSpells_Hemomancy_Global_Stage_Steps.GetValue() >= SCS_VampireSpells_Hemomancy_Global_Stage_StepsToNext.GetValue()
- ; to next stage
- SCS_Mechanics_Message_HemomancyStageUp.Show()
- PlayerRef.AddSpell(SCS_Mechanics_FormList_HemomancyExpanded.GetAt(SCS_VampireSpells_Hemomancy_Global_Stage.GetValue() as Int) as Spell)
- SCS_VampireSpells_Hemomancy_Global_Stage_Steps.SetValue(0)
- SCS_VampireSpells_Hemomancy_Global_Stage.Mod(1)
- SCS_VampireSpells_Hemomancy_Global_Stage_StepsToNext.Mod(SCS_VampireSpells_Hemomancy_Global_Stage_StepsToNext_AddPerStep.GetValue())
- EndIf
- If SCS_VampireSpells_Hemomancy_Global_Stage.GetValue() >= HemoSize && SCS_Sommelier_Quest.IsRunning()
- SCS_Sommelier_Quest.CompleteQuest()
- EndIf
- EndIf
- EndIf
- ; strong blood
- If akTarget && GetStage() == 10
- ActorBase TargetBase = akTarget.GetActorBase()
- Int Index = SCS_Mechanics_FormList_StrongBlood_Track.Find(TargetBase)
- If Index >= 0
- SCS_Help_StrongBlood.ShowAsHelpMessage("SCS_StrongBloodEvent",5.0, 0, 1)
- SCS_Mechanics_Message_StrongBlood.Show()
- PlayerRef.AddSpell(SCS_Spell[StrongBloodCounter])
- StrongBloodCounter += 1
- SCS_Mechanics_FormList_StrongBlood_Track.RemoveAddedForm(TargetBase)
- Int RemainingSize = SCS_Mechanics_FormList_StrongBlood_Track.GetSize()
- If RemainingSize <= (SCS_Mechanics_FormList_StrongBlood.GetSize() - SCS_Spell.Length)
- SetStage(200)
- EndIf
- EndIf
- EndIf
- ; progressing lifeblood (lethal)
- ; this part copy pasted from DLC1DrainBloodPointScript and cleaned up
- If akIsLethal && PlayerRef.HasPerk(SCS_LethalFeedXP) && !akTarget.IsCommandedActor() && !akTarget.IsGhost()
- DLC1VampireBloodPoints.Value += 1
- If DLC1VampireTotalPerksEarned.Value < DLC1VampireMaxPerks.Value
- DLC1BloodPointsMsg.Show()
- If DLC1VampireBloodPoints.Value >= DLC1VampireNextPerk.Value
- DLC1VampireBloodPoints.Value -= DLC1VampireNextPerk.Value
- DLC1VampirePerkPoints.Value += 1
- DLC1VampireTotalPerksEarned.Value += 1
- DLC1VampireNextPerk.Value = DLC1VampireNextPerk.Value + 1 ; was 2
- DLC1VampirePerkEarned.Show()
- Endif
- PlayerRef.SetActorValue("VampirePerks", DLC1VampireBloodPoints.Value / DLC1VampireNextPerk.Value*100)
- EndIf
- EndIf
- ; enable lamaes wrath (sleeping)
- If akIsSleeping
- SCS_VampireSpells_Vanilla_Power_Message_CanLamaesWrath.SetValue(1)
- EndIf
- ; blood bond (sleeping and not lethal)
- If akIsSleeping && !akIsLethal && (SCS_Mechanics_Global_ForceUniqueCheck.GetValue() == 0 || akTarget.GetActorBase().IsUnique()) && PlayerRef.HasSpell(SCS_Abilities_Reward_Spell_BloodBond_Ab) && !akTarget.IsInFaction(CurrentFollowerFaction) && !akIsEmbrace
- akTarget.SetRelationshipRank(PlayerRef, 4)
- PlayerRef.SetRelationshipRank(akTarget, 4)
- akTarget.AddToFaction(PotentialFollowerFaction)
- akTarget.AddToFaction(PotentialMarriageFaction)
- SCS_Mechanics_Message_BloodBond.Show()
- EndIf
- ; wassail
- SCS_Mechanics_Global_Wassail_Current.SetValue(0.0)
- Float RestoreAmount = SCS_Mechanics_Global_Wassail_NerfAmount.GetValue()
- If SCS_Stat0
- PlayerRef.ModActorValue(SCS_Stat0, RestoreAmount)
- EndIf
- If SCS_Stat1
- PlayerRef.ModActorValue(SCS_Stat1, RestoreAmount)
- EndIf
- If SCS_Stat2
- PlayerRef.ModActorValue(SCS_Stat2, RestoreAmount)
- EndIf
- SCS_Mechanics_Global_Wassail_NerfAmount.SetValue(0.0)
- PlayerRef.DispelSpell(SCS_Abilities_Vanilla_Spell_Ab_ReverseProgression_Stage2N_Proc)
- ; harvest moon
- If akIsLethal && PlayerRef.HasSpell(SCS_Abilities_Reward_Spell_HarvestMoon_Ab)
- PlayerRef.AddItem(DLC1BloodPotion, 1)
- EndIf
- ; advance age
- If akIsLethal
- SCS_Main500_Quest.Age(SCS_Mechanics_Global_Age_BonusFromDrain.GetValue())
- Else
- SCS_Main500_Quest.Age(SCS_Mechanics_Global_Age_BonusFromFeed.GetValue())
- EndIf
- ; safeguard in case of animation stuck
- Utility.Wait(5.0)
- Game.SetPlayerAiDriven(false)
- EndFunction
- ; -----
- Event OnInit()
- ; test if both scripts are okay
- Utility.Wait(15)
- If PlayerVampireQuest.TestIntegrity() != true || DLC1PlayerVampireQuest.TestIntegrity() != true
- SCS_Mechanics_Message_ScriptsBroken.Show()
- ;Game.QuitToMainMenu()
- EndIf
- EndEvent
- ; -----
- Spell Property SCS_Abilities_Reward_Spell_HarvestMoon_Ab Auto
- DLC1PlayerVampireChangeScript Property DLC1PlayerVampireQuest Auto
- Spell Property SCS_Mechanics_Spell_Feed_Target Auto
- Faction Property CurrentFollowerFaction Auto
- Spell Property SCS_Abilities_Reward_Spell_BloodBond_Ab Auto
- SCS_FUtil_Script Property SCS_Main500_Quest Auto
- GlobalVariable Property SCS_Mechanics_Global_Age_BonusFromFeed Auto
- GlobalVariable Property SCS_Mechanics_Global_Age_BonusFromDrain Auto
- Spell Property SCS_VampireSpells_Vanilla_Power_Spell_BloodIsPower Auto
- ; -----
Advertisement
Add Comment
Please, Sign In to add comment