-
Notifications
You must be signed in to change notification settings - Fork 6
/
GVC_Script_Alcohest.psc
50 lines (43 loc) · 1.36 KB
/
GVC_Script_Alcohest.psc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
Scriptname GVC_Script_Alcohest extends activemagiceffect
GVC_MenuMain Property GVC_MainMenu AUTO
ACTOR PROPERTY PlayerRef AUTO
IMPORT KMXPotionUtil
Event OnEffectStart(Actor akTarget, Actor akCaster)
RegisterForMenu("Sleep/Wait Menu")
EndEvent
Event OnPlayerLoadGame()
RegisterForMenu("Sleep/Wait Menu")
EndEvent
Event OnMenuClose(String MenuName)
INT i = 0
INT delta
WHILE i < GVC_MainMenu.SignaturePotionList.Length
IF GVC_MainMenu.SignaturePotionList[i]
IF GVC_MainMenu.SignaturePotionList[i] == None
Debug.Notification("You can't refill a signature potion if you run out!")
GVC_MainMenu.SignaturePotionList[i] = None
ELSE
delta = GVC_MainMenu.AlcohestCount - PlayerRef.GetItemCount(GVC_MainMenu.SignaturePotionList[i])
IF delta > 0
Refill(GVC_MainMenu.SignaturePotionList[i],delta)
ENDIF
ENDIF
ENDIF
i += 1
ENDWHILE
Debug.Notification("Potions Refilled, " + PlayerRef.GetItemCount(GVCAlcohest) + " Alcohest Remaining")
EndEvent
FORM PROPERTY GVCAlcohest AUTO
Function Refill(POTION akPotion, INT akNum)
int akCount
IF PlayerRef.GetItemCount(GVCAlcohest) < akNum
akCount = PlayerRef.GetItemCount(GVCAlcohest)
ELSE
akCount = akNum
ENDIF
PlayerRef.RemoveItem(GVCAlcohest,akCount,true)
IF akPotion.GetFormID() >= 0xFF000000
IncPotionRefCount(akPotion,akCount)
ENDIF
PlayerRef.AddItem(akPotion,akCount,true)
EndFunction