Adding medications
Last updated
Last updated
Advanced Roleplay Environment supports modular medications. This means you can easily add medications or edit them accordingly.
In order to add a medication we just need to add the medication inside the medications file and configure the properties accordingly.
Since all medications are saved inside script/entities/medications.lua
, we will open this file. This should look like this:
Now we will scroll to the bottom and just copy a medication from above and edit it to our needs so it should look like this:
There are many options available for us to configure the medication perfectly to our needs.
painReduce
This property is a number and contains the value of how much the pain get reduced.
painReduce = 0.3
The pain get reduced by 0.3 * effectRatio
per second.
hrIncreaseLow
This property is a table contains a table { minIncrease, maxIncrease } how much the heart rate will increase or decrease if the heart rate is below 55 bpm.
hrIncreaseLow = { -10, 10 }
The heart rate will in minimum decrease by 10 or in maximum increase by 10 if the heart rate is below 55 bpm.
hrIncreaseNormal
This property is a table contains a table { minIncrease, maxIncrease } how much the heart rate will increase or decrease if the heart rate is >= 55 bpm and <= 110 bpm.
hrIncreaseNormal = { 5, 20 }
The heart rate will in minimum increase by 5 and in maximum by 20 if the heart rate is >= 55 bpm and <= 110 bpm.
hrIncreaseHigh
This property is a table contains a table { minIncrease, maxIncrease } how much the heart rate will increase or decrease if the heart rate is > 110 bpm
hrIncreaseHigh = { 2, 7 }
The heart rate will in minimum increase by 2 and in maximum by 7 if the heart rate is above 110 bpm.
timeInSystem (maxTimeInSystem)
This property is a number and contains the value how long a medication is kept in the system before removing it. Also it will be used to calculate the effect ratio. (in seconds)
timeInSystem = 1800
The medication is kept 1800 seconds in system before removing it.
Calculation for the effect ratio:
effectRatio = min((timeInSystem / timeTillMaxEffect) ^ 2, 1) * (maxTimeInSystem - timeInSystem) / maxTimeInSystem
To understand the effect ratio formula we need to define the values where:
- timeInSystem is variable and describes the current time in the system in seconds.
- timeTillMaxEffect is a constant and describes the time till the effect ratio reaches 1.
- maxTimeInSystem is a constant and describes how long the medication will stay in the system until it reaches 0.0 effect ratio at the end.
- min(valueA, valueB) will always return the lowest value of both so if valueA is 5 and valueB is 8 it will return 5. In our example it is a calculation and 1 so it will always be less <= 1.
timeTillMaxEffect
This property is a number and contains the value when the max effect ratio is reached. (in seconds)
timeTillMaxEffect = 30
The medication will reach its max effect after 30 seconds so a effect ratio of 1.
maxDose
This property is a number and contains the value after how many medications in system the function onOverDose
will be triggered.
maxDose = 5
The property onOverDose will be triggered after 5 times of injection of this medication.
onOverDose
This property is a function and will be triggered if the number of the same medication in the system is >= maxDose
onOverDose = function()
print("hello!")
end
The function will print "hello" after this function has been triggered.
viscosityChange
The viscosity of a fluid is a measure of its resistance to gradual deformation by shear stress or tensile stress. For liquids, it corresponds to the informal concept of "thickness". This value will increase/decrease the viscoty of the blood with the percentage given. Where 100 = max. Using the minus will decrease viscosity.
viscosityChange = -10
The peripheral resistance will reduce by maximum 10 and viscosityChange * effectRatio
per second.