Qvorvm Posted April 19, 2021 Posted April 19, 2021 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...
dylbill Posted April 19, 2021 Posted April 19, 2021 You can try using Reset() on the chest references. https://www.creationkit.com/index.php?title=Reset_-_ObjectReference
Qvorvm Posted April 20, 2021 Author Posted April 20, 2021 Good suggestion, the chest.Reset(), but it doesn't quite work. The chest does populate, but if I then open the merchant's barter menu, it respawns immediately, giving the merchant another 750g to buy with.
Qvorvm Posted April 22, 2021 Author Posted April 22, 2021 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).
Qvorvm Posted August 9, 2021 Author Posted August 9, 2021 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
Recommended Posts