Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Scriptname TC_MeditationMarker_Script extends ActiveMagicEffect
- ; -----
- ObjectReference Property TC_MeditationMarker Auto
- WordOfPower[] Property Word1Known Auto
- WordOfPower[] Property Word1Add Auto
- {1 2 and 3 are defined based on new shouts}
- WordOfPower[] Property Word2Known Auto
- WordOfPower[] Property Word2Add Auto
- WordOfPower[] Property Word3Known Auto
- WordOfPower[] Property Word3Add Auto
- Spell Property TC_MeditationSpell Auto
- Float Property TC_DelayBeforeTrance = 6.0 Auto
- Float Property TC_ThresholdAboveZero = 0.2 Auto
- Message Property TC_MeditationTooShort Auto
- Message Property TC_MeditationTooLong Auto
- Message Property TC_MeditationSuccess Auto
- Message Property TC_MeditationPct Auto
- ImagespaceModifier Property TC_MeditationISMD Auto
- ImagespaceModifier Property TC_MeditationISMDIn Auto
- ImagespaceModifier Property TC_MeditationISMDOvertime Auto
- MusicType Property TC_MeditateMusicType Auto
- ActorBase[] Property TC_VoicewraithActor Auto
- EncounterZone Property TC_HighHrotgarLibraryZone Auto
- Spell Property TC_VoicewraithSpell Auto
- Float Property TC_VoicewraithChance Auto
- Sound Property TC_MeditationMarkerFailThunder Auto
- GlobalVariable Property TC_KyneFaithGlobal Auto
- GlobalVariable Property TC_KyneFaithGlobalThreshold2 Auto
- GlobalVariable Property TC_KyneFaithGlobalThreshold3 Auto
- TC_KyneFaithQuest_Script Property TC_KyneFaithQuestScript Auto
- Quest Property TC_Questline_Quest_AcolyteOfTheVoice Auto
- Int Property TC_BonusAmount Auto
- Bool[] Property WordActivated Auto
- Message Property TC_HelpMeditate_Message Auto
- String Property TC_HelpEvent Auto
- Int Property TC_HelpNumberOfTimes Auto
- Int Property TC_HelpDuration Auto
- Int Property TC_HelpDelay Auto
- Float Property TC_VoicewraithMinFaith Auto
- Message Property TC_MeditationSuccessAndYes Auto
- Message Property TC_MeditationSuccessButNope Auto
- Location Property HighHrothgarLocation Auto
- Actor Property PlayerRef Auto
- GlobalVariable Property TC_DisableMeditationEffects_Global Auto
- ; -----
- Float PlayerStaminaMax
- ; -----
- Event OnSit(ObjectReference akFurniture)
- If akFurniture == TC_MeditationMarker
- If PlayerRef.GetCurrentLocation() == HighHrothgarLocation
- Debug.Trace("THUNDERCHILD DEBUG: Sitting down to meditate!",0)
- Game.DisablePlayerControls(false, true, true, false, true, true, true, true, 0)
- Game.ForceThirdPerson()
- PlayerRef.RestoreActorValue("Stamina", 9999)
- Utility.Wait(0.05)
- PlayerStaminaMax = PlayerRef.GetActorValue("Stamina")
- TC_MeditationPct.Show(TC_ThresholdAboveZero * 100)
- PlayerRef.AddSpell(TC_MeditationSpell,false)
- RegisterForSingleUpdate(TC_DelayBeforeTrance)
- Else
- 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)
- EndIf
- EndIf
- EndEvent
- ; -----
- Event OnGetUp(ObjectReference akFurniture)
- If akFurniture == TC_MeditationMarker
- If PlayerRef.GetCurrentLocation() == HighHrothgarLocation
- Debug.Trace("THUNDERCHILD DEBUG: Standing up from meditation!",0)
- Float PlayerCurrentStamina = PlayerRef.GetActorValue("Stamina")
- PlayerRef.RemoveSpell(TC_MeditationSpell)
- UnregisterForUpdate()
- Game.EnablePlayerControls()
- Game.SetHudCartMode(false)
- If TC_DisableMeditationEffects_Global.GetValue() == 0
- TC_MeditateMusicType.Remove()
- EndIf
- If PlayerCurrentStamina < 0.1
- Debug.Trace("THUNDERCHILD DEBUG: Meditation too long! Suffer!", 0)
- If TC_DisableMeditationEffects_Global.GetValue() == 0
- TC_MeditationISMD.Remove()
- TC_MeditationTooLong.Show()
- TC_MeditationISMDOvertime.Apply()
- EndIf
- TC_MeditationMarker.KnockAreaEffect(5,2048)
- TC_MeditationMarkerFailThunder.Play(PlayerRef)
- If Utility.RandomFloat(0,1) < TC_VoicewraithChance && TC_KyneFaithGlobal.GetValueInt() >= TC_VoicewraithMinFaith
- Int WhichWraith = Utility.RandomInt(0,(TC_VoicewraithActor.Length - 1))
- Actor SpawnedWraith = PlayerRef.PlaceActorAtMe(TC_VoicewraithActor[WhichWraith], 2, TC_HighHrotgarLibraryZone)
- SpawnedWraith.AddSpell(TC_VoicewraithSpell)
- SpawnedWraith.SetAngle(SpawnedWraith.GetAngleX(), SpawnedWraith.GetAngleY(), (SpawnedWraith.GetAngleZ() + SpawnedWraith.GetHeadingAngle(Game.GetPlayer())))
- EndIf
- Else
- If PlayerCurrentStamina <= (PlayerStaminaMax * TC_ThresholdAboveZero)
- Debug.Trace("THUNDERCHILD DEBUG: Meditation was successful!",0)
- If TC_DisableMeditationEffects_Global.GetValue() == 0
- TC_MeditationSuccess.Show()
- TC_MeditationISMD.Remove()
- TC_MeditationISMDIn.Apply()
- EndIf
- If TC_Questline_Quest_AcolyteOfTheVoice.IsRunning() && TC_Questline_Quest_AcolyteOfTheVoice.GetStage() < 10
- TC_Questline_Quest_AcolyteOfTheVoice.SetStage(10)
- EndIf
- ; start adding words
- Int i = 0
- Int FaithCur = TC_KyneFaithGlobal.GetValue() as Int
- Int Faith2= TC_KyneFaithGlobalThreshold2.GetValue() as Int
- Int Faith3 = TC_KyneFaithGlobalThreshold3.GetValue() as Int
- Bool TaughtSomething = false
- While i < Word1Add.Length
- If Game.IsWordUnlocked(Word1Known[i]) && !Game.IsWordUnlocked(Word1Add[i])
- Game.TeachWord(Word1Add[i])
- Game.UnlockWord(Word1Add[i])
- TaughtSomething = true
- EndIf
- If FaithCur >= Faith2 && Game.IsWordUnlocked(Word2Known[i]) && !Game.IsWordUnlocked(Word2Add[i]) && Game.IsWordUnlocked(Word1Add[i])
- Game.TeachWord(Word2Add[i])
- Game.UnlockWord(Word2Add[i])
- TaughtSomething = true
- EndIf
- If FaithCur >= Faith3 && Game.IsWordUnlocked(Word3Known[i]) && !Game.IsWordUnlocked(Word3Add[i]) && Game.IsWordUnlocked(Word2Add[i])
- Game.TeachWord(Word3Add[i])
- Game.UnlockWord(Word3Add[i])
- TaughtSomething = true
- EndIf
- i += 1
- EndWhile
- If TaughtSomething
- TC_MeditationSuccessAndYes.Show()
- Else
- TC_MeditationSuccessButNope.Show()
- EndIf
- i = 0
- Bool KnowsEverything = true
- While i < Word1Known.Length
- If !Game.IsWordUnlocked(Word1Known[i]) || !Game.IsWordUnlocked(Word2Known[i]) || !Game.IsWordUnlocked(Word3Known[i])
- KnowsEverything = false
- i = 999
- EndIf
- i += 1
- EndWhile
- Utility.Wait(0.1)
- If KnowsEverything && TC_Questline_Quest_AcolyteOfTheVoice.GetStage() == 30
- TC_Questline_Quest_AcolyteOfTheVoice.SetStage(200)
- EndIf
- ; end adding words
- TC_KyneFaithQuestScript.AddFaithPoints(TC_BonusAmount,false)
- Else
- Debug.Trace("THUNDERCHILD DEBUG: Meditation too short! Nothing happens!",0)
- If TC_DisableMeditationEffects_Global.GetValue() == 0
- TC_MeditationISMD.Remove()
- TC_MeditationTooShort.Show()
- EndIf
- EndIf
- EndIf
- Else
- 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)
- EndIf
- EndIf
- EndEvent
- ; -----
- Event OnUpdate()
- Debug.Trace("THUNDERCHILD DEBUG: Entering trance!", 0)
- Game.SetHudCartMode(true)
- If TC_DisableMeditationEffects_Global.GetValue() == 0
- TC_MeditationISMDIn.Apply()
- TC_MeditationISMD.Apply()
- TC_MeditateMusicType.Add()
- EndIf
- EndEvent
- ; -----
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement