Jump to content

Item selection menu, some scripting help/ideas needed.


Recommended Posts

I've been looking into the UI script for improving another part of the mod that is far from perfect and figured out this line from some examples:

UI.InvokeString("HUD Menu", "_global.skse.CloseMenu", "GiftMenu")

haven't tested it yet though

 

" and wait until the player closes the menu by himself. If he selects another item, it will replace the variable, so only the last one will be valid."

Yes, the problem with that is that when you select an item and apparently nothing happens it feels like something is bugged. I'll look into crafting menus if the above fails.

 

That's a very nice idea actually, if it works the result would be cleaner than the gift menu method, since it says give instead of select/choose and haven't found a way to change it and i could add a header to the list.

 

Thanks a lot :smile:

Link to comment
Share on other sites

Hey, so please forgive me if you are a million miles past this already, but I read the OP and I thought I would mention how I did this.

 

I used a gift menu like you, but I didn't bother closing the UI. Instead I made it so that the player could only gift one item at a time. Gifting a second item would replace the first. Closing the gift menu then becomes the equivalent of an OK button. Only once the menu was closed did I do the "stuff" that I needed to do. Here is the script. It wast meant to be placed on an alias but can be adapted to being placed directly on the actor easily enough.

ReferenceAlias property HeraldryShield auto

keyword property ArmorShield auto

armor MyShield
armor MyRing

auto state ready
	Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
		actor Me = GetReference() as actor
		actor PlayerREF = game.GetPlayer()
		if(akItemReference == none)
			if(akSourceContainer == PlayerREF)
				if(akBaseItem.HasKeyword(ArmorShield))
					if(aiItemCount > 1)
						Me.RemoveItem(akBaseItem, (aiItemCount - 1), true, PlayerREF)
					endif
					if(MyShield)
						armor OldShield = MyShield
						MyShield = none
						Me.RemoveItem(OldShield, 1, true, PlayerREF)
					endif
					MyShield = akBaseItem as armor
					RegisterForSingleUpdate(0.1)
					
				else
					Me.RemoveItem(akBaseItem, aiItemCount, true, PlayerREF)
				endif
			else
				Me.RemoveItem(akBaseItem, aiItemCount, true, akSourceContainer)
			endif
		else
			Me.RemoveItem(akItemReference, aiItemCount, true, PlayerREF)
		endif
	endEvent
	
	Event OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer)
		actor Me = GetReference() as actor
		if(akBaseItem == MyShield)
			if(Me.GetItemCount(MyShield) < 1)
				MyShield = none
			endif
		endif
	endEvent
	
	event OnUpdate()
		actor Me = GetReference() as actor
		if(MyShield)
			ObjectReference MySignetShield = Me.DropObject(MyShield)
			HeraldryShield.ForceRefTo(MySignetShield)
			(game.GetPlayer()).AddItem(MySignetShield)
		endif
	endEvent
endState

(The script would take a chosen shield and ring and make them into your PC's heraldic symbols, giving you a bonus to persuasion with certain factions when they were equipped).

 

Edit: Removed some functions that weren't relevant to the question at hand.

Edited by lofgren
Link to comment
Share on other sites

If you are concerned that the player would not understand what to do, you can always simply display a message onscreen. I think the idea of placing something in the container and then closing the container to indicate you are OK with your selection is pretty typical. With a simple notification it should be recognizable to the player.

 

You should give the NPC a name that reflects what they will do to the item. For example in my case the name was something like "Create Heraldic Item"

Edited by lofgren
Link to comment
Share on other sites

  • Recently Browsing   0 members

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