Adding menu actions

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

Adding menu actions

In order to add a menu actionswe just need to add the menu action inside the menu actions file and configure the properties accordingly.

Adding the action

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

Now we will select our category and just copy a action from above and edit it to our needs so it should look like this (In this example I've selected the category "carry"):

Configuring the menu action

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

OptionDescriptionExample

name

This property is a string and contains the unique name of the action which should be unique.

name = "TEST_ACTION" The name of this action in the locales for example is "TEST_ACTION".

cooldown

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

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

animation

This property is a table and contains the animation that will be played upon executing the action. structure = { lib = "YOUR_LIB", name = "YOUR_NAME" }

animation = { lib = "anim@heists@narcotics@funding@gang_idle", name = "gang_chatting_idle01" } The animation defined above will be used.

hideOnSelf

This property is a boolean and sets if the action should be only shown on other players or should also be shown on the local player.

hideOnSelf = true This action is only shown on other players.

exclusiveBodyParts

This property is a table that contains exclusive body parts the action should be shown on. (If not defined, the action will be shown on all body parts)

exclusiveBodyParts = { "HEAD" } This action will be only shown on the head.

log

This property is a function that will be executed and the return value will be added to the log of the player. This function must return a string.

log = function(bodyPart, result) return "hello!" end Using it like this, it will add "hello" to the action log.

condition

This property is a function that will be executed to check if the function should be shown or not. This function must return true or false.

condition = function(healthBuffer, bodyPart) return not healthBuffer.bodybag end This action will only show if the player is not in a bodybag.

action

This property is a function that will be executed when the action has been clicked. The function must have call the callback function that will be passed to the log function.

action = function(clientData, healthBuffer, bodyPart, callback) print("done") callback(true) end Using it like this the action will print "done" in the console on use.

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