Jump to content

Removing options from a menu once they have been activated


Recommended Posts

Hi all,

Hoping for a little basic scripting help here (and my knowledge is extremely basic). In a nutshell, I have a few options (e.g. hiring guards, other staff) in a menu activated via a ledger. What I can't remember how to do is remove the options from the menu once they have been selected. So the typical sequence would be:

1) Player activates ledger - 2) Player selects option to hire guards - 3) Guards get hired - 4) Menu exits automatically - 5) Player activates ledger again and sees only remaining options, not the one for hiring guards.

I've been searching online for a while without any joy, so any advice would be much appreciated   🙂   Thank you. Draft script below as well, in case it is useful for context.

 

____________________________________________________________________________________________________________

Scriptname a107SCRIPTAccounts extends ObjectReference  

Message Property MenuAccounts Auto
ObjectReference Property ChildParent Auto
ObjectReference Property GuardParent Auto
ObjectReference Property StaffParent Auto
MiscObject Property Gold001 Auto

Event OnActivate (ObjectReference akActionRef)
    Menu()
EndEvent

Function Menu(int aiButton = 0)
    aiButton = MenuAccounts.show()
    
    If aiButton == 0
        If (Game.GetPlayer().GetItemCount(Gold001) >= 1000)
                Game.DisablePlayerControls()
                Game.GetPlayer().RemoveItem(Gold001, 1000)
                    Utility.Wait(3.0)
                StaffParent.enable()
                Game.EnablePlayerControls()
                Debug.MessageBox("Your new steward and blacksmith have arrived and found lodgings downstairs.")
        Else
            Debug.MessageBox("You do not have enough gold.")
        EndIf

    ElseIf aiButton == 1
        If (Game.GetPlayer().GetItemCount(Gold001) >= 3000)
                Game.DisablePlayerControls()
                Game.GetPlayer().RemoveItem(Gold001, 3000)
                    Utility.Wait(3.0)
                GuardParent.enable()
                Game.EnablePlayerControls()
                Debug.MessageBox("Your guards have arrived from Riften and found lodgings in the guard chambers.")
        Else
            Debug.MessageBox("You do not have enough gold.")
        EndIf

    ElseIf aiButton == 2
        If (Game.GetPlayer().GetItemCount(Gold001) >= 2000)
                Game.DisablePlayerControls()
                Game.GetPlayer().RemoveItem(Gold001, 2000)
                    Utility.Wait(3.0)
                ChildParent.enable()
                Game.EnablePlayerControls()
                Debug.MessageBox("A chamber suitable for children has been constructed downstairs.")
        Else
            Debug.MessageBox("You do not have enough gold.")
        EndIf

    ElseIf aiButton == 3
    
    EndIf
EndFunction

____________________________________________________________________________________________________________

Link to comment
Share on other sites

Posted (edited)

SKSE-based UI menus is what I use. Never messed with messagebox much, but apparently those can be worked with for this too. Cools. Edited

Edited by Sphered
Link to comment
Share on other sites

This doesn't require skse actually. You can add conditions to your buttons in messages in the creation kit. I would recommend making new global variables, then you can use the condition GetGlobalValue MyGlobalVariable == 1. 

 

Then to disable a button, set its global variable to 0 in your script.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...