Advertisement
Guest User

Thunderchild meditation script

a guest
Jun 30th, 2016
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.23 KB | None | 0 0
  1. Scriptname TC_MeditationMarker_Script extends ActiveMagicEffect
  2.  
  3. ; -----
  4.  
  5. ObjectReference Property TC_MeditationMarker Auto
  6.  
  7. WordOfPower[] Property Word1Known Auto
  8. WordOfPower[] Property Word1Add Auto
  9. {1 2 and 3 are defined based on new shouts}
  10.  
  11. WordOfPower[] Property Word2Known Auto
  12. WordOfPower[] Property Word2Add Auto
  13.  
  14. WordOfPower[] Property Word3Known Auto
  15. WordOfPower[] Property Word3Add Auto
  16.  
  17. Spell Property TC_MeditationSpell Auto
  18.  
  19. Float Property TC_DelayBeforeTrance = 6.0 Auto
  20.  
  21. Float Property TC_ThresholdAboveZero = 0.2 Auto
  22.  
  23. Message Property TC_MeditationTooShort Auto
  24. Message Property TC_MeditationTooLong Auto
  25. Message Property TC_MeditationSuccess Auto
  26.  
  27. Message Property TC_MeditationPct Auto
  28.  
  29. ImagespaceModifier Property TC_MeditationISMD Auto
  30. ImagespaceModifier Property TC_MeditationISMDIn Auto
  31. ImagespaceModifier Property TC_MeditationISMDOvertime Auto
  32.  
  33. MusicType Property TC_MeditateMusicType Auto
  34.  
  35. ActorBase[] Property TC_VoicewraithActor Auto
  36.  
  37. EncounterZone Property TC_HighHrotgarLibraryZone Auto
  38.  
  39. Spell Property TC_VoicewraithSpell Auto
  40. Float Property TC_VoicewraithChance Auto
  41.  
  42. Sound Property TC_MeditationMarkerFailThunder Auto
  43.  
  44. GlobalVariable Property TC_KyneFaithGlobal Auto
  45. GlobalVariable Property TC_KyneFaithGlobalThreshold2 Auto
  46. GlobalVariable Property TC_KyneFaithGlobalThreshold3 Auto
  47.  
  48. TC_KyneFaithQuest_Script Property TC_KyneFaithQuestScript Auto
  49. Quest Property TC_Questline_Quest_AcolyteOfTheVoice Auto
  50. Int Property TC_BonusAmount Auto
  51.  
  52. Bool[] Property WordActivated Auto
  53.  
  54. Message Property TC_HelpMeditate_Message Auto
  55. String Property TC_HelpEvent Auto
  56. Int Property TC_HelpNumberOfTimes Auto
  57. Int Property TC_HelpDuration Auto
  58. Int Property TC_HelpDelay Auto
  59.  
  60. Float Property TC_VoicewraithMinFaith Auto
  61.  
  62. Message Property TC_MeditationSuccessAndYes Auto
  63. Message Property TC_MeditationSuccessButNope Auto
  64.  
  65. Location Property HighHrothgarLocation Auto
  66.  
  67. Actor Property PlayerRef Auto
  68.  
  69. GlobalVariable Property TC_DisableMeditationEffects_Global Auto
  70.  
  71. ; -----
  72.  
  73. Float PlayerStaminaMax
  74.  
  75. ; -----
  76.  
  77. Event OnSit(ObjectReference akFurniture)
  78.  
  79. If akFurniture == TC_MeditationMarker
  80. If PlayerRef.GetCurrentLocation() == HighHrothgarLocation
  81. Debug.Trace("THUNDERCHILD DEBUG: Sitting down to meditate!",0)
  82. Game.DisablePlayerControls(false, true, true, false, true, true, true, true, 0)
  83. Game.ForceThirdPerson()
  84. PlayerRef.RestoreActorValue("Stamina", 9999)
  85. Utility.Wait(0.05)
  86. PlayerStaminaMax = PlayerRef.GetActorValue("Stamina")
  87. TC_MeditationPct.Show(TC_ThresholdAboveZero * 100)
  88. PlayerRef.AddSpell(TC_MeditationSpell,false)
  89. RegisterForSingleUpdate(TC_DelayBeforeTrance)
  90. Else
  91. Debug.Trace("THUNDERCHILD ERROR: OnSit() has been prevented from triggering at the wrong time! Please report this to Enai along with a description what you were doing!",2)
  92. EndIf
  93. EndIf
  94.  
  95. EndEvent
  96.  
  97. ; -----
  98.  
  99. Event OnGetUp(ObjectReference akFurniture)
  100.  
  101. If akFurniture == TC_MeditationMarker
  102. If PlayerRef.GetCurrentLocation() == HighHrothgarLocation
  103. Debug.Trace("THUNDERCHILD DEBUG: Standing up from meditation!",0)
  104. Float PlayerCurrentStamina = PlayerRef.GetActorValue("Stamina")
  105. PlayerRef.RemoveSpell(TC_MeditationSpell)
  106.  
  107. UnregisterForUpdate()
  108.  
  109. Game.EnablePlayerControls()
  110. Game.SetHudCartMode(false)
  111. If TC_DisableMeditationEffects_Global.GetValue() == 0
  112. TC_MeditateMusicType.Remove()
  113. EndIf
  114.  
  115. If PlayerCurrentStamina < 0.1
  116. Debug.Trace("THUNDERCHILD DEBUG: Meditation too long! Suffer!", 0)
  117. If TC_DisableMeditationEffects_Global.GetValue() == 0
  118. TC_MeditationISMD.Remove()
  119. TC_MeditationTooLong.Show()
  120. TC_MeditationISMDOvertime.Apply()
  121. EndIf
  122. TC_MeditationMarker.KnockAreaEffect(5,2048)
  123. TC_MeditationMarkerFailThunder.Play(PlayerRef)
  124. If Utility.RandomFloat(0,1) < TC_VoicewraithChance && TC_KyneFaithGlobal.GetValueInt() >= TC_VoicewraithMinFaith
  125. Int WhichWraith = Utility.RandomInt(0,(TC_VoicewraithActor.Length - 1))
  126. Actor SpawnedWraith = PlayerRef.PlaceActorAtMe(TC_VoicewraithActor[WhichWraith], 2, TC_HighHrotgarLibraryZone)
  127. SpawnedWraith.AddSpell(TC_VoicewraithSpell)
  128. SpawnedWraith.SetAngle(SpawnedWraith.GetAngleX(), SpawnedWraith.GetAngleY(), (SpawnedWraith.GetAngleZ() + SpawnedWraith.GetHeadingAngle(Game.GetPlayer())))
  129. EndIf
  130.  
  131. Else
  132. If PlayerCurrentStamina <= (PlayerStaminaMax * TC_ThresholdAboveZero)
  133. Debug.Trace("THUNDERCHILD DEBUG: Meditation was successful!",0)
  134. If TC_DisableMeditationEffects_Global.GetValue() == 0
  135. TC_MeditationSuccess.Show()
  136. TC_MeditationISMD.Remove()
  137. TC_MeditationISMDIn.Apply()
  138. EndIf
  139. If TC_Questline_Quest_AcolyteOfTheVoice.IsRunning() && TC_Questline_Quest_AcolyteOfTheVoice.GetStage() < 10
  140. TC_Questline_Quest_AcolyteOfTheVoice.SetStage(10)
  141. EndIf
  142.  
  143. ; start adding words
  144. Int i = 0
  145. Int FaithCur = TC_KyneFaithGlobal.GetValue() as Int
  146. Int Faith2= TC_KyneFaithGlobalThreshold2.GetValue() as Int
  147. Int Faith3 = TC_KyneFaithGlobalThreshold3.GetValue() as Int
  148.  
  149. Bool TaughtSomething = false
  150. While i < Word1Add.Length
  151. If Game.IsWordUnlocked(Word1Known[i]) && !Game.IsWordUnlocked(Word1Add[i])
  152. Game.TeachWord(Word1Add[i])
  153. Game.UnlockWord(Word1Add[i])
  154. TaughtSomething = true
  155. EndIf
  156. If FaithCur >= Faith2 && Game.IsWordUnlocked(Word2Known[i]) && !Game.IsWordUnlocked(Word2Add[i]) && Game.IsWordUnlocked(Word1Add[i])
  157. Game.TeachWord(Word2Add[i])
  158. Game.UnlockWord(Word2Add[i])
  159. TaughtSomething = true
  160. EndIf
  161. If FaithCur >= Faith3 && Game.IsWordUnlocked(Word3Known[i]) && !Game.IsWordUnlocked(Word3Add[i]) && Game.IsWordUnlocked(Word2Add[i])
  162. Game.TeachWord(Word3Add[i])
  163. Game.UnlockWord(Word3Add[i])
  164. TaughtSomething = true
  165. EndIf
  166. i += 1
  167. EndWhile
  168. If TaughtSomething
  169. TC_MeditationSuccessAndYes.Show()
  170. Else
  171. TC_MeditationSuccessButNope.Show()
  172. EndIf
  173.  
  174. i = 0
  175. Bool KnowsEverything = true
  176. While i < Word1Known.Length
  177. If !Game.IsWordUnlocked(Word1Known[i]) || !Game.IsWordUnlocked(Word2Known[i]) || !Game.IsWordUnlocked(Word3Known[i])
  178. KnowsEverything = false
  179. i = 999
  180. EndIf
  181. i += 1
  182. EndWhile
  183. Utility.Wait(0.1)
  184. If KnowsEverything && TC_Questline_Quest_AcolyteOfTheVoice.GetStage() == 30
  185. TC_Questline_Quest_AcolyteOfTheVoice.SetStage(200)
  186. EndIf
  187.  
  188. ; end adding words
  189. TC_KyneFaithQuestScript.AddFaithPoints(TC_BonusAmount,false)
  190. Else
  191. Debug.Trace("THUNDERCHILD DEBUG: Meditation too short! Nothing happens!",0)
  192. If TC_DisableMeditationEffects_Global.GetValue() == 0
  193. TC_MeditationISMD.Remove()
  194. TC_MeditationTooShort.Show()
  195. EndIf
  196. EndIf
  197. EndIf
  198.  
  199. Else
  200. Debug.Trace("THUNDERCHILD ERROR: OnGetUp() has been prevented from triggering at the wrong time! Please report this to Enai along with a description what you were doing!",2)
  201. EndIf
  202. EndIf
  203.  
  204. EndEvent
  205.  
  206. ; -----
  207.  
  208. Event OnUpdate()
  209.  
  210. Debug.Trace("THUNDERCHILD DEBUG: Entering trance!", 0)
  211. Game.SetHudCartMode(true)
  212. If TC_DisableMeditationEffects_Global.GetValue() == 0
  213. TC_MeditationISMDIn.Apply()
  214. TC_MeditationISMD.Apply()
  215. TC_MeditateMusicType.Add()
  216. EndIf
  217.  
  218. EndEvent
  219.  
  220. ; -----
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement