Refactored ingredient tracking in The Elixir: removed scripts from ingredients, moved logic to player alias in FS_NQ05, replaced custom globals tracking with ModObjectiveGlobal, automatically toggling objective status

This commit is contained in:
Eddoursul 2021-10-26 04:19:18 +02:00
parent 526342f179
commit 906c698b8a
13 changed files with 106 additions and 82 deletions

Binary file not shown.

Binary file not shown.

View File

@ -22,21 +22,23 @@ EndFunction
Function UpdateGlobals()
_00E_FS_NQ05_VynrootCountGlobal.SetValue(PlayerREF.GetItemCount(Vynroot))
_00E_FS_NQ05_SkeeverTailCountGlobal.SetValue(PlayerREF.GetItemCount(SkeeverTail))
_00E_FS_NQ05_MothWingMonarchCountGlobal.SetValue(PlayerREF.GetItemCount(MothWingMonarch))
_00E_FS_NQ05_GarlicCountGlobal.SetValue(PlayerREF.GetItemCount(Garlic))
wait(0.9)
UpdateCurrentInstanceGlobal(_00E_FS_NQ05_VynrootCountGlobal)
UpdateCurrentInstanceGlobal(_00E_FS_NQ05_SkeeverTailCountGlobal)
UpdateCurrentInstanceGlobal(_00E_FS_NQ05_MothWingMonarchCountGlobal)
UpdateCurrentInstanceGlobal(_00E_FS_NQ05_GarlicCountGlobal)
wait(0.1)
_00E_FS_NQ05_VynrootCountGlobal.SetValue(0)
_00E_FS_NQ05_SkeeverTailCountGlobal.SetValue(0)
_00E_FS_NQ05_MothWingMonarchCountGlobal.SetValue(0)
_00E_FS_NQ05_GarlicCountGlobal.SetValue(0)
SetObjectiveDisplayed(36)
SetObjectiveDisplayed(37)
SetObjectiveDisplayed(38)
SetObjectiveDisplayed(39)
Wait(1.5)
ModObjectiveGlobal(PlayerREF.GetItemCount(SkeeverTail), _00E_FS_NQ05_SkeeverTailCountGlobal, 36, 1, true, true, true)
ModObjectiveGlobal(PlayerREF.GetItemCount(Garlic), _00E_FS_NQ05_GarlicCountGlobal, 37, 1, true, true, true)
ModObjectiveGlobal(PlayerREF.GetItemCount(MothWingMonarch), _00E_FS_NQ05_MothWingMonarchCountGlobal, 38, 1, true, true, true)
ModObjectiveGlobal(PlayerREF.GetItemCount(Vynroot), _00E_FS_NQ05_VynrootCountGlobal, 39, 1, true, true, true)
EndFunction
Function TestFunction() ;DELETE FOR RELEASE

View File

@ -1,23 +1,6 @@
Scriptname _00E_FS_NQ05_GarlicScript extends ObjectReference
Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)
If FS_NQ05.GetStage() == 35
If akNewContainer == PlayerREF
_00E_FS_NQ05_GarlicCountGlobal.SetValue(PlayerREF.GetItemCount(Garlic))
FS_NQ05.UpdateCurrentInstanceGlobal(_00E_FS_NQ05_GarlicCountGlobal)
FS_NQ05.SetObjectiveDisplayed(37, true, true)
ElseIf akOldContainer == PlayerREF
_00E_FS_NQ05_GarlicCountGlobal.SetValue(PlayerREF.GetItemCount(Garlic))
FS_NQ05.UpdateCurrentInstanceGlobal(_00E_FS_NQ05_GarlicCountGlobal)
FS_NQ05.SetObjectiveDisplayed(37, true, true)
EndIf
EndIf
EndEvent
; Replaced with OnItemAdded/OnItemRemoved in _00E_FS_NQ05_PlayerAlias
Actor Property PlayerREF Auto
Quest Property FS_NQ05 Auto

View File

@ -1,23 +1,6 @@
Scriptname _00E_FS_NQ05_MonarchScript extends ObjectReference
Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)
If FS_NQ05.GetStage() == 35
If akNewContainer == PlayerREF
_00E_FS_NQ05_MothWingMonarchCountGlobal.SetValue(PlayerREF.GetItemCount(MothWingMonarch))
FS_NQ05.UpdateCurrentInstanceGlobal(_00E_FS_NQ05_MothWingMonarchCountGlobal)
FS_NQ05.SetObjectiveDisplayed(38, true, true)
ElseIf akOldContainer == PlayerREF
_00E_FS_NQ05_MothWingMonarchCountGlobal.SetValue(PlayerREF.GetItemCount(MothWingMonarch))
FS_NQ05.UpdateCurrentInstanceGlobal(_00E_FS_NQ05_MothWingMonarchCountGlobal)
FS_NQ05.SetObjectiveDisplayed(38, true, true)
EndIf
EndIf
EndEvent
; Replaced with OnItemAdded/OnItemRemoved in _00E_FS_NQ05_PlayerAlias
Actor Property PlayerREF Auto
Quest Property FS_NQ05 Auto

View File

