Adding infusions

Advanced Roleplay Environment supports modular infusions. This means you can easily add medications or edit them accordingly.

Adding infusions

In order to add a infusion we just need to add the infusion inside the infusions file and configure the properties accordingly.

Adding the infusion

Since all infusion are saved inside script/entities/infusions.lua, we will open this file. This should look like this:

Now we will scroll to the bottom and just copy a infusion from above and edit it to our needs so it should look like this:

Configuring the infusion

There are many options available for us to configure the infusion perfectly to our needs.

OptionDescriptionExample

availableVolumes

This property is a table and contains all volumes that will be created and displayed in the ui.

availableVolumes = { 100, 200 } Using it like this will produce two volumes: One with 100 milliliters and one with 200 milliliters.

cooldown

This property is a number and contains the value of how long the action takes to apply this infusion via the ui.

cooldown = 10 The action has a duration of 10 seconds.

ivChangePerSecond

This property is a number and contains value of how much of the infusion will be removed/processed per second.

ivChangePerSecond = 3 The infusion will process 3 milliliter per second. So if 100 milliliters is our volume the infusion has gone trough after ~34 seconds (100ml / 3ml/s).

onTick

This property is a function and will be triggered every second.

onTick = function(clientData, healthBuffer, bodyPart, ivChange, totalVolume) print("hello") end Using it like this the infusion would print "hello" every second in the console.

onFinish

This property is a function that will be executed when the infusion has gone trough.

onFinish = function(clientData, healthBuffer, bodyPart, ivChange, givenVolume) print("finished") end Using it like this the infusion would print "finished" in the console when it has gone trough.

Adding the translation

Since the translation is missing it will look weird inside the ui. So we need to add it in our locale files. So we open our locale file (example: languages/en.json) and copy 'n' paste just an other entry and edit the values accordingly. So it should look like this if added like above:

Last updated