I want to be honest with you, firstly it's complex to do that if you're just beginning to script. It's best to just make your game as simple as possible just to get the feel of your game.
Secondly, you can always check the mods and unpack them to see how they work.
Thirdly, I don't really know how to do something like that nor have attempted to do it, keep that in mind.
Onto the topic, basically you need to implement a
inventory first hand before attempting a shop. You need to know what the character is holding and how much he's got of that item that he is holding. You don't need to have entities on it though (except when it's time for the item to be used, which you would then just subtract the number of items that the character has).
It involves using keyscripts, global variables, update scripts and various other things to implement it in theory.
After you do the inventory system, it's just a matter of a couple things to do so that you can have an item shop.
If you still find it hard to understnad, that's where the second point comes in, unpacking other people's mods that implement this and see how they made them. Test out their code and then do a twist on it or improve upon the code. Yeah, we will still here to help if you encounter some problems doing that.
Oh yeah, a little parting gift, if you want to know about what I said (keyscript and update scripts), check this
link out. And also
this one too (read also the one on Predefined script functions) ... One is from our wiki and the other is from the DCEmulation manual.
That's all I have to say.
