In-game Shops
Thief II only

In this tutorial, we will create a fully functional in-game shop, where the player can use his loot to purchase items. This tutorial is for Thief 2 only.

I have created a small mission which demonstrates an in-game shop in action. You can download it here.
You will need a fair knowledge of some of the more complex features of DromEd, such as Act/React, metaproperties, and the use of a custom gamesys.

This tutorial assumes that you've already set up a mission, with a working player start, and that Convict and Gen have been loaded.

Before we begin, let's consider what we'll need to do set up a working in-game shop system.
First of all, we have to know how much loot the player is carrying at any given time, so that we can tell if he has enough money to buy the items in the shop.
Secondly, we need to allow the player to take the items which are for sale in the shop, and set things up so that he looses the appropriate amount of loot.
Thirdly, we need to make sure that the player cannot take items when he does not have enough money to buy them.

 

- Counting The Loot -

We'll start by creating a system to count the player's gold, as it is gained and spent, in order to keep a running total. This total will be kept in a quest variable, so the first thing to do is to create one. Enter the following line into DromEd's console:

quest_create_mis Loot,0

This will create a local (current mission only) quest variable named Loot, and set it to zero.

A special Act/React Stimulus will be used to count the loot as it comes into and leaves the player's inventory, so the next thing to do is to create this stim, which should be named 'LootStim'. In order to get the new stim to work, you need to save the gamesys (and set it using the set_gamesys command, if you haven't already), and then save and reload the mission.

Next, we need to add the counting system to the loot archetypes. In a real mission, you would need to apply the system to every single type of loot, but for this tutorial we will just set up three example items: Purse (-2609), GoldCoinStack (-2956), and Tiara (-1976).
To make things easier, especially if you want to set things up to work with every single loot type, we'll create some new Metaproperties - one for each loot value that the items have.
Flip over to the MetaProperties section of the Object Hierarchy and create a new one, named 'M-LootTypes'. This will be used as a container for the other metaproperties we'll add later.

Now, create a metaproperty under M-LootTypes, named 'M-Loot025'. This metaproperty will be given to any piece of loot which is worth 25.
Add Dark Gamesys->Loot and set Gold to 25. Leave everything else at 0.
Now, add Act/React Sources and add the following source:

Stimulus Propagator Intensity Contact Types Velocity Coeff Frob Time Coeff
LootStim Contact 25 Frob In World
0
0

When the player frobs a piece of loot which has this metaproperty, he will be hit by an intensity 25 LootStim.

Next, create two more metaproperties under M-LootTypes, and name these 'M-Loot100' and 'M-Loot125'. Give both of them the same properties you added to 'M-Loot025', but change the value of the Dark Gamesys->Loot property, and the intensity of the stimulus, so that they both have appropriate values (that is, 100 and 125, respectively). Make sure that you leave everything inside Dark Gamesys->Loot other than Gold at 0. If you wanted to set up every single type of loot, you would need to create a lot more metaproperties, but these three will serve us for this tutorial.

Now to apply these new metaproperties to the loot types. Find Tiara (-1976) and open its properties. Notice the value of the Dark Gamesys->Loot property: Gold: 75, Gems: 50, Art: 0. Later on, when the player buys something and we need to take some of his money away, there's no easy way of knowing if the player is carrying Gold, Gems, or Art, so the simplest thing to do is to just change all the loot to have its value in Gold only.
Add the M-Loot125 metaproperty (75 + 50 = 125) and remove the Dark Gamesys->Loot property. Tiaras are now worth 125 Gold, and should hit the player with an intensity 125 LootStim when frobbed.

You also need to add the appropriate metaproperties to the other two loot items. Give Purse (-2609) M-Loot100 and GoldCoinStack (-2956) M-Loot025. Don't forget to remove the Dark Gamesys->Loot property if you see it.
If you wish, you can do the same thing to some of the other loot types.

The next thing to do is to make something happen when the player is hit by a LootStim.
To keep things orderly, create a metaproperty under M-LootTypes named 'M-LootReciever', and then give this new metaproperty to the Garrett (-2099) archetype. Go back to the properties for this new metaproperty, and add some Act/React Receptrons:

Stimulus Min Max Effect Quest Variable Operation Operand
LootStim 24.95 25.05 Set Quest Variable

