The Elixir: added a workaround for OnItemRemoved firing twice then item is eaten

This commit is contained in:
Eddoursul 2021-10-26 07:29:56 +02:00
parent 906c698b8a
commit 1a277cb94a
5 changed files with 66 additions and 13 deletions

Binary file not shown.

Binary file not shown.

View File

@ -22,22 +22,31 @@ EndFunction
Function UpdateGlobals()
_00E_FS_NQ05_VynrootCountGlobal.SetValue(0)
_00E_FS_NQ05_SkeeverTailCountGlobal.SetValue(0)
_00E_FS_NQ05_MothWingMonarchCountGlobal.SetValue(0)
_00E_FS_NQ05_GarlicCountGlobal.SetValue(0)
_00E_FS_NQ05_GarlicCountGlobal.Value = PlayerREF.GetItemCount(Garlic)
_00E_FS_NQ05_MothWingMonarchCountGlobal.Value = PlayerREF.GetItemCount(MothWingMonarch)
_00E_FS_NQ05_SkeeverTailCountGlobal.Value = PlayerREF.GetItemCount(SkeeverTail)
_00E_FS_NQ05_VynrootCountGlobal.Value = PlayerREF.GetItemCount(Vynroot)
wait(0.5)
UpdateCurrentInstanceGlobal(_00E_FS_NQ05_VynrootCountGlobal)
UpdateCurrentInstanceGlobal(_00E_FS_NQ05_SkeeverTailCountGlobal)
UpdateCurrentInstanceGlobal(_00E_FS_NQ05_MothWingMonarchCountGlobal)
UpdateCurrentInstanceGlobal(_00E_FS_NQ05_GarlicCountGlobal)
Wait(0.5)
SetObjectiveDisplayed(36)
SetObjectiveDisplayed(37)
SetObjectiveDisplayed(38)
SetObjectiveDisplayed(39)
Wait(1.5)
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)
ModObjectiveGlobal(0, _00E_FS_NQ05_SkeeverTailCountGlobal, 36, 1, true, true, false)
ModObjectiveGlobal(0, _00E_FS_NQ05_GarlicCountGlobal, 37, 1, true, true, false)
ModObjectiveGlobal(0, _00E_FS_NQ05_MothWingMonarchCountGlobal, 38, 1, true, true, false)
ModObjectiveGlobal(0, _00E_FS_NQ05_VynrootCountGlobal, 39, 1, true, true, false)
EndFunction

View File

@ -5,6 +5,16 @@ Event OnInit()
AddInventoryEventFilter(Garlic)
AddInventoryEventFilter(MothWingMonarch)
AddInventoryEventFilter(Vynroot)
_00E_FS_NQ05_GarlicCountGlobal.Value = PlayerREF.GetItemCount(Garlic)
_00E_FS_NQ05_MothWingMonarchCountGlobal.Value = PlayerREF.GetItemCount(MothWingMonarch)
_00E_FS_NQ05_SkeeverTailCountGlobal.Value = PlayerREF.GetItemCount(SkeeverTail)
_00E_FS_NQ05_VynrootCountGlobal.Value = PlayerREF.GetItemCount(Vynroot)
FS_NQ05.UpdateCurrentInstanceGlobal(_00E_FS_NQ05_GarlicCountGlobal)
FS_NQ05.UpdateCurrentInstanceGlobal(_00E_FS_NQ05_MothWingMonarchCountGlobal)
FS_NQ05.UpdateCurrentInstanceGlobal(_00E_FS_NQ05_SkeeverTailCountGlobal)
FS_NQ05.UpdateCurrentInstanceGlobal(_00E_FS_NQ05_VynrootCountGlobal)
EndEvent
Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
@ -56,22 +66,54 @@ Event OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemRefe
endif
if akBaseItem == Garlic
FS_NQ05.ModObjectiveGlobal(0 - aiItemCount, _00E_FS_NQ05_GarlicCountGlobal, 37, 1, true, true, true)
bool bNotify = (_00E_FS_NQ05_GarlicCountGlobal.Value > 0)
_00E_FS_NQ05_GarlicCountGlobal.Value = PlayerREF.GetItemCount(Garlic)
FS_NQ05.UpdateCurrentInstanceGlobal(_00E_FS_NQ05_GarlicCountGlobal)
if bNotify && (_00E_FS_NQ05_GarlicCountGlobal.Value == 0) && FS_NQ05.IsObjectiveCompleted(37)
FS_NQ05.SetObjectiveCompleted(37, false)
FS_NQ05.SetObjectiveDisplayed(37, true, true)
elseif (_00E_FS_NQ05_GarlicCountGlobal.Value > 0) && ! FS_NQ05.IsObjectiveCompleted(37)
FS_NQ05.SetObjectiveCompleted(37, true)
endif
return
endif
if akBaseItem == MothWingMonarch
FS_NQ05.ModObjectiveGlobal(0 - aiItemCount, _00E_FS_NQ05_MothWingMonarchCountGlobal, 38, 1, true, true, true)
bool bNotify = (_00E_FS_NQ05_MothWingMonarchCountGlobal.Value > 0)
_00E_FS_NQ05_MothWingMonarchCountGlobal.Value = PlayerREF.GetItemCount(MothWingMonarch)
FS_NQ05.UpdateCurrentInstanceGlobal(_00E_FS_NQ05_MothWingMonarchCountGlobal)
if bNotify && (_00E_FS_NQ05_MothWingMonarchCountGlobal.Value == 0) && FS_NQ05.IsObjectiveCompleted(38)
FS_NQ05.SetObjectiveCompleted(38, false)
FS_NQ05.SetObjectiveDisplayed(38, true, true)
elseif (_00E_FS_NQ05_MothWingMonarchCountGlobal.Value > 0) && ! FS_NQ05.IsObjectiveCompleted(38)
FS_NQ05.SetObjectiveCompleted(38, true)
endif
return
endif
if akBaseItem == SkeeverTail
FS_NQ05.ModObjectiveGlobal(0 - aiItemCount, _00E_FS_NQ05_SkeeverTailCountGlobal, 36, 1, true, true, true)
bool bNotify = (_00E_FS_NQ05_SkeeverTailCountGlobal.Value > 0)
_00E_FS_NQ05_SkeeverTailCountGlobal.Value = PlayerREF.GetItemCount(SkeeverTail)
FS_NQ05.UpdateCurrentInstanceGlobal(_00E_FS_NQ05_SkeeverTailCountGlobal)
if bNotify && (_00E_FS_NQ05_SkeeverTailCountGlobal.Value == 0) && FS_NQ05.IsObjectiveCompleted(36)
FS_NQ05.SetObjectiveCompleted(36, false)
FS_NQ05.SetObjectiveDisplayed(36, true, true)
elseif (_00E_FS_NQ05_SkeeverTailCountGlobal.Value > 0) && ! FS_NQ05.IsObjectiveCompleted(36)
FS_NQ05.SetObjectiveCompleted(36, true)
endif
return
endif
if akBaseItem == Vynroot
FS_NQ05.ModObjectiveGlobal(0 - aiItemCount, _00E_FS_NQ05_VynrootCountGlobal, 39, 1, true, true, true)
bool bNotify = (_00E_FS_NQ05_VynrootCountGlobal.Value > 0)
_00E_FS_NQ05_VynrootCountGlobal.Value = PlayerREF.GetItemCount(Vynroot)
FS_NQ05.UpdateCurrentInstanceGlobal(_00E_FS_NQ05_VynrootCountGlobal)
if bNotify && (_00E_FS_NQ05_VynrootCountGlobal.Value == 0) && FS_NQ05.IsObjectiveCompleted(39)
FS_NQ05.SetObjectiveCompleted(39, false)
FS_NQ05.SetObjectiveDisplayed(39, true, true)
elseif (_00E_FS_NQ05_VynrootCountGlobal.Value > 0) && ! FS_NQ05.IsObjectiveCompleted(39)
FS_NQ05.SetObjectiveCompleted(39, true)
endif
return
endif
@ -88,3 +130,5 @@ 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
Actor Property PlayerREF Auto