diff --git a/OnItemAdded Optimization.esp b/OnItemAdded Optimization.esp index d6c946b1..ccf4c0e6 100644 Binary files a/OnItemAdded Optimization.esp and b/OnItemAdded Optimization.esp differ diff --git a/scripts/_00e_fs_nq07_dinnercontrolsc.pex b/scripts/_00e_fs_nq07_dinnercontrolsc.pex index 8a632e85..b9f183dc 100644 Binary files a/scripts/_00e_fs_nq07_dinnercontrolsc.pex and b/scripts/_00e_fs_nq07_dinnercontrolsc.pex differ diff --git a/scripts/_00e_fs_nq07_functions.pex b/scripts/_00e_fs_nq07_functions.pex index 06d0364d..96f917ce 100644 Binary files a/scripts/_00e_fs_nq07_functions.pex and b/scripts/_00e_fs_nq07_functions.pex differ diff --git a/scripts/qf_fs_nq07_0101ca09.pex b/scripts/qf_fs_nq07_0101ca09.pex index 3bef8e9b..91966513 100644 Binary files a/scripts/qf_fs_nq07_0101ca09.pex and b/scripts/qf_fs_nq07_0101ca09.pex differ diff --git a/source/scripts/_00e_fs_nq07_dinnercontrolsc.psc b/source/scripts/_00e_fs_nq07_dinnercontrolsc.psc index 6013673a..ead3af0a 100644 --- a/source/scripts/_00e_fs_nq07_dinnercontrolsc.psc +++ b/source/scripts/_00e_fs_nq07_dinnercontrolsc.psc @@ -1,43 +1,89 @@ Scriptname _00E_FS_NQ07_DinnerControlSC extends ReferenceAlias +Event OnInit() + AddInventoryEventFilter(_00E_EmptyFormlist) + + If FS_NQ07.GetStage() == 370 ; version update + AddInventoryEventFilter(_00E_DalSarkerHoneywine) + AddInventoryEventFilter(FoodChickenCooked) + AddInventoryEventFilter(FoodCabbagePotatoSoup) + endif + + FS_NQ07_HoneyWineBought.Value = PlayerREF.GetItemCount(_00E_DalSarkerHoneywine) + FS_NQ07_ChickenCooked.Value = PlayerREF.GetItemCount(FoodChickenCooked) + FS_NQ07_SoupBrewed.Value = PlayerREF.GetItemCount(FoodCabbagePotatoSoup) + + FS_NQ07.UpdateCurrentInstanceGlobal(FS_NQ07_HoneyWineBought) + FS_NQ07.UpdateCurrentInstanceGlobal(FS_NQ07_ChickenCooked) + FS_NQ07.UpdateCurrentInstanceGlobal(FS_NQ07_SoupBrewed) +EndEvent + Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) - if FS_NQ07.GetStage() == 370 - - if akBaseItem == _00E_DalSarkerHoneywine - FS_NQ07_HoneyWineBought.SetValue(PlayerREF.GetItemCount(_00E_DalSarkerHoneywine)) - FS_NQ07.UpdateCurrentInstanceGlobal(FS_NQ07_HoneyWineBought) - FS_NQ07.SetObjectiveDisplayed(110, true, true) - elseif akBaseItem == FoodChickenCooked - FS_NQ07_ChickenCooked.SetValue(PlayerREF.GetItemCount(FoodChickenCooked)) - FS_NQ07.UpdateCurrentInstanceGlobal(FS_NQ07_ChickenCooked) - FS_NQ07.SetObjectiveDisplayed(120, true, true) - elseif akBaseItem == FoodCabbagePotatoSoup - FS_NQ07_SoupBrewed.SetValue(PlayerREF.GetItemCount(FoodCabbagePotatoSoup)) - FS_NQ07.UpdateCurrentInstanceGlobal(FS_NQ07_SoupBrewed) - FS_NQ07.SetObjectiveDisplayed(130, true, true) - endif + If FS_NQ07.GetStage() != 370 + AddInventoryEventFilter(_00E_EmptyFormlist) ; in case clearing fails + RemoveInventoryEventFilter(_00E_DalSarkerHoneywine) + RemoveInventoryEventFilter(FoodChickenCooked) + RemoveInventoryEventFilter(FoodCabbagePotatoSoup) + Self.Clear() + return + endif + + if akBaseItem == _00E_DalSarkerHoneywine + FS_NQ07.ModObjectiveGlobal(aiItemCount, FS_NQ07_HoneyWineBought, 110, 2, true, true, true) + elseif akBaseItem == FoodChickenCooked + FS_NQ07.ModObjectiveGlobal(aiItemCount, FS_NQ07_ChickenCooked, 120, 2, true, true, true) + elseif akBaseItem == FoodCabbagePotatoSoup + FS_NQ07.ModObjectiveGlobal(aiItemCount, FS_NQ07_SoupBrewed, 130, 2, true, true, true) endif EndEvent Event OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer) - if FS_NQ07.GetStage() == 370 - - if akBaseItem == _00E_DalSarkerHoneywine - FS_NQ07_HoneyWineBought.SetValue(PlayerREF.GetItemCount(_00E_DalSarkerHoneywine)) - FS_NQ07.UpdateCurrentInstanceGlobal(FS_NQ07_HoneyWineBought) + If FS_NQ07.GetStage() != 370 + AddInventoryEventFilter(_00E_EmptyFormlist) ; in case clearing fails + RemoveInventoryEventFilter(_00E_DalSarkerHoneywine) + RemoveInventoryEventFilter(FoodChickenCooked) + RemoveInventoryEventFilter(FoodCabbagePotatoSoup) + Self.Clear() + return + endif + + if akBaseItem == _00E_DalSarkerHoneywine + FS_NQ07_HoneyWineBought.Value = PlayerREF.GetItemCount(_00E_DalSarkerHoneywine) + FS_NQ07.UpdateCurrentInstanceGlobal(FS_NQ07_HoneyWineBought) + if FS_NQ07_HoneyWineBought.Value < 2 + FS_NQ07.SetObjectiveCompleted(110, false) FS_NQ07.SetObjectiveDisplayed(110, true, true) - elseif akBaseItem == FoodChickenCooked - FS_NQ07_ChickenCooked.SetValue(PlayerREF.GetItemCount(FoodChickenCooked)) - FS_NQ07.UpdateCurrentInstanceGlobal(FS_NQ07_ChickenCooked) + elseif ! FS_NQ07.IsObjectiveCompleted(110) + FS_NQ07.SetObjectiveCompleted(110, true) + endif + return + endif + + if akBaseItem == FoodChickenCooked + FS_NQ07_ChickenCooked.Value = PlayerREF.GetItemCount(FoodChickenCooked) + FS_NQ07.UpdateCurrentInstanceGlobal(FS_NQ07_ChickenCooked) + if FS_NQ07_ChickenCooked.Value < 2 + FS_NQ07.SetObjectiveCompleted(120, false) FS_NQ07.SetObjectiveDisplayed(120, true, true) - elseif akBaseItem == FoodCabbagePotatoSoup - FS_NQ07_SoupBrewed.SetValue(PlayerREF.GetItemCount(FoodCabbagePotatoSoup)) - FS_NQ07.UpdateCurrentInstanceGlobal(FS_NQ07_SoupBrewed) + elseif ! FS_NQ07.IsObjectiveCompleted(120) + FS_NQ07.SetObjectiveCompleted(120, true) + endif + return + endif + + if akBaseItem == FoodCabbagePotatoSoup + FS_NQ07_SoupBrewed.Value = PlayerREF.GetItemCount(FoodCabbagePotatoSoup) + FS_NQ07.UpdateCurrentInstanceGlobal(FS_NQ07_SoupBrewed) + if FS_NQ07_SoupBrewed.Value < 2 + FS_NQ07.SetObjectiveCompleted(130, false) FS_NQ07.SetObjectiveDisplayed(130, true, true) + elseif ! FS_NQ07.IsObjectiveCompleted(130) + FS_NQ07.SetObjectiveCompleted(130, true) endif + return endif EndEvent @@ -53,3 +99,5 @@ Potion Property FoodCabbagePotatoSoup Auto GlobalVariable Property FS_NQ07_HoneyWineBought Auto GlobalVariable Property FS_NQ07_ChickenCooked Auto GlobalVariable Property FS_NQ07_SoupBrewed Auto + +FormList Property _00E_EmptyFormlist Auto diff --git a/source/scripts/_00e_fs_nq07_functions.psc b/source/scripts/_00e_fs_nq07_functions.psc index 50d5d6d8..fa42a5df 100644 --- a/source/scripts/_00e_fs_nq07_functions.psc +++ b/source/scripts/_00e_fs_nq07_functions.psc @@ -514,9 +514,26 @@ Function UpdateGlobals() FS_NQ07_ChickenCooked.SetValue(PlayerREF.GetItemCount(FoodChickenCooked)) FS_NQ07_SoupBrewed.SetValue(PlayerREF.GetItemCount(FoodCabbagePotatoSoup)) wait(0.1) + UpdateCurrentInstanceGlobal(FS_NQ07_HoneyWineBought) UpdateCurrentInstanceGlobal(FS_NQ07_ChickenCooked) UpdateCurrentInstanceGlobal(FS_NQ07_SoupBrewed) + wait(0.5) + + SetObjectiveDisplayed(110) + SetObjectiveDisplayed(120) + SetObjectiveDisplayed(130) + wait(1.5) + + ModObjectiveGlobal(0, FS_NQ07_HoneyWineBought, 110, 2, true, true, false) + ModObjectiveGlobal(0, FS_NQ07_ChickenCooked, 120, 2, true, true, false) + ModObjectiveGlobal(0, FS_NQ07_SoupBrewed, 130, 2, true, true, false) + + ReferenceAlias PlayerAlias = Self.GetAlias(14) as ReferenceAlias + PlayerAlias.ForceRefTo(PlayerREF) + PlayerAlias.AddInventoryEventFilter(_00E_DalSarkerHoneywine) + PlayerAlias.AddInventoryEventFilter(FoodChickenCooked) + PlayerAlias.AddInventoryEventFilter(FoodCabbagePotatoSoup) EndFunction diff --git a/source/scripts/qf_fs_nq07_0101ca09.psc b/source/scripts/qf_fs_nq07_0101ca09.psc index 5af3cca8..dda09102 100644 --- a/source/scripts/qf_fs_nq07_0101ca09.psc +++ b/source/scripts/qf_fs_nq07_0101ca09.psc @@ -168,9 +168,6 @@ kmyQuest.UpdateGlobals() Utility.Wait(4) SetObjectiveDisplayed(95) kmyQuest.EnableActivatorForDinner() -SetObjectiveDisplayed(110) -SetObjectiveDisplayed(120) -SetObjectiveDisplayed(130) SetObjectiveDisplayed(140) SetObjectiveDisplayed(150) ;END CODE @@ -538,6 +535,7 @@ Quest __temp = self as Quest _00E_FS_NQ07_Functions kmyQuest = __temp as _00E_FS_NQ07_Functions ;END AUTOCAST ;BEGIN CODE +(kmyQuest.GetAlias(14) as ReferenceAlias).Clear() ; PlayerREF SetObjectiveDisplayed(160) kmyQuest.StartDinnerScene() SetObjectiveCompleted(110)