Guest User

Untitled

a guest
Aug 9th, 2018
447
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.24 KB | None | 0 0
  1. Scriptname SCS_FeedManager_Quest extends Quest
  2.  
  3. ; -----
  4.  
  5. playervampirequestscript Property PlayerVampireQuest Auto
  6. dlc1vampireturnscript Property DLC1VampireTurn Auto
  7.  
  8. Actor Property PlayerRef Auto
  9.  
  10. SPELL Property SCS_Abilities_Racial_Spell_Altmer_Proc Auto
  11.  
  12. SPELL Property SCS_Abilities_Racial_Spell_Altmer_Proc_Long Auto
  13.  
  14. MagicEffect Property SCS_Abilities_Racial_Effect_Altmer_Ab Auto
  15.  
  16. MagicEffect Property SCS_Abilities_Racial_Effect_Orc_Ab Auto
  17.  
  18. Idle Property IdleVampireStandingFront Auto
  19.  
  20. Message Property SCS_Mechanics_Message_VampireFeed_Failed_PathObstructed Auto
  21.  
  22. GlobalVariable Property SCS_VampireSpells_VampireLord_Global_XP_LethalFeed_Base Auto
  23.  
  24. GlobalVariable Property SCS_VampireSpells_VampireLord_Global_XP_LethalFeed_Level Auto
  25.  
  26. Keyword Property Vampire Auto
  27.  
  28. SPELL Property SCS_Mechanics_Spell_Amaranth Auto
  29.  
  30. SPELL Property SCS_Mechanics_Spell_Amaranth_Target Auto
  31.  
  32. SPELL Property SCS_Abilities_Mechanics_Spell_Ab_AddRemoveHemomancySpells Auto
  33.  
  34. GlobalVariable Property SCS_VampireSpells_Hemomancy_Global_Stage Auto
  35.  
  36. GlobalVariable Property SCS_VampireSpells_Hemomancy_Global_Stage_Steps Auto
  37.  
  38. GlobalVariable Property SCS_VampireSpells_Hemomancy_Global_Stage_StepsToNext Auto
  39.  
  40. GlobalVariable Property SCS_VampireSpells_Hemomancy_Global_Stage_StepsToNext_AddPerStep Auto
  41.  
  42. FormList Property SCS_Mechanics_FormList_HemomancyExpanded Auto
  43.  
  44. Message Property SCS_Mechanics_Message_HemomancyStageUp Auto
  45.  
  46. SPELL Property SCS_Mechanics_Spell_SneakFeed_Target Auto
  47.  
  48. Perk Property SCS_LethalFeedXP Auto
  49.  
  50. Message Property DLC1BloodPointsMsg Auto
  51.  
  52. GlobalVariable Property DLC1VampireBloodPoints Auto
  53.  
  54. GlobalVariable Property DLC1VampireNextPerk Auto
  55.  
  56. GlobalVariable Property DLC1VampirePerkPoints Auto
  57.  
  58. Message Property DLC1VampirePerkEarned Auto
  59.  
  60. GlobalVariable Property DLC1VampireMaxPerks Auto
  61.  
  62. GlobalVariable Property DLC1VampireTotalPerksEarned Auto
  63.  
  64. GlobalVariable Property SCS_Mechanics_Global_BlockFeed Auto
  65.  
  66. GlobalVariable Property SCS_VampireSpells_Vanilla_Power_Message_CanLamaesWrath Auto
  67.  
  68. SPELL Property SCS_Abilities_Racial_Spell_OrcNew_Proc Auto
  69.  
  70. SPELL Property SCS_Abilities_Racial_Spell_OrcNew_Proc_Long Auto
  71.  
  72. SPELL Property SCS_Abilities_Racial_Spell_Dunmer_Spell Auto
  73.  
  74. MagicEffect Property SCS_Abilities_Racial_Effect_Dunmer_Ab Auto
  75.  
  76. SPELL Property SCS_Mechanics_Spell_PsychicVampire_Target Auto
  77.  
  78. Perk Property SCS_PsychicVampire_Perk Auto
  79.  
  80. SPELL Property SCS_Mechanics_Spell_SeductionFeed_Target Auto
  81.  
  82. Faction Property PotentialFollowerFaction Auto
  83.  
  84. Spell Property SCS_Mechanics_Spell_FeedEmbrace_Target Auto
  85.  
  86. Faction Property PotentialMarriageFaction Auto
  87.  
  88. Message Property SCS_Mechanics_Message_BloodBond Auto
  89.  
  90. Perk Property SCS_Mechanics_Perk_Amaranth Auto
  91.  
  92. SPELL Property SCS_Abilities_Vanilla_Spell_Ab_ReverseProgression_Stage2 Auto
  93.  
  94. GlobalVariable Property SCS_Mechanics_Global_KissOfDeath_Amount Auto
  95.  
  96. MagicEffect Property SCS_Abilities_Vanilla_Effect_Ab_ReverseProgression_Stage3 Auto
  97.  
  98. FormList Property SCS_Mechanics_FormList_StrongBlood Auto
  99. FormList Property SCS_Mechanics_FormList_StrongBlood_Track Auto
  100. Message Property SCS_Mechanics_Message_StrongBlood auto
  101. Spell[] Property SCS_Spell Auto
  102. Quest Property SCS_Sommelier_Quest Auto
  103.  
  104. GlobalVariable Property SCS_Mechanics_Global_DisableScriptsBroken Auto
  105. Message Property SCS_Mechanics_Message_ScriptsBroken Auto
  106. Sound Property SCS_Mechanics_Marker_FeedSound Auto
  107. GlobalVariable Property SCS_Mechanics_Global_BloodKnight_Cost Auto
  108.  
  109. Message Property SCS_Mechanics_Message_VampireFeed_Failed_Essential Auto
  110.  
  111. Message Property SCS_Help_CantFeedOnEssential Auto
  112. Message Property SCS_Help_GetHemomancyByFeeding Auto
  113. Message Property SCS_Help_StrongBlood Auto
  114.  
  115. GlobalVariable Property SCS_Mechanics_Global_ForceUniqueCheck Auto
  116. GlobalVariable Property SCS_Mechanics_Global_Wassail_Current Auto
  117.  
  118. Potion Property DLC1BloodPotion Auto
  119.  
  120. String Property SCS_Stat0 Auto
  121. String Property SCS_Stat1 Auto
  122. String Property SCS_Stat2 Auto
  123. GlobalVariable Property SCS_Mechanics_Global_Wassail_NerfAmount Auto
  124. Spell Property SCS_Abilities_Vanilla_Spell_Ab_ReverseProgression_Stage2N_Proc Auto
  125.  
  126. ; -----
  127.  
  128. Int StrongBloodCounter = 0
  129.  
  130. ; -----
  131.  
  132. Function InitFeedList()
  133.  
  134. Int i = 0
  135. While i < SCS_Mechanics_FormList_StrongBlood.GetSize()
  136. SCS_Mechanics_FormList_StrongBlood_Track.AddForm(SCS_Mechanics_FormList_StrongBlood.GetAt(i))
  137. i += 1
  138. EndWhile
  139.  
  140. EndFunction
  141.  
  142. ; -----
  143.  
  144. ; feed animations
  145. Idle Property pa_HugA Auto
  146. Idle Property IdleSearchBody Auto
  147.  
  148. ; -----
  149.  
  150. Function ProcessFeed(Actor akTarget, Bool akIsLethal, Bool akIsSleeping, Bool akIsSneakFeed, Bool akIsParalyzed = false, Bool akIsCombatFeed = false, Bool akIsEmbrace = false)
  151.  
  152. ; the meat of the feed functionality
  153. ; this is called by the feed perk
  154.  
  155. If akIsLethal && akTarget.IsEssential()
  156. SCS_Help_CantFeedOnEssential.ShowAsHelpMessage("SCS_CantFeedOnEssentialEvent",5.0, 0, 1)
  157. SCS_Mechanics_Message_VampireFeed_Failed_Essential.Show()
  158. Return;
  159. EndIf
  160.  
  161. If GetStage() < 10
  162. SetStage(10)
  163. EndIf
  164.  
  165. Debug.Trace("SACROSANCT DEBUG: Player feeds on target " + akTarget + ": Lethal " + akIsLethal + "; Sleeping " + akIsSleeping + "; Sneaking " + akIsSneakFeed, 0)
  166. DLC1VampireTurn.PlayerBitesMe(akTarget)
  167.  
  168. ; animation
  169. ; If akIsCombatFeed
  170. ; Game.DisablePlayerControls(false, true, false, false, false, false)
  171. ; akTarget.SetRestrained()
  172. ; Utility.Wait(1.0)
  173. ; PlayerRef.PlayIdleWithTarget(pa_HugA, akTarget)
  174. ; ElseIf akIsParalyzed
  175. ; Game.DisablePlayerControls(false, true, false, false, false, false)
  176. ; akTarget.SetRestrained()
  177. ; Utility.Wait(1.0)
  178. ; PlayerRef.PlayIdle(IdleSearchBody)
  179. ; Else
  180.  
  181. If akIsCombatFeed || akIsParalyzed
  182. akTarget.SetRestrained()
  183. EndIf
  184.  
  185. ; yum
  186. PlayerRef.StartVampireFeed(akTarget)
  187. SCS_Mechanics_Marker_FeedSound.Play(akTarget)
  188. SCS_Mechanics_Spell_Feed_Target.Cast(PlayerRef, akTarget)
  189.  
  190. ; amaranth (lethal)
  191. If akIsLethal && akTarget.HasKeyword(Vampire)
  192. SCS_Mechanics_Spell_Amaranth.Cast(PlayerRef)
  193. SCS_Mechanics_Spell_Amaranth_Target.Cast(PlayerRef, akTarget)
  194. EndIf
  195.  
  196. ; handle hunger
  197. PlayerVampireQuest.VampireFeed()
  198.  
  199. ; racial vampire abilities
  200. If PlayerRef.HasMagicEffect(SCS_Abilities_Racial_Effect_Dunmer_Ab)
  201. SCS_Abilities_Racial_Spell_Dunmer_Spell.Cast(PlayerRef, akTarget)
  202. ElseIf PlayerRef.HasMagicEffect(SCS_Abilities_Racial_Effect_Altmer_Ab)
  203. If akIsSleeping
  204. SCS_Abilities_Racial_Spell_Altmer_Proc_Long.Cast(PlayerRef)
  205. Else
  206. SCS_Abilities_Racial_Spell_Altmer_Proc.Cast(PlayerRef)
  207. EndIf
  208. ElseIf PlayerRef.HasMagicEffect(SCS_Abilities_Racial_Effect_Orc_Ab)
  209. If akIsSleeping
  210. SCS_Abilities_Racial_Spell_OrcNew_Proc_Long.Cast(PlayerRef)
  211. Else
  212. SCS_Abilities_Racial_Spell_OrcNew_Proc.Cast(PlayerRef)
  213. EndIf
  214. EndIf
  215.  
  216. ; sneak feeding counts as assault
  217. If akIsSneakFeed
  218. akTarget.SendAssaultAlarm()
  219. SCS_Mechanics_Spell_SneakFeed_Target.Cast(PlayerRef, akTarget)
  220. EndIf
  221.  
  222. ; lethal feed kills the target and grants restoration xp (lethal)
  223. If akIsLethal
  224. akTarget.Kill(PlayerRef)
  225. Game.AdvanceSkill("Restoration", SCS_VampireSpells_VampireLord_Global_XP_LethalFeed_Base.GetValue() + (akTarget.GetLevel() * SCS_VampireSpells_VampireLord_Global_XP_LethalFeed_Level.GetValue()))
  226. EndIf
  227.  
  228. ; prevent the player from trivially breaking the feed animation
  229. If akIsParalyzed || akIsCombatFeed
  230. Utility.Wait(1.0)
  231. akTarget.SetRestrained(false)
  232. Game.EnablePlayerControls()
  233. Game.SetPlayerAIDriven(false)
  234. EndIf
  235.  
  236. ; -----
  237. ; end of speed sensitive part
  238. ; -----
  239.  
  240. ; combat feed should cost stamina
  241. If akIsCombatFeed
  242. PlayerRef.DamageActorValue("Stamina", SCS_Mechanics_Global_BloodKnight_Cost.GetValue())
  243. EndIf
  244.  
  245. ; kiss of death (lethal/sleeping)
  246. If akIsSleeping && akIsLethal && PlayerRef.HasSpell(SCS_Abilities_Vanilla_Spell_Ab_ReverseProgression_Stage2)
  247. PlayerRef.ModActorValue("Magicka", SCS_Mechanics_Global_KissOfDeath_Amount.Value)
  248. PlayerRef.ModActorValue("Stamina", SCS_Mechanics_Global_KissOfDeath_Amount.Value)
  249. PlayerRef.ModActorValue("Health", SCS_Mechanics_Global_KissOfDeath_Amount.Value)
  250. EndIf
  251.  
  252. ; restore stats
  253. Int TargetLevel = akTarget.GetLevel()
  254. PlayerRef.RestoreActorValue("Health", 100 + (TargetLevel * 20))
  255. PlayerRef.RestoreActorValue("Magicka", 100 + (TargetLevel * 20))
  256. PlayerRef.RestoreActorValue("Stamina", 100 + (TargetLevel * 20))
  257.  
  258. ; foster childe
  259. If akIsEmbrace && !akIsLethal
  260. SCS_Mechanics_Spell_FeedEmbrace_Target.Cast(PlayerRef, akTarget)
  261. EndIf
  262.  
  263. ; ----
  264. ; end of speed moderately sensitive part
  265. ; -----
  266.  
  267. ; psychic vampire (not lethal)
  268. If !akIsLethal && PlayerRef.HasPerk(SCS_PsychicVampire_Perk)
  269. SCS_Mechanics_Spell_PsychicVampire_Target.Cast(PlayerRef, akTarget)
  270. EndIf
  271.  
  272. ; dispel wassail
  273. PlayerRef.DispelSpell(SCS_Abilities_Vanilla_Spell_Ab_ReverseProgression_Stage2N_Proc)
  274. PlayerRef.DispelSpell(SCS_VampireSpells_Vanilla_Power_Spell_BloodIsPower)
  275.  
  276. ; hemomancy (lethal)
  277. If akIsLethal
  278. Int HemoSize = SCS_Mechanics_FormList_HemomancyExpanded.GetSize()
  279. If SCS_VampireSpells_Hemomancy_Global_Stage.GetValue() < HemoSize
  280. ; only if stage less than the number of hemomancy spells
  281. If !SCS_Sommelier_Quest.IsRunning()
  282. SCS_Sommelier_Quest.Start()
  283. SCS_Help_GetHemomancyByFeeding.ShowAsHelpMessage("SCS_GetHemomancyByFeedingEvent",5.0, 0, 1)
  284. EndIf
  285. If SCS_VampireSpells_Hemomancy_Global_Stage.GetValue() == 0
  286. ; this only happens once but the ab never goes away anyway
  287. PlayerRef.AddSpell(SCS_Abilities_Mechanics_Spell_Ab_AddRemoveHemomancySpells, false)
  288. EndIf
  289. SCS_VampireSpells_Hemomancy_Global_Stage_Steps.Mod(1)
  290. If SCS_VampireSpells_Hemomancy_Global_Stage_Steps.GetValue() >= SCS_VampireSpells_Hemomancy_Global_Stage_StepsToNext.GetValue()
  291. ; to next stage
  292. SCS_Mechanics_Message_HemomancyStageUp.Show()
  293. PlayerRef.AddSpell(SCS_Mechanics_FormList_HemomancyExpanded.GetAt(SCS_VampireSpells_Hemomancy_Global_Stage.GetValue() as Int) as Spell)
  294. SCS_VampireSpells_Hemomancy_Global_Stage_Steps.SetValue(0)
  295. SCS_VampireSpells_Hemomancy_Global_Stage.Mod(1)
  296. SCS_VampireSpells_Hemomancy_Global_Stage_StepsToNext.Mod(SCS_VampireSpells_Hemomancy_Global_Stage_StepsToNext_AddPerStep.GetValue())
  297. EndIf
  298. If SCS_VampireSpells_Hemomancy_Global_Stage.GetValue() >= HemoSize && SCS_Sommelier_Quest.IsRunning()
  299. SCS_Sommelier_Quest.CompleteQuest()
  300. EndIf
  301. EndIf
  302. EndIf
  303.  
  304. ; strong blood
  305. If akTarget && GetStage() == 10
  306. ActorBase TargetBase = akTarget.GetActorBase()
  307. Int Index = SCS_Mechanics_FormList_StrongBlood_Track.Find(TargetBase)
  308. If Index >= 0
  309. SCS_Help_StrongBlood.ShowAsHelpMessage("SCS_StrongBloodEvent",5.0, 0, 1)
  310. SCS_Mechanics_Message_StrongBlood.Show()
  311. PlayerRef.AddSpell(SCS_Spell[StrongBloodCounter])
  312. StrongBloodCounter += 1
  313. SCS_Mechanics_FormList_StrongBlood_Track.RemoveAddedForm(TargetBase)
  314. Int RemainingSize = SCS_Mechanics_FormList_StrongBlood_Track.GetSize()
  315. If RemainingSize <= (SCS_Mechanics_FormList_StrongBlood.GetSize() - SCS_Spell.Length)
  316. SetStage(200)
  317. EndIf
  318. EndIf
  319. EndIf
  320.  
  321. ; progressing lifeblood (lethal)
  322. ; this part copy pasted from DLC1DrainBloodPointScript and cleaned up
  323. If akIsLethal && PlayerRef.HasPerk(SCS_LethalFeedXP) && !akTarget.IsCommandedActor() && !akTarget.IsGhost()
  324. DLC1VampireBloodPoints.Value += 1
  325. If DLC1VampireTotalPerksEarned.Value < DLC1VampireMaxPerks.Value
  326. DLC1BloodPointsMsg.Show()
  327. If DLC1VampireBloodPoints.Value >= DLC1VampireNextPerk.Value
  328. DLC1VampireBloodPoints.Value -= DLC1VampireNextPerk.Value
  329. DLC1VampirePerkPoints.Value += 1
  330. DLC1VampireTotalPerksEarned.Value += 1
  331. DLC1VampireNextPerk.Value = DLC1VampireNextPerk.Value + 1 ; was 2
  332. DLC1VampirePerkEarned.Show()
  333. Endif
  334. PlayerRef.SetActorValue("VampirePerks", DLC1VampireBloodPoints.Value / DLC1VampireNextPerk.Value*100)
  335. EndIf
  336. EndIf
  337.  
  338. ; enable lamaes wrath (sleeping)
  339. If akIsSleeping
  340. SCS_VampireSpells_Vanilla_Power_Message_CanLamaesWrath.SetValue(1)
  341. EndIf
  342.  
  343. ; blood bond (sleeping and not lethal)
  344. If akIsSleeping && !akIsLethal && (SCS_Mechanics_Global_ForceUniqueCheck.GetValue() == 0 || akTarget.GetActorBase().IsUnique()) && PlayerRef.HasSpell(SCS_Abilities_Reward_Spell_BloodBond_Ab) && !akTarget.IsInFaction(CurrentFollowerFaction) && !akIsEmbrace
  345. akTarget.SetRelationshipRank(PlayerRef, 4)
  346. PlayerRef.SetRelationshipRank(akTarget, 4)
  347. akTarget.AddToFaction(PotentialFollowerFaction)
  348. akTarget.AddToFaction(PotentialMarriageFaction)
  349. SCS_Mechanics_Message_BloodBond.Show()
  350. EndIf
  351.  
  352. ; wassail
  353. SCS_Mechanics_Global_Wassail_Current.SetValue(0.0)
  354. Float RestoreAmount = SCS_Mechanics_Global_Wassail_NerfAmount.GetValue()
  355. If SCS_Stat0
  356. PlayerRef.ModActorValue(SCS_Stat0, RestoreAmount)
  357. EndIf
  358. If SCS_Stat1
  359. PlayerRef.ModActorValue(SCS_Stat1, RestoreAmount)
  360. EndIf
  361. If SCS_Stat2
  362. PlayerRef.ModActorValue(SCS_Stat2, RestoreAmount)
  363. EndIf
  364. SCS_Mechanics_Global_Wassail_NerfAmount.SetValue(0.0)
  365. PlayerRef.DispelSpell(SCS_Abilities_Vanilla_Spell_Ab_ReverseProgression_Stage2N_Proc)
  366.  
  367. ; harvest moon
  368. If akIsLethal && PlayerRef.HasSpell(SCS_Abilities_Reward_Spell_HarvestMoon_Ab)
  369. PlayerRef.AddItem(DLC1BloodPotion, 1)
  370. EndIf
  371.  
  372. ; advance age
  373. If akIsLethal
  374. SCS_Main500_Quest.Age(SCS_Mechanics_Global_Age_BonusFromDrain.GetValue())
  375. Else
  376. SCS_Main500_Quest.Age(SCS_Mechanics_Global_Age_BonusFromFeed.GetValue())
  377. EndIf
  378.  
  379. ; safeguard in case of animation stuck
  380. Utility.Wait(5.0)
  381. Game.SetPlayerAiDriven(false)
  382.  
  383. EndFunction
  384.  
  385. ; -----
  386.  
  387. Event OnInit()
  388.  
  389. ; test if both scripts are okay
  390.  
  391. Utility.Wait(15)
  392. If PlayerVampireQuest.TestIntegrity() != true || DLC1PlayerVampireQuest.TestIntegrity() != true
  393. SCS_Mechanics_Message_ScriptsBroken.Show()
  394. ;Game.QuitToMainMenu()
  395. EndIf
  396.  
  397. EndEvent
  398.  
  399. ; -----
  400.  
  401. Spell Property SCS_Abilities_Reward_Spell_HarvestMoon_Ab Auto
  402. DLC1PlayerVampireChangeScript Property DLC1PlayerVampireQuest Auto
  403. Spell Property SCS_Mechanics_Spell_Feed_Target Auto
  404. Faction Property CurrentFollowerFaction Auto
  405. Spell Property SCS_Abilities_Reward_Spell_BloodBond_Ab Auto
  406. SCS_FUtil_Script Property SCS_Main500_Quest Auto
  407. GlobalVariable Property SCS_Mechanics_Global_Age_BonusFromFeed Auto
  408. GlobalVariable Property SCS_Mechanics_Global_Age_BonusFromDrain Auto
  409. Spell Property SCS_VampireSpells_Vanilla_Power_Spell_BloodIsPower Auto
  410.  
  411. ; -----
Advertisement
Add Comment
Please, Sign In to add comment