Advertisement
expired6978

Untitled

Aug 11th, 2012
402
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.28 KB | None | 0 0
  1. Scriptname DLC1PlayerVampireChangeScript extends Quest conditional
  2.  
  3. spell Property VampireDrain01 Auto
  4. Quest Property VampireTrackingQuest Auto
  5. faction Property PlayerVampireFaction Auto
  6. spell Property DLC1VampireRaiseDeadLeftHand03 Auto
  7. spell Property DLC1PlayerVampireLvl10AndBelowAbility Auto
  8. spell Property DLC1SupernaturalReflexes Auto
  9. perk Property DLC1UnearthlyWill Auto
  10. globalvariable Property GameDaysPassed Auto
  11. globalvariable Property DLC1BloodMagic Auto
  12. globalvariable Property DLC1VampireTotalPerksEarned Auto
  13. spell Property VampireSunDamage04 Auto
  14. spell Property VampireCharm Auto
  15. String Property BiteStart Auto
  16. spell Property LeveledRaiseDeadSpell Auto
  17. spell Property VampireDrain02 Auto
  18. globalvariable Property DLC1VampireMaxPerks Auto
  19. effectshader Property DLC1VampireChangeBack02FXS Auto
  20. {How long (in real seconds) that feeding extends vampire time}
  21. Float Property UnearthlyWillExtensionTimeSeconds Auto
  22. Bool Property Untimed Auto
  23. spell Property DLC1PlayerVampireLvl20AndBelowAbility Auto
  24. spell Property DLC1NightCloak Auto
  25. perk Property DLC1VampireBite Auto
  26. Quest Property DialogueGenericVampire Auto
  27. spell Property DLC1CorpseCurse Auto
  28. Bool Property DLC1HasLightfoot Auto
  29. spell Property AbVampire04 Auto
  30. spell Property VampireSunDamage01 Auto
  31. armor Property beastRing Auto
  32. faction Property HunterFaction Auto
  33. {How long (in real seconds) the transformation lasts}
  34. Float Property StandardDurationSeconds Auto
  35. armor Property gargNecklace Auto
  36. perk Property DLC1NightCloakPerk Auto
  37. {Spell FX Art holder for Levitation Glow.}
  38. spell Property DLC1AbVampireFloatBodyFX Auto
  39. message Property DLC1VampirePerkEarned Auto
  40. magiceffect Property DLC1RevertEffect Auto
  41. spell Property DLC1VampireRaiseDeadLeftHand02 Auto
  42. {This Global tracks what state the Vampire Lord is in: 0 = Not a Vampire Lord, 1 = Walking, 2 = Levitating}
  43. globalvariable Property DCL1VampireLevitateStateGlobal Auto
  44. String Property LandStart Auto
  45. String Property TransformToHuman Auto
  46. playervampirequestscript Property PlayerVampireQuest Auto
  47. spell Property VampireRaiseThrall03 Auto
  48. spell Property CurrentEquippedLeftSpell Auto
  49. perk Property DLC1VampiricGrip Auto
  50. spell Property VampireHuntersSight Auto
  51. spell Property DLC1ConjureGargoyleLeftHand Auto
  52. perk Property DLC1CorpseCursePerk Auto
  53. perk Property DLC1SupernaturalReflexesPerk Auto
  54. sound Property NPCVampireTransformation Auto
  55. globalvariable Property DLC1VampirePerkPoints Auto
  56. spell Property DLC1PlayerVampireLvl50AndOverAbility Auto
  57. perk Property DLC1MistFormPerk Auto
  58. globalvariable Property pDLC1nVampireNecklaceGargoyle Auto
  59. perk Property DLC1DetectLifePerk Auto
  60. imagespacemodifier Property VampireWarn Auto
  61. spell Property DLC1VampireChange Auto
  62. spell Property DLC1VampireLordSunDamage Auto
  63. armor Property DLC1VampireLordArmor Auto
  64. spell Property VampireInvisibilityPC Auto
  65. armor Property batNecklace Auto
  66. sound Property VampireIMODSound Auto
  67. spell Property DLC1VampireBats Auto
  68. spell Property DLC1VampireDrain09 Auto
  69. effectshader Property DLC1VampireChangeBackFXS Auto
  70. perk Property DLC1GargoylePerk Auto
  71. spell Property DLC1VampireDrain08 Auto
  72. spell Property DLC1Revert Auto
  73. spell Property LeveledDrainSpell Auto
  74. spell Property VampireRaiseThrall01 Auto
  75. globalvariable Property DLC1NightPower Auto
  76. spell Property VampireDrain04 Auto
  77. spell Property DLC1VampireDrain06 Auto
  78. spell Property DLC1VampireMistform Auto
  79. idle Property SpecialFeeding Auto
  80. spell Property VampireDrain03 Auto
  81. {How long (in real seconds) before turning back we should warn the player}
  82. Float Property DurationWarningTimeSeconds Auto
  83. globalvariable Property pDLC1nVampireRingBeast Auto
  84. spell Property VampireSunDamage03 Auto
  85. globalvariable Property VampireFeedReady Auto
  86. spell Property VampireSunDamage02 Auto
  87. armor Property eruditeRing Auto
  88. formlist Property VampireDispelList Auto
  89. faction Property DLC1PlayerVampireLordFaction Auto
  90. spell Property DLC1PlayerVampireLvl45AndBelowAbility Auto
  91. spell Property AbVampire04b Auto
  92. spell Property AbVampire03b Auto
  93. spell Property AbVampire02b Auto
  94. formlist Property CrimeFactions Auto
  95. imagespacemodifier Property VampireChange Auto
  96. spell Property AbVampire01b Auto
  97. message Property PlayerVampireFeedMessage Auto
  98. spell Property AbVampire03 Auto
  99. spell Property AbVampire02 Auto
  100. spell Property AbVampire01 Auto
  101. spell Property LeveledAbility Auto
  102. Float Property DLC1BiteHealthRecover Auto
  103. perk Property DLC1VampireActivationBlocker Auto
  104. spell Property DLC1PlayerVampireLvl15AndBelowAbility Auto
  105. message Property DLC1BloodPointsMsg Auto
  106. spell Property DLC1VampireDetectLife Auto
  107. globalvariable Property DLC1VampireNextPerk Auto
  108. spell Property DLC1VampireDrain07 Auto
  109. globalvariable Property DLC1VampireBloodPoints Auto
  110. spell Property VampireRaiseThrall02 Auto
  111. globalvariable Property PlayerVampireShiftBackTime Auto
  112. spell Property DLC1VampireRaiseDeadLeftHand01 Auto
  113. spell Property VampireRaiseThrall04 Auto
  114. {Visual Effect on Wolf for Feeding Blood}
  115. visualeffect Property FeedBloodVFX Auto
  116. perk Property LightFoot Auto
  117. globalvariable Property TimeScale Auto
  118. spell Property FeedBoost Auto
  119. spell Property DLC1VampireRaiseDeadLeftHand04 Auto
  120. spell Property DLC1PlayerVampireLvl25AndBelowAbility Auto
  121. race Property VampireLordRace Auto
  122. spell Property DLC1VampireDrain05 Auto
  123. String Property LiftoffStart Auto
  124. String Property Levitate Auto
  125. globalvariable Property pDLC1nVampireRingErudite Auto
  126. spell Property DLC1VampireRaiseDeadLeftHand05 Auto
  127. spell Property DLC1PlayerVampireLvl35AndBelowAbility Auto
  128. String Property Ground Auto
  129. spell Property DLC1PlayerVampireLvl30AndBelowAbility Auto
  130. spell Property DLC1VampiresGrip Auto
  131. globalvariable Property pDLC1nVampireNecklaceBats Auto
  132. {This Spell is for making the target of feeding bleed.}
  133. spell Property BleedingFXSpell Auto
  134. spell Property DLC1PlayerVampireLvl40AndBelowAbility Auto
  135. message Property PlayerVampireExpirationWarning Auto
  136.  
  137. Bool __tryingToShiftBack = false
  138. Bool __trackingStarted = false
  139. Bool __shiftingBack = false
  140. Bool __prepped = false
  141. Bool __shuttingDown = false
  142. Float __durationWarningTime = -1.00000
  143. Float __UnearthlyWillExtensionTime = -1.00000
  144.  
  145. Function StartTracking()
  146. actor PlayerActor
  147. Int cfIndex
  148. Float currentTime
  149. Float regressTime
  150. PlayerActor = game.GetPlayer()
  151. if __trackingStarted
  152. return
  153. endif
  154. __trackingStarted = true
  155. if game.GetPlayer().isEquipped((beastRing as form))
  156. pDLC1nVampireRingBeast.setValue((1 as Float))
  157. endif
  158. if game.GetPlayer().isEquipped((eruditeRing as form))
  159. pDLC1nVampireRingErudite.setValue((1 as Float))
  160. endif
  161. if game.GetPlayer().isEquipped((batNecklace as form))
  162. pDLC1nVampireNecklaceBats.setValue((1 as Float))
  163. endif
  164. if game.GetPlayer().isEquipped((gargNecklace as form))
  165. pDLC1nVampireNecklaceGargoyle.setValue((1 as Float))
  166. endif
  167. RegisterForEvents()
  168. DCL1VampireLevitateStateGlobal.setValue((1 as Float))
  169. debug.Trace("VAMPIRE: Race swap done; starting tracking and effects.", 0)
  170. PlayerActor.UnequipAll()
  171. PlayerActor.EquipItem((DLC1VampireLordArmor as form), false, true)
  172. PlayerActor.SetAttackActorOnSight(true)
  173. game.SendWereWolfTransformation()
  174. PlayerActor.AddToFaction(PlayerVampireFaction)
  175. cfIndex = 0
  176. while (cfIndex < CrimeFactions.GetSize())
  177. debug.Trace(("VAMPIRE: Setting enemy flag on " + (CrimeFactions.GetAt(cfIndex) as String)), 0)
  178. (CrimeFactions.GetAt(cfIndex) as faction).SetPlayerEnemy(true)
  179. cfIndex = (cfIndex + 1)
  180. endWhile
  181. HunterFaction.SetPlayerEnemy(true)
  182. game.SetPlayerReportCrime(false)
  183. __durationWarningTime = RealTimeSecondsToGameTimeDays(DurationWarningTimeSeconds)
  184. __UnearthlyWillExtensionTime = RealTimeSecondsToGameTimeDays(UnearthlyWillExtensionTimeSeconds)
  185. PlayerActor.RemoveSpell(VampireSunDamage01)
  186. PlayerActor.RemoveSpell(VampireSunDamage02)
  187. PlayerActor.RemoveSpell(VampireSunDamage03)
  188. PlayerActor.RemoveSpell(VampireSunDamage04)
  189. PlayerActor.AddSpell(DLC1VampireLordSunDamage, false)
  190. PlayerActor.AddSpell(LeveledAbility, false)
  191. PlayerActor.AddSpell(VampireHuntersSight, false)
  192. PlayerActor.AddSpell(DLC1Revert, false)
  193. PlayerActor.AddSpell(DLC1VampireBats, false)
  194. PlayerActor.EquipSpell((DialogueGenericVampire as vampirequestscript).LastPower, 2)
  195. CheckPerkSpells()
  196. if (PlayerActor.HasPerk(LightFoot) == true)
  197. DLC1HasLightfoot = true
  198. endif
  199. DLC1HasLightfoot = false
  200. PlayerActor.AddPerk(LightFoot)
  201. currentTime = GameDaysPassed.GetValue()
  202. regressTime = (currentTime + RealTimeSecondsToGameTimeDays(StandardDurationSeconds))
  203. if PlayerActor.HasPerk(DLC1UnearthlyWill)
  204. regressTime = (regressTime + __UnearthlyWillExtensionTime)
  205. endif
  206. PlayerVampireShiftBackTime.setValue(regressTime)
  207. debug.Trace(("VAMPIRE: Current day -- " + (currentTime as String)), 0)
  208. debug.Trace(("VAMPIRE: Player will turn back at day " + (regressTime as String)), 0)
  209. PlayerActor.DispelSpell(DLC1VampireChange)
  210. RegisterForUpdate((3 as Float))
  211. SetStage(10)
  212. EndFunction
  213.  
  214. Function SetUntimed(Bool untimedValue)
  215. Untimed = untimedValue
  216. if Untimed
  217. UnregisterForUpdate()
  218. endif
  219. EndFunction
  220.  
  221. {Function that switches this object to the specified state}
  222. Function GotoState(String newState)
  223. onEndState()
  224. ::State = newState
  225. onBeginState()
  226. EndFunction
  227.  
  228. Function UnloadSpells()
  229. LeveledDrainSpell.Unload()
  230. LeveledRaiseDeadSpell.Unload()
  231. DLC1VampiresGrip.Unload()
  232. DLC1ConjureGargoyleLeftHand.Unload()
  233. DLC1CorpseCurse.Unload()
  234. EndFunction
  235.  
  236. Function PrepShift()
  237. actor PlayerActor
  238. Int count
  239. spell gone
  240. PlayerActor = game.GetPlayer()
  241. debug.Trace("VAMPIRE: Prepping shift...", 0)
  242. VampireChange.Apply(1.00000)
  243. VampireIMODSound.Play((PlayerActor as objectreference))
  244. game.SetInCharGen(true, true, false)
  245. PlayerActor.AddPerk(DLC1VampireActivationBlocker)
  246. game.SetBeastForm(true)
  247. game.EnableFastTravel(false)
  248. PlayerActor.SetActorValue("GrabActorOffset", (70 as Float))
  249. count = 0
  250. while (count < VampireDispelList.GetSize())
  251. gone = (VampireDispelList.GetAt(count) as spell)
  252. if !((gone == None))
  253. PlayerActor.DispelSpell(gone)
  254. endif
  255. count = (count + 1)
  256. endWhile
  257. game.DisablePlayerControls(false, false, true, false, false, false, false, false, 1)
  258. game.ForceThirdPerson()
  259. game.ShowFirstPersonGeometry(false)
  260. EstablishLeveledSpells()
  261. PreloadSpells()
  262. __prepped = true
  263. EndFunction
  264.  
  265. Function Revert()
  266. debug.Trace(("VAMPIRE: Perks stat = " + (game.QueryStat("NumVampirePerks") as String)), 0)
  267. if ((game.QueryStat("NumVampirePerks") as Float) >= DLC1VampireMaxPerks.value)
  268. game.AddAchievement(58)
  269. endif
  270. UnregisterForUpdate()
  271. SetStage(100)
  272. EndFunction
  273.  
  274. Function Shutdown()
  275. actor PlayerActor
  276. if __shuttingDown
  277. return
  278. endif
  279. __shuttingDown = true
  280. PlayerActor = game.GetPlayer()
  281. DCL1VampireLevitateStateGlobal.setValue((0 as Float))
  282. PlayerActor.GetActorBase()
  283. PlayerActor.GetActorBase().SetInvulnerable(false)
  284. PlayerActor.SetGhost(false)
  285. game.SetBeastForm(false)
  286. game.EnableFastTravel(true)
  287. game.SetInCharGen(false, false, false)
  288. debug.Trace("VAMPIRE: Transform to human done - remove activation blocking perk and allow recast of Vampire Change spell", 0)
  289. PlayerActor.RemovePerk(DLC1VampireActivationBlocker)
  290. PlayerActor.RemoveSpell(VampireHuntersSight)
  291. UnloadSpells()
  292. game.EnablePlayerControls(false, false, true, true, true, false, false, false, 1)
  293. stop()
  294. EndFunction
  295.  
  296. Function PreloadSpells()
  297. LeveledDrainSpell.Preload()
  298. LeveledRaiseDeadSpell.Preload()
  299. DLC1VampiresGrip.Preload()
  300. DLC1ConjureGargoyleLeftHand.Preload()
  301. DLC1CorpseCurse.Preload()
  302. EndFunction
  303.  
  304. Function ShiftBack()
  305. actor PlayerActor
  306. __tryingToShiftBack = true
  307. PlayerActor = game.GetPlayer()
  308. while PlayerActor.GetAnimationVariableBool("bIsSynced")
  309. utility.Wait(0.10000)
  310. endWhile
  311. __shiftingBack = false
  312. ActuallyShiftBackIfNecessary()
  313. EndFunction
  314.  
  315. Function RegisterForEvents()
  316. actor PlayerActor
  317. debug.Trace("Registering for Animation Events", 0)
  318. PlayerActor = game.GetPlayer()
  319. RegisterForAnimationEvent((PlayerActor as objectreference), Ground)
  320. RegisterForAnimationEvent((PlayerActor as objectreference), Levitate)
  321. RegisterForAnimationEvent((PlayerActor as objectreference), BiteStart)
  322. RegisterForAnimationEvent((PlayerActor as objectreference), LiftoffStart)
  323. RegisterForAnimationEvent((PlayerActor as objectreference), LandStart)
  324. RegisterForAnimationEvent((PlayerActor as objectreference), TransformToHuman)
  325. EndFunction
  326.  
  327. Function ActuallyShiftBackIfNecessary()
  328. actor PlayerActor
  329. Int count
  330. spell gone
  331. Float currHealth
  332. Int cfIndex
  333. PlayerActor = game.GetPlayer()
  334. if __shiftingBack
  335. return
  336. endif
  337. __shiftingBack = true
  338. PlayerActor.GetActorBase()
  339. PlayerActor.GetActorBase().SetInvulnerable(true)
  340. PlayerActor.SetGhost(true)
  341. if (DLC1HasLightfoot == false)
  342. PlayerActor.RemovePerk(LightFoot)
  343. endif
  344. UnregisterForEvents()
  345. DCL1VampireLevitateStateGlobal.setValue((1 as Float))
  346. debug.Trace("VAMPIRE: Player returning to normal.", 0)
  347. game.SetInCharGen(true, true, false)
  348. UnregisterForUpdate()
  349. if PlayerActor.IsDead()
  350. debug.Trace("VAMPIRE: Player is dead; bailing out.", 0)
  351. return
  352. endif
  353. VampireChange.Apply(1.00000)
  354. VampireIMODSound.Play((PlayerActor as objectreference))
  355. DLC1VampireChangeBackFXS.Play((PlayerActor as objectreference), 12.00000)
  356. count = 0
  357. while (count < VampireDispelList.GetSize())
  358. gone = (VampireDispelList.GetAt(count) as spell)
  359. if !((gone == None))
  360. PlayerActor.DispelSpell(gone)
  361. endif
  362. count = (count + 1)
  363. endWhile
  364. CurrentEquippedLeftSpell = PlayerActor.GetEquippedSpell(0)
  365. (DialogueGenericVampire as vampirequestscript).LastLeftHandSpell = CurrentEquippedLeftSpell
  366. if (PlayerActor.GetEquippedSpell(2) == DLC1Revert)
  367. (DialogueGenericVampire as vampirequestscript).LastPower = DLC1VampireBats
  368. endif
  369. (DialogueGenericVampire as vampirequestscript).LastPower = PlayerActor.GetEquippedSpell(2)
  370. PlayerActor.RemoveSpell(LeveledDrainSpell)
  371. PlayerActor.RemoveSpell(LeveledAbility)
  372. PlayerActor.RemoveSpell(LeveledRaiseDeadSpell)
  373. PlayerActor.RemoveSpell(DLC1VampiresGrip)
  374. PlayerActor.RemoveSpell(DLC1ConjureGargoyleLeftHand)
  375. PlayerActor.RemoveSpell(DLC1CorpseCurse)
  376. PlayerActor.RemoveSpell(DLC1VampireDetectLife)
  377. PlayerActor.RemoveSpell(DLC1VampireMistform)
  378. PlayerActor.RemoveSpell(DLC1VampireBats)
  379. PlayerActor.RemoveSpell(DLC1SupernaturalReflexes)
  380. PlayerActor.RemoveSpell(DLC1NightCloak)
  381. PlayerActor.RemoveSpell(DLC1Revert)
  382. PlayerActor.RemoveSpell(DLC1VampireLordSunDamage)
  383. PlayerActor.DispelSpell(DLC1VampireDetectLife)
  384. PlayerActor.DispelSpell(DLC1VampireMistform)
  385. PlayerActor.DispelSpell(DLC1SupernaturalReflexes)
  386. PlayerActor.DispelSpell(DLC1Revert)
  387. PlayerActor.DispelSpell(VampireHuntersSight)
  388. PlayerActor.RemoveSpell(DLC1AbVampireFloatBodyFX)
  389. pDLC1nVampireNecklaceBats.setValue((0 as Float))
  390. pDLC1nVampireNecklaceGargoyle.setValue((0 as Float))
  391. pDLC1nVampireRingBeast.setValue((0 as Float))
  392. pDLC1nVampireRingErudite.setValue((0 as Float))
  393. PlayerVampireQuest.VampireProgression(PlayerActor, PlayerVampireQuest.VampireStatus)
  394. currHealth = PlayerActor.GetAV("Health")
  395. if (currHealth <= (70 as Float))
  396. debug.Trace((("VAMPIRE: Player's health is only " + (currHealth as String)) + "; restoring."), 0)
  397. PlayerActor.RestoreAV("Health", ((70 as Float) - currHealth))
  398. endif
  399. debug.Trace(((("VAMPIRE: Setting race " + ((VampireTrackingQuest as dlc1vampiretrackingquest).PlayerRace as String)) + " on ") + (PlayerActor as String)), 0)
  400. PlayerActor.RemoveItem((DLC1VampireLordArmor as form), 2, true, None)
  401. PlayerActor.SetRace((VampireTrackingQuest as dlc1vampiretrackingquest).PlayerRace)
  402. DLC1VampireChangeBackFXS.stop((PlayerActor as objectreference))
  403. DLC1VampireChangeBack02FXS.Play((PlayerActor as objectreference), 0.10000)
  404. game.ShowFirstPersonGeometry(true)
  405. PlayerActor.SetAttackActorOnSight(false)
  406. HunterFaction.SetPlayerEnemy(false)
  407. PlayerActor.RemoveFromFaction(PlayerVampireFaction)
  408. cfIndex = 0
  409. while (cfIndex < CrimeFactions.GetSize())
  410. (CrimeFactions.GetAt(cfIndex) as faction).SetPlayerEnemy(false)
  411. cfIndex = (cfIndex + 1)
  412. endWhile
  413. game.SetPlayerReportCrime(true)
  414. utility.Wait((5 as Float))
  415. debug.Trace("OnRaceSwitchComplete event took more than 5 seconds, shutting down ourselves.", 0)
  416. EndFunction
  417.  
  418. Function CheckPerkSpells()
  419. actor PlayerActor
  420. PlayerActor = game.GetPlayer()
  421. if ((PlayerActor.HasPerk(DLC1MistFormPerk) == true) as Bool) && ((PlayerActor.HasSpell((DLC1VampireMistform as form)) == false) as Bool)
  422. PlayerActor.AddSpell(DLC1VampireMistform, false)
  423. endif
  424. if ((PlayerActor.HasPerk(DLC1DetectLifePerk) == true) as Bool) && ((PlayerActor.HasSpell((DLC1VampireDetectLife as form)) == false) as Bool)
  425. PlayerActor.AddSpell(DLC1VampireDetectLife, false)
  426. endif
  427. if ((PlayerActor.HasPerk(DLC1SupernaturalReflexesPerk) == true) as Bool) && ((PlayerActor.HasSpell((DLC1SupernaturalReflexes as form)) == false) as Bool)
  428. PlayerActor.AddSpell(DLC1SupernaturalReflexes, false)
  429. endif
  430. if ((PlayerActor.HasPerk(DLC1VampiricGrip) == true) as Bool) && ((PlayerActor.HasSpell((DLC1VampiresGrip as form)) == false) as Bool)
  431. PlayerActor.AddSpell(DLC1VampiresGrip, false)
  432. endif
  433. if ((PlayerActor.HasPerk(DLC1CorpseCursePerk) == true) as Bool) && ((PlayerActor.HasSpell((DLC1CorpseCurse as form)) == false) as Bool)
  434. PlayerActor.AddSpell(DLC1CorpseCurse, false)
  435. endif
  436. if ((PlayerActor.HasPerk(DLC1GargoylePerk) == true) as Bool) && ((PlayerActor.HasSpell((DLC1ConjureGargoyleLeftHand as form)) == false) as Bool)
  437. PlayerActor.AddSpell(DLC1ConjureGargoyleLeftHand, false)
  438. endif
  439. if ((PlayerActor.HasPerk(DLC1NightCloakPerk) == true) as Bool) && ((PlayerActor.HasSpell((DLC1NightCloak as form)) == false) as Bool)
  440. PlayerActor.AddSpell(DLC1NightCloak, false)
  441. endif
  442. EndFunction
  443.  
  444. Float Function GameTimeDaysToRealTimeSeconds(Float gametime)
  445. Float gameSeconds
  446. gameSeconds = (gametime * (((60 * 60) * 24) as Float))
  447. return (gameSeconds / TimeScale.value)
  448. EndFunction
  449.  
  450. Function Feed(actor victim)
  451. EndFunction
  452.  
  453. Function WarnPlayer()
  454. VampireWarn.Apply(1.00000)
  455. EndFunction
  456.  
  457. Function HandlePlayerLoadGame()
  458. if __prepped
  459. PreloadSpells()
  460. endif
  461. EndFunction
  462.  
  463. {Function that returns the current state}
  464. String Function GetState()
  465. return ::State
  466. EndFunction
  467.  
  468. Function EstablishLeveledSpells()
  469. actor PlayerActor
  470. Int playerLevel
  471. PlayerActor = game.GetPlayer()
  472. playerLevel = PlayerActor.GetLevel()
  473. if (playerLevel <= 10)
  474. LeveledDrainSpell = DLC1VampireDrain05
  475. LeveledRaiseDeadSpell = DLC1VampireRaiseDeadLeftHand01
  476. endif
  477. if (playerLevel <= 20)
  478. LeveledDrainSpell = DLC1VampireDrain06
  479. LeveledRaiseDeadSpell = DLC1VampireRaiseDeadLeftHand02
  480. endif
  481. if (playerLevel <= 30)
  482. LeveledDrainSpell = DLC1VampireDrain07
  483. LeveledRaiseDeadSpell = DLC1VampireRaiseDeadLeftHand03
  484. endif
  485. if (playerLevel <= 40)
  486. LeveledDrainSpell = DLC1VampireDrain08
  487. LeveledRaiseDeadSpell = DLC1VampireRaiseDeadLeftHand04
  488. endif
  489. LeveledDrainSpell = DLC1VampireDrain09
  490. LeveledRaiseDeadSpell = DLC1VampireRaiseDeadLeftHand05
  491. if (playerLevel <= 10)
  492. LeveledAbility = DLC1PlayerVampireLvl10AndBelowAbility
  493. endif
  494. if (playerLevel <= 15)
  495. LeveledAbility = DLC1PlayerVampireLvl15AndBelowAbility
  496. endif
  497. if (playerLevel <= 20)
  498. LeveledAbility = DLC1PlayerVampireLvl20AndBelowAbility
  499. endif
  500. if (playerLevel <= 25)
  501. LeveledAbility = DLC1PlayerVampireLvl25AndBelowAbility
  502. endif
  503. if (playerLevel <= 30)
  504. LeveledAbility = DLC1PlayerVampireLvl30AndBelowAbility
  505. endif
  506. if (playerLevel <= 35)
  507. LeveledAbility = DLC1PlayerVampireLvl35AndBelowAbility
  508. endif
  509. if (playerLevel <= 40)
  510. LeveledAbility = DLC1PlayerVampireLvl40AndBelowAbility
  511. endif
  512. if (playerLevel <= 45)
  513. LeveledAbility = DLC1PlayerVampireLvl45AndBelowAbility
  514. endif
  515. LeveledAbility = DLC1PlayerVampireLvl50AndOverAbility
  516. EndFunction
  517.  
  518. Function OnAnimationEventUnregistered(objectreference akSource, String asEventName)
  519. debug.Trace(((("Animation Event Unregistered for " + (akSource as String)) + ": ") + asEventName), 0)
  520. EndFunction
  521.  
  522. Function OnAnimationEvent(objectreference akActor, String akEventName)
  523. actor PlayerActor
  524. PlayerActor = game.GetPlayer()
  525. debug.Trace(((("VAMPIRE: Animation Event! " + (akActor as String)) + " ") + akEventName), 0)
  526. if (akActor == (PlayerActor as objectreference))
  527. if (akEventName == TransformToHuman)
  528. ActuallyShiftBackIfNecessary()
  529. endif
  530. if (akEventName == BiteStart)
  531. debug.Trace("VAMPIRE: Handle BiteStart", 0)
  532. DLC1VampireBloodPoints.value = (DLC1VampireBloodPoints.value + (1 as Float))
  533. if (DLC1VampireTotalPerksEarned.value < DLC1VampireMaxPerks.value)
  534. DLC1BloodPointsMsg.Show(0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000)
  535. debug.Trace(("VAMPIRE: Bite kill move, Blood " + (DLC1VampireBloodPoints.value as String)), 0)
  536. if (DLC1VampireBloodPoints.value >= DLC1VampireNextPerk.value)
  537. DLC1VampireBloodPoints.value = (DLC1VampireBloodPoints.value - DLC1VampireNextPerk.value)
  538. DLC1VampirePerkPoints.value = (DLC1VampirePerkPoints.value + (1 as Float))
  539. DLC1VampireTotalPerksEarned.value = (DLC1VampireTotalPerksEarned.value + (1 as Float))
  540. DLC1VampireNextPerk.value = (DLC1VampireNextPerk.value + (2 as Float))
  541. DLC1VampirePerkEarned.Show(0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000)
  542. endif
  543. PlayerActor.SetActorValue("VampirePerks", ((DLC1VampireBloodPoints.value / DLC1VampireNextPerk.value) * (100 as Float)))
  544. endif
  545. if (PlayerActor.HasPerk(DLC1VampireBite) == (1 as Bool))
  546. PlayerActor.RestoreActorValue("Health", DLC1BiteHealthRecover)
  547. endif
  548. PlayerActor.SetActorValue("VampirePerks", ((DLC1VampireBloodPoints.value / DLC1VampireNextPerk.value) * (100 as Float)))
  549. game.IncrementStat("Necks Bitten", 1)
  550. endif
  551. if (akEventName == LandStart)
  552. debug.Trace("VAMPIRE: Handle LandStart", 0)
  553. DCL1VampireLevitateStateGlobal.setValue((1 as Float))
  554. endif
  555. if (akEventName == Ground)
  556. debug.Trace("VAMPIRE: Handle GroundStart", 0)
  557. DCL1VampireLevitateStateGlobal.setValue((1 as Float))
  558. CurrentEquippedLeftSpell = PlayerActor.GetEquippedSpell(0)
  559. debug.Trace(("VAMPIRE: saving equipped left spell " + (CurrentEquippedLeftSpell as String)), 0)
  560. if !((CurrentEquippedLeftSpell == None))
  561. PlayerActor.UnequipSpell(CurrentEquippedLeftSpell, 0)
  562. endif
  563. PlayerActor.UnequipSpell(LeveledDrainSpell, 1)
  564. PlayerActor.RemoveSpell(LeveledRaiseDeadSpell)
  565. PlayerActor.RemoveSpell(DLC1CorpseCurse)
  566. PlayerActor.RemoveSpell(DLC1VampiresGrip)
  567. PlayerActor.RemoveSpell(DLC1ConjureGargoyleLeftHand)
  568. endif
  569. if (akEventName == LiftoffStart)
  570. debug.Trace("VAMPIRE: Handle LiftoffStart", 0)
  571. DCL1VampireLevitateStateGlobal.setValue((2 as Float))
  572. endif
  573. if (akEventName == Levitate)
  574. debug.Trace("VAMPIRE: Handle LevitateStart", 0)
  575. DCL1VampireLevitateStateGlobal.setValue((2 as Float))
  576. PlayerActor.EquipSpell(LeveledDrainSpell, 1)
  577. if ((DialogueGenericVampire as vampirequestscript).LastLeftHandSpell == None)
  578. (DialogueGenericVampire as vampirequestscript).LastLeftHandSpell = DLC1VampireRaiseDeadLeftHand01
  579. endif
  580. if (CurrentEquippedLeftSpell == None)
  581. CurrentEquippedLeftSpell = (DialogueGenericVampire as vampirequestscript).LastLeftHandSpell
  582. debug.Trace(("VAMPIRE: Spell from last session set as current last spell = " + (CurrentEquippedLeftSpell as String)), 0)
  583. endif
  584. CheckPerkSpells()
  585. PlayerActor.AddSpell(LeveledRaiseDeadSpell, false)
  586. PlayerActor.EquipSpell(CurrentEquippedLeftSpell, 0)
  587. debug.Trace(("VAMPIRE: Last spell left eqiupped = " + (CurrentEquippedLeftSpell as String)), 0)
  588. PlayerActor.EquipSpell(LeveledDrainSpell, 1)
  589. debug.Trace(("VAMPIRE: Last spell right eqiupped = " + (LeveledDrainSpell as String)), 0)
  590. endif
  591. endif
  592. EndFunction
  593.  
  594. Function UnregisterForEvents()
  595. actor PlayerActor
  596. debug.Trace("Unregistering for Animation Events", 0)
  597. PlayerActor = game.GetPlayer()
  598. UnRegisterForAnimationEvent((PlayerActor as objectreference), Ground)
  599. UnRegisterForAnimationEvent((PlayerActor as objectreference), Levitate)
  600. UnRegisterForAnimationEvent((PlayerActor as objectreference), BiteStart)
  601. UnRegisterForAnimationEvent((PlayerActor as objectreference), LiftoffStart)
  602. UnRegisterForAnimationEvent((PlayerActor as objectreference), LandStart)
  603. UnRegisterForAnimationEvent((PlayerActor as objectreference), TransformToHuman)
  604. EndFunction
  605.  
  606. Function OnUpdate()
  607. actor PlayerActor
  608. PlayerActor = game.GetPlayer()
  609. game.SetInCharGen(false, false, false)
  610. debug.Trace(("VAMPIRE: Perks stat = " + (game.QueryStat("NumVampirePerks") as String)), 0)
  611. if ((game.QueryStat("NumVampirePerks") as Float) >= DLC1VampireMaxPerks.value) game.AddAchievement(58)
  612. endif
  613. && Untimed
  614. return
  615. endif
  616. if ((PlayerActor.HasMagicEffect(DLC1RevertEffect) == true) as Bool)
  617. if ((!(PlayerActor.IsInKillMove()) as Bool) as Bool) && (!(__tryingToShiftBack) as Bool)
  618. debug.Trace("VAMPIRE: Revert effect detected", 0)
  619. Revert()
  620. endif
  621. game.ForceThirdPerson()
  622. EndFunction
  623.  
  624. Function InitialShift()
  625. actor PlayerActor
  626. debug.Trace("VAMPIRE: Player beginning transformation.", 0)
  627. PlayerActor = game.GetPlayer()
  628. VampireWarn.Apply(1.00000)
  629. if PlayerActor.IsDead()
  630. debug.Trace("VAMPIRE: Player is dead; bailing out.", 0)
  631. return
  632. endif
  633. PlayerActor.GetActorBase()
  634. PlayerActor.GetActorBase().SetInvulnerable(true)
  635. PlayerActor.SetGhost(true)
  636. PlayerActor.SetRace(VampireLordRace)
  637. PlayerActor.AddSpell(DLC1AbVampireFloatBodyFX, false)
  638. EndFunction
  639.  
  640. Float Function RealTimeSecondsToGameTimeDays(Float realtime)
  641. Float scaledSeconds
  642. scaledSeconds = (realtime * TimeScale.value)
  643. return (scaledSeconds / (((60 * 60) * 24) as Float))
  644. EndFunction
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement