Hi,
could someone please check my script? It is meant to be an alternative way of buying House Upgrades (only alchemy and child room so far) through a Ledger in the house. I am a complete noob at papyrus, so this is mostly crated through the system: find similar to what I want / copy / paste / edit. Therefore, I have no idea if it is even close to a functional script. Thank you!
Scriptname ASTbhLedger extends ObjectReference
;Properties / Variables
Message Property ASTbhLedgerM Auto
MiscObject Property Gold Auto
ObjectReference Property ASTalchRoomStart Auto
ObjectReference Property ASTalchRoomNew Auto
ObjectReference Property ASTchildRoomNew Auto
;Main Code
Event OnActivate(ObjectReference akActionRef)
Menu()
EndEvent
Function Menu(Bool abMenu = True, Int aiButton = 0)
While abMenu
If aiButton != -1 ; Wait for input (this can prevent problems if recycling the aiButton argument in submenus)
aiButton = ASTbhLedgerM.Show() ; Buy Upgrade
abMenu = False ; End the function
If aiButton == 0 ; Cancel
ElseIf aiButton == 1 ; Alchemy/Enchanting Room (500)
If (ASTalchRoomNew.IsEnabled())
debug.notification("Upgrade already bought")
ElseIf (Game.GetPlayer().GetItemCount(Gold001) >= 500)
Game.GetPlayer().RemoveItem(Gold001,500,False)
ASTalchRoomNew.enable()
ASTalchRoomStart.disable()
debug.notification("Alchemy and Enchanting Room bought")
Else
debug.notification("500 gold required")
EndIf
ElseIf aiButton == 2 ; Children Room (250)
If (ASTchildRoomNew.IsEnabled())
debug.notification("Upgrade already bought")
ElseIf (Game.GetPlayer().GetItemCount(Gold001) >= 250)
Game.GetPlayer().RemoveItem(Gold001,250,False)
ASTchildRoomNew.enable()
debug.notification("Children Room bought")
Else
debug.notification("250 gold required")
EndIf
EndIf
EndIf
EndWhile
EndFunction