# ValuesAndPrices.lua

I’m going to transition here into setting up a custom mod and explaining the parts of ValuesAndPrices and then we’ll discuss the global shop, player shops, and vehicle shops.

Please note, I’ll be adding 3 new mods to the load order, the entire load order is now. I’m including damnlib and the M998 to be used as examples, they are not required. The last mod is the example mod I’ll be loading which will include the ValuesAndPrices.lua. This VlauesAndPrices.lua was taken from Bikini’s Example mod under media/lua/shared/ValuesAndPrices.lua

BTSE\_Base  
BTSE\_Economy  
damnlib  
92amgeneralM998  
Fallens\_Guide\_Mod

## Defining exchangeable values

From the example page you can see the included definition.

```lua
BTSE.Economy:addValuablesEntry("Base.Money", 1);
```

Let’s make another. This time we’ll give players 10 money for exchanging a box of .38 Special Rounds.

```lua
BTSE.Economy:addValuablesEntry("Base.Bullets38Box", 10);
```

<p class="callout info">Note: It’s important to note that the module is REQUIRED for the item. Module.ItemType</p>

The next screenshot is what it looks like in vs code.

<span id="bkmrk--1" style="font-size: 11pt; font-family: Arial,sans-serif; color: #000000; background-color: transparent; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="border: none; display: inline-block; overflow: hidden; width: 624px; height: 83px;">![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXeV5gLrpGpPxHzYQopIe2AlZiXrHGdqUFJRh8BtvBVmjdWpx_iTf1QTAhT6NXoiqyxtSeJcvbI8auNr8-6FPPwDRV1QT5pJ9GN2bL0ESfjLlF5Sb2a17rHebcuZh6LdYbYr9YCRqA?key=h1HiR97zRdTLVEaBFwhVPho2)</span></span>

This is what the Valuables tab looks like now.

<span id="bkmrk--3" style="font-size: 11pt; font-family: Arial,sans-serif; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="border: none; display: inline-block; overflow: hidden; width: 624px; height: 440px;">![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXftjwgvWly7U8_LfhkoyJteJA-PVYbrMLOTt7gKTrjLIko7xRWaUpWfHRbc6YDFfQeAypFT52QYM25BDZZwfZyQsrl65nGLf6lNBL8KtKqVwy93TqFrGdq2Bxk-kx4Qv25UydDTkA?key=h1HiR97zRdTLVEaBFwhVPho2)</span></span>

<p class="callout info">Note: Valuables ONLY return the primary currency.</p>

## Defining vehicles purchasable from the global vehicle shop.

We’ll start with the vanilla vehicle Base.CarNormal

To create this shop entry we’ll use the following code.

```lua
BTSE.Economy:addVehicleShopEntry("Base.CarNormal", {
    ["cash_primary"] = 5000,
});
```

This will create the shop entry and set the price of the car to 5000 cash of the primary currency.

You can add multiple types of currency here as well.

<p class="callout info">Note: The currency at the top of the list is used first if a player has enough of each currency.</p>

```lua
BTSE.Economy:addVehicleShopEntry("Base.CarNormal", {
    ["cash_primary"] = 5000,
    ["primary"] = 6000,
    ["tessera"] = 3000,
});
```

You can also add a custom description of the vehicle.

```lua
BTSE.Economy:addVehicleShopEntry("Base.CarNormal", {
    ["cash_primary"] = 5000,
}, {
    description = "A really normal car"
});
```

This also accepts IGUI for translations.

```lua
BTSE.Economy:addVehicleShopEntry("Base.CarNormal", {
    ["cash_primary"] = 5000,
}, {
    description = "IGUI_Fallenstestmod_normalcardesc"
});
```

<p class="callout info">Note: So far when someone buys a car, it will follow the Sandbox Option “General Condition” under the vehicles tab. </p>

<span id="bkmrk--5" style="font-size: 11pt; font-family: Arial,sans-serif; color: #666666; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="border: none; display: inline-block; overflow: hidden; width: 624px; height: 405px;">![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXesH8SUBasd6MqUY01xJr9sI2F-Omkh0XAXiHDZi-ldd29xPmxrA7dkyV9E9iI4Gh50V-gLuLI6NtRgxlvPDkaBBwbpka-fOds0NlJa9rTX_HRLmSslbvu_J0-NEbCIg-FimvbbQQ?key=h1HiR97zRdTLVEaBFwhVPho2)</span></span>

Now, let’s get a bit more dynamic with how the vehicles come out of the shop.   
We can have a car be fully repaired as it spawns with the repairAllParts option.

<p class="callout info">Note: This does not add parts to cars.</p>

```lua
BTSE.Economy:addVehicleShopEntry("Base.CarNormal", {
    ["cash_primary"] = 5000,
}, {
    description = "IGUI_Fallenstestmod_normalcardesc",
    repairAllParts = true,
});
```