@ -0,0 +1,90 @@
Scriptname _00E_FS_NQ05_PlayerAlias extends ReferenceAlias
Event OnInit()
AddInventoryEventFilter(SkeeverTail)
AddInventoryEventFilter(Garlic)
AddInventoryEventFilter(MothWingMonarch)
AddInventoryEventFilter(Vynroot)
EndEvent
Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
If FS_NQ05.GetStage() != 35
If FS_NQ05.GetStage() > 35
if akBaseItem != SkeeverTail ; keep the rarest item as filter
RemoveInventoryEventFilter(Garlic)
RemoveInventoryEventFilter(MothWingMonarch)
RemoveInventoryEventFilter(Vynroot)
endif
endif
return
endif
if akBaseItem == Garlic
FS_NQ05.ModObjectiveGlobal(aiItemCount, _00E_FS_NQ05_GarlicCountGlobal, 37, 1, true, true, true)
return
endif
if akBaseItem == MothWingMonarch
FS_NQ05.ModObjectiveGlobal(aiItemCount, _00E_FS_NQ05_MothWingMonarchCountGlobal, 38, 1, true, true, true)
return
endif
if akBaseItem == SkeeverTail
FS_NQ05.ModObjectiveGlobal(aiItemCount, _00E_FS_NQ05_SkeeverTailCountGlobal, 36, 1, true, true, true)
return
endif
if akBaseItem == Vynroot
FS_NQ05.ModObjectiveGlobal(aiItemCount, _00E_FS_NQ05_VynrootCountGlobal, 39, 1, true, true, true)
return
endif
EndEvent
Event OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer)
If FS_NQ05.GetStage() != 35
If FS_NQ05.GetStage() > 35
if akBaseItem != SkeeverTail
RemoveInventoryEventFilter(Garlic)
RemoveInventoryEventFilter(MothWingMonarch)
RemoveInventoryEventFilter(Vynroot)
endif
endif
return
endif
if akBaseItem == Garlic
FS_NQ05.ModObjectiveGlobal(0 - aiItemCount, _00E_FS_NQ05_GarlicCountGlobal, 37, 1, true, true, true)
return
endif
if akBaseItem == MothWingMonarch
FS_NQ05.ModObjectiveGlobal(0 - aiItemCount, _00E_FS_NQ05_MothWingMonarchCountGlobal, 38, 1, true, true, true)
return
endif
if akBaseItem == SkeeverTail
FS_NQ05.ModObjectiveGlobal(0 - aiItemCount, _00E_FS_NQ05_SkeeverTailCountGlobal, 36, 1, true, true, true)
return
endif
if akBaseItem == Vynroot
FS_NQ05.ModObjectiveGlobal(0 - aiItemCount, _00E_FS_NQ05_VynrootCountGlobal, 39, 1, true, true, true)
return
endif
endEvent
Quest Property FS_NQ05 Auto
Ingredient Property Garlic Auto
Ingredient Property MothWingMonarch Auto
Ingredient Property Vynroot Auto
Ingredient Property SkeeverTail Auto
GlobalVariable Property _00E_FS_NQ05_GarlicCountGlobal Auto
GlobalVariable Property _00E_FS_NQ05_MothWingMonarchCountGlobal Auto
GlobalVariable Property _00E_FS_NQ05_SkeeverTailCountGlobal Auto
GlobalVariable Property _00E_FS_NQ05_VynrootCountGlobal Auto

View File

@ -1,23 +1,6 @@
Scriptname _00E_FS_NQ05_SkeeverScript extends ObjectReference
Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)
If FS_NQ05.GetStage() == 35
If akNewContainer == PlayerREF
_00E_FS_NQ05_SkeeverTailCountGlobal.SetValue(PlayerREF.GetItemCount(SkeeverTail))
FS_NQ05.UpdateCurrentInstanceGlobal(_00E_FS_NQ05_SkeeverTailCountGlobal)
FS_NQ05.SetObjectiveDisplayed(36, true, true)
ElseIf akOldContainer == PlayerREF
_00E_FS_NQ05_SkeeverTailCountGlobal.SetValue(PlayerREF.GetItemCount(SkeeverTail))
FS_NQ05.UpdateCurrentInstanceGlobal(_00E_FS_NQ05_SkeeverTailCountGlobal)
FS_NQ05.SetObjectiveDisplayed(36, true, true)
EndIf
EndIf
EndEvent
; Replaced with OnItemAdded/OnItemRemoved in _00E_FS_NQ05_PlayerAlias
Actor Property PlayerREF Auto
Quest Property FS_NQ05 Auto

View File

@ -1,23 +1,6 @@
Scriptname _00E_FS_NQ05_VynrootScript extends ObjectReference
Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)
If FS_NQ05.GetStage() == 35
If akNewContainer == PlayerREF
_00E_FS_NQ05_VynrootCountGlobal.SetValue(PlayerREF.GetItemCount(Vynroot))
FS_NQ05.UpdateCurrentInstanceGlobal(_00E_FS_NQ05_VynrootCountGlobal)
FS_NQ05.SetObjectiveDisplayed(39, true, true)
ElseIf akOldContainer == PlayerREF
_00E_FS_NQ05_VynrootCountGlobal.SetValue(PlayerREF.GetItemCount(Vynroot))
FS_NQ05.UpdateCurrentInstanceGlobal(_00E_FS_NQ05_VynrootCountGlobal)
FS_NQ05.SetObjectiveDisplayed(39, true, true)
EndIf
EndIf
EndEvent
; Replaced with OnItemAdded/OnItemRemoved in _00E_FS_NQ05_PlayerAlias
Actor Property PlayerREF Auto
Quest Property FS_NQ05 Auto