Jump to content

Accessing merchant chests via script


xkkmEl

Recommended Posts

I'm trying to make a script to automate selling stuff to a merchant. The issue I am encountering is that merchant chests are not respawning unless I first (manually) open their barter menu. When I don't, their chest look empty and the only gold the merchant has to buy my stuff is whatever they are currently carrying.

 

Is there any way to force these chests to load their content, and/or respawn?

 

With NPC inventories, I can just add a DummyDagger, equip it, unequip and remove it. This does not work on chests...

 

Link to comment
Share on other sites

I'm trying out another approach: attaching my automated selling script on the tail of the barter menu. It solves the merchant chest respawn problem, but has issues of its own: complex chain of events, blocking dialogues and magic effects. As of today, this approach seems workable, if not entirely reliable, but it introduces some confusing UI artefacts (it detects the barter menu in time only 9/10 of the time, even if you give it 10s of seconds to do so; scripts appear to be only partially active while the barter menu is open).

Link to comment
Share on other sites

  • 2 weeks later...
  • 3 months later...

Finally found something that works right: open and close the barter menu.

event OnMenuOpen( string MenuName)
	if MenuName == "BarterMenu"
		UI.InvokeString("HUD Menu", "_global.skse.CloseMenu", "BarterMenu")
		UnregisterForMenu( "BarterMenu")
	endif
endevent

function PrepareMerchantChest( Actor merchant)
	RegisterForMenu( "BarterMenu")
	merchant.ShowBarterMenu()
	Utility.WaitMenuMode( 0.25)
endfunction

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

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