Jump to content

Skyrim Modding Problem


SirBeasty

Recommended Posts

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
;------Variables
Actor 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() == 10
ConditionsQuest.SetStage(20)
ElseIf Player.IsSneaking() == 1 && BoonsQuest.GetStage() == 10
ConditionsQuest.SetStage(30)
ElseIf Player.GetCurrentLocation().HasKeyword(LocTypeStore) == 1 && BoonsQuest.GetStage() == 10
ConditionsQuest.SetStage(40)
;ElseIf Player.GetAVPercentage("CarryWeight") <= CWThreshold && BoonsQuest.GetStage() == 10
; ConditionsQuest.SetStage(50)
EndIf
EndEvent
Event OnMenuOpen(String MenuName)
if BoonsQuest.GetStage() == 10
if MenuName == "Crafting Menu"
ConditionsQuest.SetStage(60)
endif
EndIf
EndEvent
;Function HealthLowFunction()
; BoonsQuest.SetStage(110)
; ConditionsQuest.Reset()
;EndFunction
Function InCombatFunction()
int ComRandInt = utility.randomint(4, 20)
if ComRandInt >= 1 && ComRandInt <= 3
BoonsQuest.SetStage(20)
ElseIf ComRandInt >= 4 && ComRandInt <= 7
BoonsQuest.SetStage(30)
ElseIf ComRandInt >= 8 && ComRandInt <= 9
BoonsQuest.SetStage(40)
ElseIf ComRandInt >= 10 && ComRandInt <= 12
BoonsQuest.SetStage(60)
ElseIf ComRandInt >= 13 && ComRandInt <= 15
BoonsQuest.SetStage(90)
ElseIf ComRandInt >= 16 && ComRandInt <= 18
BoonsQuest.SetStage(120)
ElseIf ComRandInt >= 19 && ComRandInt <= 20
BoonsQuest.SetStage(130)
EndIf
ConditionsQuest.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() == 10
LastResortConditions.SetStage(10)
EndIf
EndEvent
Function HealthLowFunction()
LastResortQuest.SetStage(20)
LastResortConditions.Reset()
EndFunction
Edited by SirBeasty
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...