Loot

Add 25
LootStim 99.95 100.05 Set Quest Variable

Loot

Add 100
LootStim 124.95 125.05 Set Quest Variable

Loot

Add 125

Obviously enough, if you want to set things up for every single piece of loot, you would need to add more Receptrons here, but these three are enough for this tutorial.

You should now have a working system to count the amount of loot the player is carrying (assuming that the level only contains the three types of loot which we've set up), but you have no way of knowing if it actually works.

To find out, create a new archetype under slidy_door (-1262), and name it BlueRoomDoor. You'll need it later, anyway.
Add Shape->Model Name and set it to 'door16'.
Add Door->Translating and set it up as follows:

Closed Position:   0.00
Open Position:   -3.00
Base Speed:   64
Axis:   Z-Axis
Status:   Closed
Hard Limits?:   False
Blocks Vision:   False
Blocks Sound %:   0
Push Mass:   5000

Now would probably be a good time to save the gamesys.

Create a long blue room, maybe around 12x32x16 in size.
Place a BlueRoomDoor in the very centre of this room.
For the time being, put the player start in the blue room, too.

Now, create a QuestVarTrigger (-4370) in the blue room (of course, you may want to give some item of furniture elsewhere in the mission the TrigQVar script instead, to save objects...).

Add the Trap>Quest Var property, and type in

>399:Loot

Create a ControlDevice link from the QuestVarTrigger to the BlueRoomDoor.
Finally, scatter a few pieces of loot around the blue room, making sure to only create those types of loot that you set up earlier. For example, you could create four Tiaras, six Purses, and eight GoldCoinStacks.

Save everything and go into Game Mode.
Now, slowly pick up the loot. Once you have 400 or more, the door will open with alarming speed.

Assuming everything went according to plan, you should now have a working loot-counting system, even if it only works with three types of loot.

 

- Buying Things Costs You Money -

Now, we can move on to the shop itself.
The shop we are going to create in this tutorial will sell the following items:

Item for Sale Price
Water Arrows 50
Rope Arrows 200
Noisemakers 250

Head over to the place where you want to build your shop, and create three noisemakers, or rather Noise (-129), three RopeArrow (-2603), and three water arrows (not crystals) from the archetype Water (-128).
We'll have to refer to these again later, so to make things easier to follow you should name them 'ShopWater1', 'ShopWater2', 'ShopWater3', 'ShopRope1', 'ShopRope2', 'ShopRope3', 'ShopNoise1', 'ShopNoise2'.
Modify the Physics->Model->Controls for all nine objects, and set Controls Active to Location, Rotation, otherwise the arrows will just shoot forwards and destroy themselves on the walls when the game starts. You might also want to create some tables to display these items on. Make the Physics->Model->Dimensions of these tables a bit taller than their models are, so that they encompass the arrows; otherwise the rope arrows will injure the player if he jumps onto the table and bumps against them.

Eventually, we're going to need another new stim, and now would be a good time to create it. Open the Act/React Stimuli section of the Object Hierarchy and create a new entry; MiscStim.
Remember that you need to save the gamesys, then the mission, and then reload the mission after creating a new stim, so you should do that now.

Now, flip over to the Metaproperties section . To keep things orderly, create a new one named Shop-Related-M and move M-LootTypes into it.
Next, make another metaproperty under Shop-Related-M named ForSale-M.
Finally, create three more under ForSale-M, named ForSale-M-050, ForSale-M-200, and ForSale-M-250. These metaproperties will be applied to all the items that are for sale in the shop.

Open the properties for ForSale-M, and add Engine Features->FrobInfo. Set the World Action to Move, Script.

Now, move on to ForSale-M-050, and add the following Act/React Source:

Stimulus Propagator Intensity Contact Types Velocity Coeff Frob Time Coeff
LootStim Contact -50 Frob In World
0
0

And also add this Act/React Receptron:

Stimulus Min Max Effect Target Object Agent Object
MiscStim 0.95 1.05 Remove Metaproperty

[Me]

ForSale-M-050

Set up the other two metaproperties the same way; hitting anyone who frobs them with a negative LootStim of the intensity their name suggests, and removing themselves when they are hit with an intensity 1 MiscStim.
The metaproperties need to be removed so that the player doesn't have to buy the items again if he drops them and then picks them up again. We'll set things up so that the objects get hit by an intensity 1 MiscStim later.
If you want to have more items for sale in the shop, you can easily create more ForSale-M metaproperties for the appropriate prices.

Once you've finished with those three metaproperties, go back to the Archetypes section of the Object Hierarchy, find Swag (-1708), and create a new archetype under it named Receipts. These will be pieces loot with a negative value, forced into the player's inventory when he purchases objects.
Open the properties for Receipts, and add this Act/React Source:

Stimulus Propagator Intensity Radius Flags Dispersion
MiscStim Radius 2 1.00 [None] None

...and this Act/React Receptron:

Stimulus Min Max Effect Target Object
MiscStim 1.95 2.05 Frob Object

[Me]

As soon as one of these Receipts is created, it will be frobbed. This should force it into the player's inventory, although there are some problems with this that will be addressed later.

Create three more archetypes under Receipts, and name them Receipt-050, Receipt-200, and Receipt-250. Give each of them a negative Gold value in Dark Gamesys->Loot, as appropriate to their names; Receipt-050 is worth -50 Gold, etc. Also, add these Act/React Receptrons:

Object Stimulus Min Max Effect Variable Operation Operand
Receipt-050 MiscStim 1.95 2.05 Set Quest Variable

Loot

Add -50
Receipt-200 MiscStim 1.95 2.05 Set Quest Variable

Loot

Add -200
Receipt-250 MiscStim 1.95 2.05 Set Quest Variable

Loot

Add -250

Using Add with a negative amount may seem a bit unusual, but please bear in mind that there is no Subtract option, and also no real need for one.
If you want to have more items for sale in the shop, it should be a simple enough matter to create more Receipts with different values.

And now, finally, go back to the Metaproperties section and find M-LootReciever. Add three new Act/React Receptrons.

Stimulus Min Max Effect Target Object Agent Object Effect Stimulus Mult By Then Add
LootStim No Min 0 Stimulate Object

[Source]

[Me] MiscStim 0.00 1.00
LootStim -50.05 -49.95 Create Object

Receipt-050

[Me]      
LootStim -200.05 -199.95 Create Object

Receipt-200

[Me]      
LootStim -250.05 -249.95 Create Object

Receipt-250

[Me]      

As you can see, any object that gives the player a negative LootStim will be hit with an intensity 2 MiscStim, removing its ForSale-M metaproperty. Other negative intensities of LootStim create the appropriate receipt, thus reducing the player's gold by the cost of the item. More receptrons can be added for additional Receipts, if you need them.

And now there are only two things left to do to complete the second part of the tutorial.
First, you need to add all the ForSale-M metaproperties to the nine 'for sale' items you created earlier, as follows:

Item for Sale Price
Water Arrows ForSale-M-050
Rope Arrows ForSale-M-200
Noisemakers ForSale-M-250

Finally, create a Swag (-1708), and give it the Dark Gamesys->Loot property. Set everything inside to 0.
The object also needs a Shape->Model Name, for example 'lotpouc2'.
Finally, put these new piece of Swag in the player's starting inventory. Unfortunately, due to the way Thief handles non-ingame shops, you can't link loot to the player's starting point. Instead, you need to create a loadout cache. To do this, simply create a marker, give it the LoadoutCache scripts and add a Contains from this marker to the new piece of Swag.
If the player does not have a loot object in his inventory, and he buys something, the negative loot will not be forced into his inventory, and you'll get a nasty error message, instead.

 

- You Don't Have Enough Gold -

Of course, the player shouldn't be able to buy anything when he doesn't have any money!
Making sure that he cannot is the final and most complicated part of this tutorial.

To make sure that the player can't take objects which are above his price range, we will disallow the player from frobbing them entirely.

Create a new metaproperty under Shop-Related-M and name it CannotBuy-M. Open its properties and add Engine Features->FrobInfo, leaving everything set to [None].
Next, add some Act/React Receptrons.

Stimulus Min Max Effect Target Object Agent Object
MiscStim 2.95 3.05 Remove Metaproperty

[Me]

CannotBuy-M
MiscStim

3.95

4.05 Abort    

You'll also need to give ForSale-M this Receptron:

Stimulus Min Max Effect Target Object Agent Object
MiscStim 3.95 4.05 Add Metaproperty

[Me]

CannotBuy-M

These stims will be used later to add and remove this metaproperty as the player gains and looses money. Notice how I've given CannotBuy-M an Abort receptron - this is to make sure that it cannot be added to an object more than once, which would make it a nightmare to remove again.

At the start of the game, the player shouldn't have any money, and therefore none of the items should be frobbable. Add CannotBuy-M to all nine of the 'for sale' objects.

The next thing to do is to set up a system where a projectile fired from an EmitterTrap hits a different object depending on how much loot the player is carrying.
It's time to return to that BlueRoomDoor we created earlier, which should be renamed 'LootDoor-050'.
Create two more of these BlueRoomDoors and name them 'LootDoor-200' and 'LootDoor-250'. We'll also need an EmitterTrap (-2555) named 'LootCheckEmit' and a DragonBan (-5781) named 'LootBanner-Max'.

Arrange these new objects as follows, where the X, Y, and Z values are offsets from the centre of the blue room that contains the objects.

Object Type Name X Y Z Heading
BlueRoomDoor LootDoor-050 0.00 0.00 0.00 0.00°
BlueRoomDoor LootDoor-200 0.00 1.00 0.00 0.00°
BlueRoomDoor LootDoor-250 0.00 2.00 0.00 0.00°
EmitterTrap LootCheckEmit 0.00 -4.00 0.00 90.00°
DragonBan LootBanner-Max 0.00 4.00 0.00 0.00°

Also, create a Button (-448), name it 'CheckLoot', and give it a ControlDevice link to LootCheckEmit.

Having done all of that, find the QuestVarTrigger you created earlier, rename it LootCheck050, and change the Trap>Quest Var property to

>49:Loot

Now, create two more QuestVarTriggers.
Name one 'LootCheck200', change the value in it's Trap>Quest Var to >199:Loot, and give it a ControlDevice link to LootDoor-200.
Repeat the process for the other QuestVarTrigger, putting >249:Loot into the Trap>Quest Var and giving it a ControlDevice to LootDoor-250.

Having done all that, one door should open when you have more than 50 loot, another when you have more than 200, and the third when you have more than 250.
If you want to sell other items in your shop, create a BlueRoomDoor and a QuestVarTrigger for each price, and rearrange all the BlueRoomDoors so that they are all 1 unit apart and LootBanner-Max is still at the end.

Now, open the Object Hierarchy and find Projectile (-59).
Create a new archetype under it named BlueProjectile, and open it's properties.
Add Physics>Model>Attributes and set Gravity % to 0.
Add Physics>Projectile>Initial Velocity and set the value of X to 20.00.
Now add an Act/React Source:

Stimulus Propagator Intensity Contact Types Velocity Coeff Frob Time Coeff
MiscStim Contact 10 Collision
0
0

Close the Object Hierarchy, and open the properties for LootCheckEmit.
Give it the ReloadTweqEmit scripts (replace the TrapTweqEmit scripts and leave the Don't Inherit checkbox set to False), and then add Tweq->Emit and enter BlueProjectile into the Emit What box.

Head back over to the Metaproperties section of the Object Hierarchy, and find M-LootReciever, which now needs one new Receptron:

Stimulus Min Max Effect Target Object
LootStim No Min No Max Frob Object

CheckLoot

Assuming that everything went according to plan, a BlueProjectile should be fired from LootCheckEmit every time the player gains or looses money (or at least those types of money that have been set up to be counted).
This BlueProjectile should hit one of the doors, depending on how much money the player has, or the banner, if he has enough money to buy the most expensive item (250).

We still need to set things up so that the CannotBuy-M metaproperties is added or removed from the items depending on which door or banner is hit. The easiest way to do this involves the creation of a few more metaproperties, so open the appropriate section of the Object Hierarchy.

Create a new metaproperty under Shop-Related-M named 'Loot-MoreThan-050', and give it some Act/React Receptrons:

Stimulus Min Max Effect Target Object Agent Object Effect Stimulus Mult By Then Add
MiscStim 9.95 10.05 Stimulate Object

ShopWater1

[Me] MiscStim 0.00 3.00
MiscStim 9.95 10.05 Stimulate Object

ShopWater2

[Me] MiscStim 0.00 3.00
MiscStim 9.95 10.05 Stimulate Object

ShopWater3

[Me] MiscStim 0.00 3.00

As we have given CannotBuy-M a Receptron to remove itself when it receives an intensity 3 MiscStim, this basically removes that metaproperty from all the water arrows when it gets hit by a BlueProjectile.

Now, we need to create another metaproperty under Loot-MoreThan-050, named 'Loot-MoreThan-200'. Give it these receptrons:

Stimulus Min Max Effect Target Object Agent Object Effect Stimulus Mult By Then Add
MiscStim 9.95 10.05 Stimulate Object

ShopRope1

[Me] MiscStim 0.00 3.00
MiscStim 9.95 10.05 Stimulate Object

ShopRope2

[Me] MiscStim 0.00 3.00
MiscStim 9.95 10.05 Stimulate Object

ShopRope3

[Me] MiscStim 0.00 3.00

And one more metaproperty under that, named 'Loot-MoreThan-250'. This time, the receptrons should stimulate the three 'for sale' noisemaker arrows.

You could easily create more metaproperties for items worth different amounts, so long as you keep them in the correct order, each one inheriting from the next cheapest. That way, when a BlueProjectile hits the deepest nested metaproperty, therefore removing CannotBuy-M from the most expensive items in the shop, it will also trigger all the receptrons for the cheaper items, and remove CannotBuy-M from them, too.

And now, it's time to add these new metaproperties to the BlueRoomDoors.
LootDoor-200 gets Loot-MoreThan-050, LootDoor-250 gets Loot-MoreThan-200, and LootBanner-Max gets Loot-MoreThan-250.

Save everything and go into game mode. As they become affordable, the 'for sale' items will become frobbable. However, they do not become infrobbable again when the player can no longer afford them, which rather defeats the whole purpose. To fix it, go back to the Metaproperties section of the Object Hierarchy, and create a new metaproperty under Shop-Related-M. Name it 'Loot-LessThan-250', and give it some Act/React Receptrons:

Stimulus Min Max Effect Target Object Agent Object Effect Stimulus Mult By Then Add
MiscStim 9.95 10.05 Stimulate Object

ShopNoise1

[Me] MiscStim 0.00 4.00
MiscStim 9.95 10.05 Stimulate Object

ShopNoise2

[Me] MiscStim 0.00 4.00
MiscStim 9.95 10.05 Stimulate Object

ShopNoise3

[Me] MiscStim 0.00 4.00

Next, create another metaproperty under it and name this one 'Loot-LessThan-200', giving it the following receptrons:

Stimulus Min Max Effect Target Object Agent Object Effect Stimulus Mult By Then Add
MiscStim 9.95 10.05 Stimulate Object

ShopRope1

[Me] MiscStim 0.00 4.00
MiscStim 9.95 10.05 Stimulate Object

ShopRope2

[Me] MiscStim 0.00 4.00
MiscStim 9.95 10.05 Stimulate Object

ShopRope3

[Me] MiscStim 0.00 4.00

As you've probably guessed, a final metaproperty, 'Loot-LessThan-050', should inherit from Loot-LessThan-200, and its set of receptrons should hit the three 'for sale' water arrows with an intensity 4 MiscStim.
As with the Loot-MoreThan-??? metaproperties, you could easily create more prices in between these ones, so long as you keep them all inheriting in descending order.

Head back to the BlueRoomDoors and give Loot-LessThan-050 to LootDoor-050, Loot-LessThan-200 to LootDoor-200, and Loot-LessThan-250 to LootDoor-250.

You should now have a working in-game shop!
Save everything, then go into game mode and have a look. See if you can find the problem before reading the next section

 

- Fixing The Problem -

There is still one problem with this system. To find it, go into game mode and pick up 50 worth of loot.
Now, approach the table with the water arrows, position yourself at such an angle that two of the arrows are near the centre of the screen, and press the frob button twice, very quickly.

You should end up with two water arrows, and -50 gold in your inventory. This happens because it takes a few moments for the BlueProjectile to travel down the blue room, which means that you can frob a second item before it hits the BlueRoomDoors and adds CannotBuy-M to the stuff you can't afford.
To get around this, we need to disallow the player from frobbing anything in the shop when he buys something, and only make things frobbable again when the BlueProjectile hits its target.

Find ForSale-M and give it some new Act/React Receptrons:

Stimulus Min Max Effect Target Object Agent Object Property
MiscStim 4.95 5.05 Set Property

[Me]

FrobInert (-1629) FrobInfo
MiscStim 2.95 4.05 Remove Property

[Me]

  FrobInfo
MiscStim 0.95 1.05 Remove Property

[Me]

  FrobInfo

And now, we need to create a new metaproperty named under Shop-Related-M named M-PatientLootReciever. Drag M-LootReciever inside it, and add this stack of Act/React Receptrons:

Stimulus Min Max Effect Target Object Agent Object Effect Stimulus Mult By Then Add
LootStim No Min No Max Stimulate Object

ShopWater1

[Me] MiscStim 0.00 5.00
LootStim No Min No Max Stimulate Object

ShopWater2

[Me] MiscStim 0.00 5.00
LootStim No Min No Max Stimulate Object

ShopWater3

[Me] MiscStim 0.00 5.00


Keep adding receptrons until you have one for every single 'for sale' item that in your shop.

Every time the player gets hit by a LootStim, all the items in the shop should get zapped by an intensity 5 MiscStim, which should change set all of their Engine Features->FrobInfo properties so that they cannot be frobbed.
If you're wondering why I've done it this way, rather than just giving PatientLootReciever a stack of Set Property receptrons, think about what would happen if the object suddenly became infrobbable after the player had bought it...
This way, the property is only changed if the object still has it's ForSale-M metaproperty.

One final note: hitting the shop's supply of water arrows with a fire arrow will destroy them, so it would be a really good idea to add give ForSale-M an Abort receptron for FireStim, and you might as well add some more for WaterStim, and WeaponStim, too.


Congratulations, you should now have a fully functional and reliable in-game shop!
You should easily be able to expand this system to more purchasable items and loot types.

Once again, I have a small mission which demonstrates an in-game shop in action, which you can download here.

There are, however, a few minor problems that should be looked into, although they are not essential to the running of the shop. These have been addressed in the following section.

 

- Belts and Boxes -

When we created the loot earlier in this tutorial, I never specified where to put it, so you probably just dumped it on the floor.
In a real mission, however, you'll want to put loot in more interesting locations, such as on people's belts and inside containers. In doing so, you will run into some serious problems:
When you try to steal an item from an alert AI, the Move part of the item's FrobInfo is blocked, but the Script part is not. In other words, the LootStim is sent, but the player doesn't get the item, which means that the player can repeatedly frob the item, increasing the loot counter each time, but without the loot item in the player's inventory reflecting the change.
The easy solution is to just not have any loot on people's belts, but there is another way, which I will explain in a moment.

But first, we should take a look at the second problem. When the player frobs a box containing a piece of loot, the object is put in his inventory, but, seeing as the player hasn't actually frobbed the item, the LootStim is never sent. What this means is that, while the amount of money the player thinks he has increases, the loot counter does not, and so the money can't be used to buy things. Again, you could just avoid placing loot inside containers, but that's hardly a proper solution.

To fix both of these problems, we'll need a new stim named PermeateStim (save gamesys, save mission, reload mission).

Next, create a Reciepts somewhere that the player can never reach it, and name it 'PlusLoot'.
To make sure it doesn't destroy itself as soon as the game start, give it this Act/React Receptron:

Stimulus Min Max Effect Target Object Agent Object
MiscStim

1.95

2.05 Abort    

Find Treasure (-224) in the Object Hierarchy and create a new archetype under it named ContainedLoot.
Add Engine Features->FrobInfo, and set the World Action to Move, Script.
Set Inventory->Can't Drop This to True, Inventory->Type to Item, then give it the M-LootReciever metaproperty and some Act/React Receptrons:

Stimulus Min Max Effect Target Object Agent Object Effect Stimulus Mult By Then Add Prop Name
PermeateStim 0 No Max Set Property

PlusLoot

[Me]       Loot
PermeateStim 0 No Max Set Property

PlusLoot

[Me]       ModelName
PermeateStim 0 No Max Create Object

PlusLoot

[Me]        
PermeateStim 0 No Max Destroy Object

[Me]

         

Now, head over to the Garrett (-2099) archetype and add this receptron:

Stimulus Min Max Effect Target Object Coefficient Minimum Magnitude
PermeateStim No Min No Max Permeate Into Container

[Me]

1.00 0.00

Create a new metaproperty under Shop-Related-M named 'M-ContainedLootTypes', and create another metaproperty under that for each 'contained loot' value you wish to use - for example, M-'ContainedLoot100', 'M-ContainedLoot125', etc.
Give each of these a Dark Gamesys->Loot property of the appropriate amount (100 for ContainedLoot100,125 for M-ContainedLoot125, etc.), and also give each of them the following receptron, changing the 'Then Add' amount to the metaproperty's new Loot value.

Stimulus Min Max Effect Target Object Agent Object Effect Stimulus Mult By Then Add
PermeateStim No Min No Max Stimulate Object

[Me]

[Me] LootStim 0.00 100.00


Having done all of that, create one of these new ContainedLoot objects and either attach it to someone's belt or put it inside a container.
Give the object an appropriate Shape->Model Name, for example, 'lotpouc2'.

Next, you need to decide how much this piece of loot is supposed to be worth, give it the appropriate meteproperty, for example ContainedLoot125.
Finally, if the ContainedLoot is attached to a belt then give it this source, but if it's inside a container, give that the source instead:

Stimulus Propagator Intensity Contact Types Velocity Coeff Frob Time Coeff
PermeateStim Contact 125 Frob In World
0
0

(Replace the Intensity with an amount that matches the Loot value of the object.)

If you find it a bit repetitve to add this source to every single ContainedLoot, you can create some more archetypes under ContainedLoot for certain oft-used values, but they won't do much good unless you only plan to attach them to someone's belt.

Every time the player gets hit by a PermeateStim, it gets sent to every single item in his inventory. Any pieces of ContainedLoot in there will recieve the stim and create a special type of loot (based on PlusLoot) that gets forced into the player's inventory.
Before it gets created, PlusLoot is given the Loot value and Model Name of the ContainedLoot.. The PermeateStim is also converted into LootStim, which is proccessed by the M-LootReciever metaproperty.
If the ContainedLoot is on an alerted AI's belt, it won't be in the player's inventory when the PermeateStim hits him, and therefore the Loot quest variable is not changed.

Unfortunately, there's still a major problem with this this system; if you knock out an AI and then try to pick him up while the 'Auto-search bodies' option is enabled, the ContainedLoot will be put into the player's inventory, but will not hit the player with a PermeateStim. I can only think of two solutions to this problem, one of which is to simply give the Garrett archetype the following Act/React Source:

Stimulus Propagator Intensity Radius Flags Dispersion Flags Period
PermeateStim Radius 1 0.01 [None] None No Max Firings 500

There are, however, two problems with that solution; firstly, the repeatedly firing stim will slow the whole game down slightly, and secondly, auto-searching a body and then grabbing another piece of loot with a differint value will cause the system to break. Hopefully no one will manage to do that in 500ms...

The other method is much more complicated, and requires GayleSaver's custom scripts to work.
To set up this system, first give the ContainedLoot archetype the TrapSMTrans script, and then create two TrapTrig (-2123) objects. Name them 'ContainedLootFixDelay' and 'ContainedLootFix'. Give the first the TrapTimedRelay scripts, a Scipt->Timing of 10, and a ControlDevice link to the ContainedLootFix..
Now, give the ContainedLootFix the TrapStim script, add Editor->Design Note, and set it up as follows:

stim="PermeateStim";intensity=1.00

Finally, create two links; a ScriptParams link from the ContainedLoot archetype to ContainedLootFixDelay (with a Data of 'InvSelect'), and a ControlDevice link from ContainedLootFix to your starting point.

Each time the player grabs some ContainedLoot, the TrapSMTrans will send a ControlDevice 'on' signal to ContainedLootFixDelay, which will wait 10 miliseconds and then activate the TrapStim, which, in turn, will hit the player with a PermeateStim. For some reason, everything goes wrong if you don't put in the 10ms delay...

If you added the source described in the first solution to the Garrett archetype, you can remove it again if you use the second method.

As you can see, this makes it a lot more hassle to put loot on people's belts and inside containers, but no one said creating an ingame shop was easy...

And now, assuming everything went according to plan, you should now have a fully working shop which accepts loot found inside containers, just like this one I made earlier.

Well done!