Jump to content

Configuring vendors to sell items only one time


Mebantiza

Recommended Posts

Is there any mechanism, vanilla or mod added, by which we can configure vendors to either sell items only one time, while still resetting vendors so their inventory does not become permanently accrete items and money that you give to them?

 

Do not tell me to 'turn the containers respawn flag off' I already know about this.

 

 

 

 

The result I am looking (hoping) for, is to be able to set up specific vendors inventory, so items can only be purchased one time, and that is it. However, its also important the vendors funds and items you sell TO them, be cleaned up on a regular basis like normal, otherwise, with no respawn set to off, funds and items sold to, just accrete and never get removed.

 

Its likely not doable, since I cant seem to find any discussion about this particular configuration. Everyone wants their vendors to reset every other hour or so, but no one seems to want it one-time only vendors the way I describe.

 

The vendor respawn is an all or nothing proposition, and cannot be fine-tuned in any way I am aware of. If there is any way at all, please let me know.

Link to comment
Share on other sites

Just thinking this through...

 

Put the merchant container on a quest alias

Apply a script to the quest alias

The script will listen for the OnItemRemoved event

If the akDestContainer parameter is the player take the akBaseItem parameter and add it to an empty formlist

The script will listen for the OnCellAttach event

and use RemoveItem to remove the formlist items from the container and send them to the void

 

In the event of the player hanging around in the same area and not triggering the OnCellAttach event, SKSE functions / events could be used:

Register for the barter menu

When the barter menu is opened use RemoveItem to remove the formlist items from the container to the void

 

I could see potential for issues should the formlist get really large which over time it might. If stack dumps start to happen, the formlist might have to be cycled and each item removed individually. But that would take time and the player would definitely see items disappear from the container especially if it didn't trigger until the barter menu was opened.

 

It might work, definitely needs some testing and probably some fine tuning if it does work.

Link to comment
Share on other sites

OR, they could have just added a flag, either the container OR, separate items, like > Sell once. LoL. A sell Once flag would very useful, but Ill admit I don't know how complex that would be at the engine level.

 

 

That method sounds......complex :ohdear:. Definitely above my pay grade. No respawn is so inflexible. I can see that flag working for specific vendors with only a couple of item, but otherwise, not terribly helpful given how limited it is.

 

I dont know this sounds, but, with the current > No respawn flag, what about if you SELL an item with NR flag set, the game gives you your money, but immediately 'eats' the item and permanently removes it from the vendor\game? At least that way, your sells wouldn't stick around 4ever? Would something alone those lines be made to work in some fashion?

 

 

Appreciate the insight all the same. Thank you!

Link to comment
Share on other sites

I recall a tutorial that said that you can sometimes add the 1 item to the Vendor NPC inventory and they will sell it in their store. I would try that. It is a quick easy test/fix.

 

Good Luck!

Link to comment
Share on other sites

I think with both IsharaMeradin and Adventurer1111's advice you could make it work. If you want the vendor to sell only 1 of an item, add items to their person via script or a reference alias on a quest rather than the merchant chest itself. Have the merchant chest be empty, and attach a script either to a quest alias pointing to the chest or on the chest itself if you're making a custom vendor. I think you can use OnActivate to detect when the player is trading with the vendor, but I'm not sure, it would need to be tested.

 

Example script.

Scriptname TM_ObjectRefScript extends ObjectReference 
;Script on merchant chest reference

Event OnActivate(ObjectReference akActionRef) 
    RegisterForSingleUpdateGameTime(24) ;updates in 24 game hours. 
EndEvent 

Event OnUpdateGameTime()
    Self.RemoveAllItems()
EndEvent

Change the script name to something more unique.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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