Merchant trader sells gear/items in exchange for plot items

Hi, I am trying to create a custom merchant that’ll only trade it’s inventory items if pc’s have a certain number of specific non tradeable plot items.

I’ve seen this done in a few different modules, just wondering how it’s done.


That sounds like a specific instance of the general problem of opening a store only if certain conditions are met. You can do that in a conversation by hiding the let me see your wares node for example. Or with a custom store opening script that checks there. You could have it open a sucky store instead or not open.
If the modules you have seen what you want in are not PWs (or the mod files are accessible anyway) then you can always open the mod in the toolset to see how it’s done there. Good way to learn things too :slight_smile:

What I’ve seen in other modules, and what I was trying to do is create a merchant that trades it’s inventory items in exchange for tokens, once items are purchased from this merchant the token plot items are removed from the pc’s inventory.

I’ll check if any of the modules I’ve seen with this system can be downloaded…or maybe someone can recommend a module with something like this that I can take a look at?

I cannot recommend a module, but I can comment on how it can be done.

You can try to avoid:

  • using a store object at all
  • hard-coding items in a conversation

Approach 1:

  • put all items for sale in a “display” placeable
  • use SetItemCursedFlag to prevent the PC from taking any items
  • PC puts a number of tokens in the same placeable
  • NPC in a dialogue calculates the cost and allows PC to choose one to buy (unspent tokens can be taken back by the PC)

Approach 2:

  • PC puts a number of tokens in a placeable
  • NPC blocks those tokens with SetItemCursedFlag and spawns in the placeable all items they can buy
  • PC grabs one item, which triggers placeable’s OnDisturb, which destroys a number of tokens and all items PC didn’t choose
  • if no deal, all tokens are returned to PC

#2 uses less scripting but prevents the PC from examining the merchandise before bringing the money (unless you put them somewhere else where they can’t be taken from at all).

Any chance someone can help me code something like above?

Some tokens are tradeable while others are not. For the tradeable tokens your method will work, not sure how to code this though.

For the tokens that cannot be traded, would it be possible to spawn in a placeable unique and tied to the player somehow, player selects 1 item, token/s get deleted along with the placeable?

Maybe each player is given a unique item that will allow them to spawn the ‘token merchant’ if they have at least 1 token.

I’m not capable of coding this, I can manage spawning the ‘token merchant’ placeable when pc uses unique item, but tying this placeable to the player, and calculating the token cost/giving 1 item to the pc isn’t something I can do.

By plot tokens it sounds like you essentially mean coins. There are coin systems that do what you described. Essentially they convert the PC’s coins into an amount of regular gold on store open which lets the PC use the store normally, and then reverses the process on store close converting whatever amount of gold is left back into coins.

There are modules that do that. I think Fester’s Almraiven has a coins system. There is a whole range of coins in cep. And the CRP system which is included is supposed to do the coin work. I found it didn’t work well so I did my own version. It’s not that easy to pull out since it requires my haks or I’d offer it to you.

Thanks meaglyn, ill try a coin system if i can’t figure out how to make this work. I used to play on a server that spawned in a merchant that was tied to whichever player spawned it then offered 1 item for the player to take. it was so long ago now that i forget exactly how it worked, and the server has since gone down, but the token system worked a lot like what NWShacker suggested.

If the merchant is just a normal shop that deals in custom money representation, then go with coin system as that will be most streamlined approach.

If the merchant gives only few special items in exchange for - say - orc heads, you may want to try something different. Let me know if you want to try such simulated barter.

BTW, you can easily mark an item as tradeable via local variables (as well as its cost). Set them during runtime or in the item’s blueprint properties. Same goes for binding a PC to something.

Agreed. If you really mean specific things for specific tokens that can be done too but would require something different. And might be easier just as a conversation.

And ActionExamine can be called on the items from the dialogue if PC wishes to take a closer look :slight_smile: (man, I wished they had this in OC Docks).

An example of a token system which works parallel to a gold currency is in the OC (harbour district). It’s completely dialog driven and has only a limited selection of goods. I don’t think, that something like this can be done with a standard shop object.

An example, where gold currency is completely replaced by a token system is in Almraiven… This “works” with standard shop objects.
vg, MM

i decided to go with a simple dialog system, seemed like the easiest way to do this…