enderalse/source/scripts/_00e_fs_nqr_sq_01_functions.psc

128 lines
3.4 KiB
Plaintext

Scriptname _00E_FS_NQR_SQ_01_Functions extends Quest
;=====================================================================================
; FUNCTIONS
;=====================================================================================
Function SetUp()
FS_NQR_SQ_01_ScionGustavREF.Enable()
if !FS_NQR_SQ_01_Scene_01.IsPlaying()
FS_NQR_SQ_01_Scene_01.ForceStart()
endif
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()
EndFunction
Event OnMenuClose(String MenuName)
UnregisterForMenu("GiftMenu")
If MenuName == "GiftMenu" && FS_NQR05_SQ_01_FakeREF.GetNumItems() > 0
GiveRewardNEW()
EndIf
EndEvent
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
EndWhile
i = 0
While (i < _00E_FS_PyreanItems.GetSize())
FS_NQR05_SQ_01_FakeREF.RemoveItem(_00E_FS_PyreanItems.GetAt(i), elementCountToRemoveForEachItem[i])
i += 1
Endwhile
PlayerREF.AddItem(Gold001, iTotalReward)
EndFunction
;=====================================================================================
; PROPERTIES
;=====================================================================================
Actor Property FS_NQR_SQ_01_ScionGustavREF Auto
Actor Property PlayerREF Auto
Actor Property FS_NQR05_SQ_01_FakeREF Auto
Scene Property FS_NQR_SQ_01_Scene_01 Auto
Formlist Property _00E_FS_PyreanItems Auto
MiscObject Property Gold001 Auto