Jump to content

Make an Item Buyable but Not Sellable


Recommended Posts

As the title says, I was wondering if somebody could help me out.

I'm trying to add a material into the game that would be quite expensive, to that merit I want to prevent the player from selling the ones they find in order to not break the economy. Buying them is meant to be prohibitively expensive so that manual collection is the most desirable means of obtaining.

I see you can use keywords to mark stuff as No Sale, but this prevents the player from being able to buy those things at the same time, but there is no option that I can see for only Sale. This makes me think I'll have to attach a script to the items but I know nothing about it. Any tips?

Link to comment
Share on other sites

Its either buyable and sellable or not buyable and not sellable. It isn't possible to mix and match.

 

With SKSE one could monitor for the store UI and if the item is removed while the store UI is open then return the item and any gold that had been given to the player. But that is still technically a sale and given the high value an instant speechcraft exploit. Not recommended.

 

That said, one could use SKSE to monitor for the store UI and move those items out of the player inventory for the duration that the store UI is open. Will definitely prevent the ability to sell them.

 

And none of that would prevent the player from putting the item into a third party mod container that is designed to act as a point of sale in some manner.

 

Perhaps instead of offering the item itself for sale, you could sell a map or note that points to a possible location where they could find the item.

Link to comment
Share on other sites

May I offer another alternative. Make two versions of your item, one you can buy and sell, the other you can't. Give the ones you can to vendors, and add a script to it that replaces it with the Non sellable version if it enters the players inventory:

 

Scriptname TM_ButOnlyObjectScript extends ObjectReference 
;Script is on the buyable version of the object.

MiscObject Property ThisItem Auto
MiscObject Property NonSellableItem Auto ;The none sellable version of this item

Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer) 
    If akNewContainer == Game.GetPlayer() 
        Game.GetPlayer().RemoveItem(ThisItem, 1, True) ;remove one of thisItem from player 
        Game.GetPlayer().AddItem(NonSellableItem, 1, True) ;add nonSellableItem to player in ThisItems place.
    Endif 
EndEvent
Link to comment
Share on other sites

 

May I offer another alternative. Make two versions of your item, one you can buy and sell, the other you can't. Give the ones you can to vendors, and add a script to it that replaces it with the Non sellable version if it enters the players inventory:

 

Scriptname TM_ButOnlyObjectScript extends ObjectReference 
;Script is on the buyable version of the object.

MiscObject Property ThisItem Auto
MiscObject Property NonSellableItem Auto ;The none sellable version of this item

Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer) 
    If akNewContainer == Game.GetPlayer() 
        Game.GetPlayer().RemoveItem(ThisItem, 1, True) ;remove one of thisItem from player 
        Game.GetPlayer().AddItem(NonSellableItem, 1, True) ;add nonSellableItem to player in ThisItems place.
    Endif 
EndEvent

 

Thank you both for your answers! It's funny how after nearly a decade of working with CK I still stumble into things I just do not understand and limitations I wasn't aware of :p

 

This script is brilliant though, a perfect band-aid. Thank you!

Link to comment
Share on other sites

  • Recently Browsing   0 members

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