Labs

The following files are used for Labs config:

  • config/_labs.lua: Here you can setup the default lab stash options, upgrades prices, item used for raids, etc.

  • client/editable/labs.lua: Here you can find the canSetLab() a function where you can run your own export and return true/false to allow the player to place their Lab entrance. You can also find the event av_drugs:cook that gets triggered when a player interacts with the cooking station inside a lab and av_drugs:interaction an event that gets triggered when the player interacts with any other zone that is not for cooking or lab stash.

  • server/editable/_labs.lua: All labs types, shell models, interaction zones, drugs linked to every lab, etc.

I'll highly recommend you to just stick to the config files if you aren't experienced enough, otherwise you can break the labs or the whole script.

Adding a new lab

For this example we are gonna create a new lab shell linked to an item named my_new_key, lab type will be "newdrug" and the drug produced inside this lab will be "avscripts".

  • We need to link our new lab to a key item, go to server/editable/_labs.lua and add your key item and lab type inside Config.LabKeys:

  • Copy/Paste one of the existing labs from Config.LabTypes, change the index key to match your lab type "newdrug", the drug produced in this lab is "avscripts" and the shell we are gonna use is "k4mb1_acid2_shell" from k4mb1 subscription package, if you want to register a new shell make sure to read the Shells Guide before you continue configuring your lab.

  • Our lab config should look something like this:

Interactions: This are the zones where the players will be able to interact and cook, package, cut or do whatever you want, interactions are tables that contains the following:

  • event: Event triggered when player press [E].

  • label: Label shown for TextUI.

  • coords: Coords offset where the zone is located, this offsets are based on the shell, check the Shells guide to learn how to get this values for every shell.

  • ingredients: A table that contains the needed items for cooking.

  • Output: A table with items the player will receive after cooking on this station.

  • Animation: Animation options used for progressbar.

Events: You can notice there's an event named av_drugs:cook this event is the only event that will check if the lab is on cooldown before the player starts cooking.

Other events doesn't run a cooldown check and are meant for cutting or packaging only.

  • Now we need to register our drug (if is not already registered), for this go to server/editable/_drugs.lua and add it to Config.Drugs, if the drug is not registered on this table it will be ignored for Zones Map, XP, etc.

  • Now we need to add our key item to the market section, before you do this make sure to register it in your Framework/Inventory.

  • Go to server/editable/_market.lua and register your key item in Config.Market, copy/paste one of the existing items and modify it to fit your new key item and lab type:

Item Format:

  • index key: Is the item name, must be unique, no duplicated items are allowed otherwise you will only see 1 in UI.

  • label: How the player will see it in the Market tab.

  • price: Is obvious

  • account: Name of the account used for this item, only works with money accounts registered in your Framework, avoid using any crypto token or other random value that is not registered as money account.

  • accountlabel: How the player will see the account in UI.

  • image: Just in case u want to use a different image from the one in your inventory.

  • canAccess: This function needs to return true/false and it will allow the player to see this item in the market tab, by default all items are blocked for Cops, there's other items like lab keys that requires a specific drug level to access.

  • setMetadata: Metadata set to the item bought, for labs is required that we add the fields owner, labType and description.

  • We are almost ready, we are just missing one step and is the Drug Formula, you can setup the formula in server/editable/_inputs.lua

Note: I'm not posting anything related to formulas here to avoid MG but you can find better explanation about formulas and how purity is calculated inside the _inputs.lua file.

If you have any question please use the Support Channel on Discord, don't open a ticket so other ppl who might have the same question can find the answer by using the search bar.

Last updated