diff --git a/Enderal - Forgotten Stories.esm b/Enderal - Forgotten Stories.esm index ee98d79a..bf3eb2ce 100644 Binary files a/Enderal - Forgotten Stories.esm and b/Enderal - Forgotten Stories.esm differ diff --git a/scripts/_00e_fs_nqr_sq_01_functions.pex b/scripts/_00e_fs_nqr_sq_01_functions.pex index 9196f410..25ee5611 100644 Binary files a/scripts/_00e_fs_nqr_sq_01_functions.pex and b/scripts/_00e_fs_nqr_sq_01_functions.pex differ diff --git a/source/scripts/_00e_fs_nqr_sq_01_functions.psc b/source/scripts/_00e_fs_nqr_sq_01_functions.psc index 16b05c84..3a54f3ce 100644 --- a/source/scripts/_00e_fs_nqr_sq_01_functions.psc +++ b/source/scripts/_00e_fs_nqr_sq_01_functions.psc @@ -1,7 +1,7 @@ Scriptname _00E_FS_NQR_SQ_01_Functions extends Quest ;===================================================================================== -; FUNCTIONS +; FUNCTIONS ;===================================================================================== Function SetUp() @@ -14,107 +14,47 @@ Function SetUp() EndFunction -;Old Function -;Function GiveReward() -; -; int iTotalReward -; Int NumItems = PlayerREF.GetNumItems() -; Int i = 0 -; -; int[] elementCountToRemoveForEachItem = Utility.CreateIntArray(_00E_FS_PyreanItems.getSize()) -; -; While (i < NumItems) -; -; Form Entry = PlayerREF.GetNthForm(i) -; -; If Entry as MiscObject -; -; if _00E_FS_PyreanItems.HasForm(Entry) -; -; Int itemIndexInFormlist = _00E_FS_PyreanItems.Find(Entry) -; float fValue = (Entry.GetGoldValue() + Entry.GetGoldValue()*0.33)*PlayerREF.GetItemCount(Entry) -; -; iTotalReward = iTotalReward + fValue as Int -; elementCountToRemoveForEachItem[itemIndexInFormlist] = PlayerREF.GetItemCount(Entry) -; -; EndIf -; EndIf -; -; i += 1 -; -; EndWhile -; -; i = 0 -; -; While (i < _00E_FS_PyreanItems.GetSize()) -; PlayerREF.RemoveItem(_00E_FS_PyreanItems.GetAt(i), elementCountToRemoveForEachItem[i]) -; i += 1 -; Endwhile -; -; PlayerREF.AddItem(Gold001, iTotalReward) -; -;EndFunction - Function OpenGiftmenu() - RegisterForMenu("GiftMenu") - FS_NQR05_SQ_01_FakeREF.AddInventoryEventFilter(_00E_FS_PyreanItems) - FS_NQR05_SQ_01_FakeREF.ShowGiftMenu(True, _00E_FS_PyreanItems, True, False) - FS_NQR05_SQ_01_FakeREF.RemoveAllInventoryEventFilters() + FS_NQR05_SQ_01_FakeREF.RemoveAllItems() + FS_NQR05_SQ_01_FakeREF.ShowGiftMenu(True, _00E_FS_PyreanMiscItems, True, False) + Utility.Wait(0.2) -EndFunction - -Event OnMenuClose(String MenuName) + GiveRewardNEW() - UnregisterForMenu("GiftMenu") - If MenuName == "GiftMenu" && FS_NQR05_SQ_01_FakeREF.GetNumItems() > 0 - GiveRewardNEW() - EndIf -EndEvent - +EndFunction Function GiveRewardNEW() - int iTotalReward - Int NumItems = FS_NQR05_SQ_01_FakeREF.GetNumItems() - Int i = 0 - - int[] elementCountToRemoveForEachItem = Utility.CreateIntArray(_00E_FS_PyreanItems.getSize()) - - While (i < NumItems) - - Form Entry = FS_NQR05_SQ_01_FakeREF.GetNthForm(i) - - If Entry as MiscObject - - if _00E_FS_PyreanItems.HasForm(Entry) - - Int itemIndexInFormlist = _00E_FS_PyreanItems.Find(Entry) - float fValue = (Entry.GetGoldValue() + Entry.GetGoldValue()*0.33)*FS_NQR05_SQ_01_FakeREF.GetItemCount(Entry) - - iTotalReward = iTotalReward + fValue as Int - elementCountToRemoveForEachItem[itemIndexInFormlist] = FS_NQR05_SQ_01_FakeREF.GetItemCount(Entry) - - EndIf - EndIf - - i += 1 + Int NumItems = FS_NQR05_SQ_01_FakeREF.GetNumItems() + + if NumItems <= 0 + return + endif - EndWhile + int iTotalReward + Int i = 0 + While (i < NumItems) - i = 0 + Form Entry = FS_NQR05_SQ_01_FakeREF.GetNthForm(i) + int iGoldValue = Entry.GetGoldValue() + + if iGoldValue > 0 + float fValue = (iGoldValue + iGoldValue * 0.33) * FS_NQR05_SQ_01_FakeREF.GetItemCount(Entry) + iTotalReward = iTotalReward + fValue as Int + endif - While (i < _00E_FS_PyreanItems.GetSize()) - FS_NQR05_SQ_01_FakeREF.RemoveItem(_00E_FS_PyreanItems.GetAt(i), elementCountToRemoveForEachItem[i]) - i += 1 - Endwhile + i += 1 - PlayerREF.AddItem(Gold001, iTotalReward) + EndWhile + + FS_NQR05_SQ_01_FakeREF.RemoveAllItems() + PlayerREF.AddItem(Gold001, iTotalReward) EndFunction ;===================================================================================== -; PROPERTIES +; PROPERTIES ;===================================================================================== Actor Property FS_NQR_SQ_01_ScionGustavREF Auto @@ -123,6 +63,6 @@ Actor Property FS_NQR05_SQ_01_FakeREF Auto Scene Property FS_NQR_SQ_01_Scene_01 Auto -Formlist Property _00E_FS_PyreanItems Auto +Formlist Property _00E_FS_PyreanMiscItems Auto MiscObject Property Gold001 Auto \ No newline at end of file