<span id="bkmrk--7" style="font-size: 11pt; font-family: Arial,sans-serif; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="border: none; display: inline-block; overflow: hidden; width: 417px; height: 310px;">![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXeX4go8I3UVDN9yXCBb8H0OPSRv7LT6WpwNx_lx7cczwRgjP7OIHM-RI9ikBIJlQhbNOWCOaJpT0vjqABbofn3NPEaQJieSOQJRbhET_hlq7QNCFvh-WU7pa3dbCt1oS_im4Dw_JQ?key=h1HiR97zRdTLVEaBFwhVPho2)</span></span>

We’re going to change the vehicle here to KI5’s M998 General Humvee.  
Next we’re going to look at the addSpecialParts option.

```lua
BTSE.Economy:addVehicleShopEntry("Base.92amgeneralM998", {
    ["cash_primary"] = 35000,
    ["primary"] = 40000,
}, {
    addSpecialParts = {
        ["M998Bullbar"] = "Base.M998Bullbar2_Item",
        ["M998Roofrack"] = "Base.M998Roofrack1_Item",
        ["M998Muffler"] = "Base.M998Muffler2_Item",
    }
});
```

This allows you to specify which part can be installed into which vehicle slot. To spell out the option above \[“M998Bullbar”\] is the item slot and "Base.M998Bullbar2\_Item" is the item itself. As a reminder you need both the module and the item type itself, so Module.itemtype.

Once you have specified new items to be installed you can include repairAllParts to have all of these the original items and the newly added items to be 100% on spawn.

```lua
BTSE.Economy:addVehicleShopEntry("Base.92amgeneralM998", {
    ["cash_primary"] = 35000,
    ["primary"] = 40000,
}, {
    repairAllParts = true,
    addSpecialParts = {
        ["M998Bullbar"] = "Base.M998Bullbar2_Item",
        ["M998Roofrack"] = "Base.M998Roofrack1_Item",
        ["M998Muffler"] = "Base.M998Muffler2_Item",
    }
});
```

A couple of other options worth mentioning are skinIndex and thumbnailPath.

```lua
BTSE.Economy:addVehicleShopEntry("Base.92amgeneralM998", {
    ["cash_primary"] = 35000,
    ["primary"] = 40000,
}, {
    repairAllParts = true,
    addSpecialParts = {
        ["M998Bullbar"] = "Base.M998Bullbar2_Item",
        ["M998Roofrack"] = "Base.M998Roofrack1_Item",
        ["M998Muffler"] = "Base.M998Muffler2_Item",
    },
    skinIndex = 6,
    thumbnailPath = "media/ui/example/nomad-humvee.png",
});
```

The skinIndex allows you to force a vehicle to spawn with a specific skin available to it. The index starts with 0.

The thumbnailPath allows you to specify a different thumbnail to load for this sale vehicle.

<span id="bkmrk--11" style="font-size: 11pt; font-family: Arial,sans-serif; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="border: none; display: inline-block; overflow: hidden; width: 624px; height: 464px;">![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXd5s0s-ln5UdJiu1QwfDwcXNh6lE9nRsqeywd5WXsK1kmW4dd4WhoGP4FSGqX1-aCQPOyNyF-EBo_qt1-NEcSFfP7LN19UBimxAGdOZJbqSH9-wGjBmOiKlUIWrvvUKyjWOyweG3w?key=h1HiR97zRdTLVEaBFwhVPho2)</span></span>

## Defining items purchasable from the global vehicle shop.

Let’s first define an item to be sold for a single currency.

```lua
BTSE.Economy:addItemShopEntry("Base.Money", {
    ["cash_primary"] = 1,
});
```

This creates a shop entry for 1 vanilla money item that costs 1 cash of the primary currency.  
Like vehicles you can also add multiple currencies. The first currency listed is the one with priority.

```lua
BTSE.Economy:addItemShopEntry("Base.Money", {
    ["cash_primary"] = 1,
    ["primary"] = 1,
});
```

You can also add an amount modifier to the item entry.

```lua
BTSE.Economy:addItemShopEntry("Base.Money", {
    ["cash_primary"] = 5,
}, {
    amount = 5,
});
```

This will return 5 of the item for that listed price.

<span id="bkmrk--13" style="font-size: 11pt; font-family: Arial,sans-serif; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="border: none; display: inline-block; overflow: hidden; width: 624px; height: 464px;">![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXcYORdG4TRgJfNnAZXr8CTfflRzWid5TMaXEecBdKrxsUUioP_8IH2mMDux2HzO_LTGuBBy0FdZvIPOfBDRvCQbTPF51FFk1HhXWOEFEdaXv7wOUA4QkpVuX1x7VaL2dJNQ3Bpjlg?key=h1HiR97zRdTLVEaBFwhVPho2)</span></span>

<span id="bkmrk--15" style="font-size: 11pt; font-family: Arial,sans-serif; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="border: none; display: inline-block; overflow: hidden; width: 624px; height: 468px;">![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXeAEYm_FKmR5I39jMVqhM_Ebvi--ythpCJnPFuuC7pDi7VN7fqcL6NATjZtnSGPxwW4IrzwEqDixU4DaMzUV5lXv1uDwYS-nCfaJrsq77csPayDC85rik_oL3UZL7fvEpbnHGRG?key=h1HiR97zRdTLVEaBFwhVPho2)</span></span>