SirBeasty Posted April 17, 2018 Share Posted April 17, 2018 (edited) I am working on a part of my mod where I am trying to cast a spell on the player through a script when a condition is met and then set it to cooldown. I have managed to get everything working, except when I decided to move one of my spells cast to a seperate cooldown timer, it now casts whenever the cooldown runs out, which I do not want. Any help would be appreciated in explaining why this is happening. I am almost positive that has to do with the if statement, as everything still works except for the script waiting for the conditions to be met. This is the original script that is in charge of checking for conditions: Scriptname SirBeastBoonsConditionScript extends Quest import utility ;------VariablesActor Property Player Auto Quest Property BoonsQuest Auto ReferenceAlias Property InCombat Auto ReferenceAlias Property HealthIsLow Auto ReferenceAlias Property IsInStore Auto ReferenceAlias Property IsSneaking Auto Quest Property ConditionsQuest Auto Int Property IsCrafting Auto Keyword Property LocTypeStore Auto float Property HPThreshold = 0.30 Auto float Property CWThreshold = 0.98 Auto GlobalVariable Property BoonsToggle Auto ;-------Events Event OnInit()RegisterForMenu("Crafting Menu")RegisterForUpdate(5.0)EndEvent Event OnUpdate();If Player.GetAVPercentage("Health") <= HPThreshold && BoonsQuest.GetStage() == 10; ConditionsQuest.SetStage(10)If Player.IsInCombat() == 1 && BoonsQuest.GetStage() == 10ConditionsQuest.SetStage(20)ElseIf Player.IsSneaking() == 1 && BoonsQuest.GetStage() == 10ConditionsQuest.SetStage(30)ElseIf Player.GetCurrentLocation().HasKeyword(LocTypeStore) == 1 && BoonsQuest.GetStage() == 10ConditionsQuest.SetStage(40);ElseIf Player.GetAVPercentage("CarryWeight") <= CWThreshold && BoonsQuest.GetStage() == 10; ConditionsQuest.SetStage(50)EndIfEndEvent Event OnMenuOpen(String MenuName)if BoonsQuest.GetStage() == 10 if MenuName == "Crafting Menu" ConditionsQuest.SetStage(60) endifEndIfEndEvent ;Function HealthLowFunction(); BoonsQuest.SetStage(110); ConditionsQuest.Reset();EndFunction Function InCombatFunction()int ComRandInt = utility.randomint(4, 20)if ComRandInt >= 1 && ComRandInt <= 3BoonsQuest.SetStage(20)ElseIf ComRandInt >= 4 && ComRandInt <= 7BoonsQuest.SetStage(30)ElseIf ComRandInt >= 8 && ComRandInt <= 9BoonsQuest.SetStage(40)ElseIf ComRandInt >= 10 && ComRandInt <= 12BoonsQuest.SetStage(60)ElseIf ComRandInt >= 13 && ComRandInt <= 15BoonsQuest.SetStage(90)ElseIf ComRandInt >= 16 && ComRandInt <= 18BoonsQuest.SetStage(120)ElseIf ComRandInt >= 19 && ComRandInt <= 20BoonsQuest.SetStage(130)EndIfConditionsQuest.Reset()EndFunction Function IsSneakingFunction()BoonsQuest.SetStage(100)ConditionsQuest.Reset()EndFunction Function IsInStoreFunction()BoonsQuest.SetStage(80)ConditionsQuest.Reset()EndFunction Function IsOverburdenedFunction()BoonsQuest.SetStage(50)ConditionsQuest.Reset()EndFunction Function IsCraftingFunction()BoonsQuest.SetStage(70)ConditionsQuest.Reset()EndFunction And here is the new script that seperates the heal buff from the rest: Scriptname SirBeastLastResortConditionsScript Extends Quest import utility ;-----Variables MiscObject Property GhostGem Auto Actor Property Player Auto Quest Property EviriBoonQuest Auto SPELL Property LastResort Auto Quest Property LastResortQuest Auto Quest Property LastResortConditions Auto float Property HPThreshold = 0.30 Auto GlobalVariable Property BoonsToggle Auto ;-------Events Event OnInit()RegisterForUpdate(5.0)EndEvent Event OnUpdate()If Player.GetAVPercentage("Health") <= HPThreshold && LastResortQuest.GetStage() == 10LastResortConditions.SetStage(10)EndIfEndEvent Function HealthLowFunction()LastResortQuest.SetStage(20)LastResortConditions.Reset()EndFunction Edited April 17, 2018 by SirBeasty Link to comment Share on other sites More sharing options...
Recommended Posts