Avorion Script API Documentation

UsableInventoryItem Script Predefined Functions

Tip: Scroll down for an example script!

function create(item, rarity, values...)

Used to create a new usable inventory item. A pre-filled variant of the item is given as first argument, with script, rarity and icon color already filled in. This item can be filled and should be returned after creating it.

Parameters

item A pre-filled variant of the item, with script (don't change in this function), rarity and icon color already filled in
rarity The rarity of the item, can be changed
values... All values passed after rarity when calling UsableInventoryItem(script, rarity, ...)

Expected return values

The completely filled in item with tooltip, values, etc.

function activate(player)

Called when the player uses the item. Sector and Faction background variables are set, entity of the player using it CAN be set. Return true if the usage was successful and the item can be depleted, if the depletedOnUse property is set to true. If false is returned, the item won't be depleted and will be able to be used again.

Parameters

player The player using the item. This will always be a player, never an Alliance.

Expected return values

true if the usage was successful and the item can be depleted (only if the depletedOnUse property is set to true).


UsableInventoryItem Example Script

-- Used to create a new usable inventory item. A pre-filled variant of the item is given as first
-- argument, with script, rarity and icon color already filled in. This item can be filled and
-- should be returned after creating it.
function create(item, rarity, values...)

end

-- Called when the player uses the item. Sector and Faction background variables are set, entity
-- of the player using it CAN be set. Return true if the usage was successful and the item can
-- be depleted, if the depletedOnUse property is set to true. If false is returned, the item won't
-- be depleted and will be able to be used again.
function activate(player)

end
Overview
Home Functions Search
Search:

This is the official documentation for the scripting API of Avorion. This documentation is automatically generated and not necessarily complete. Depending on the context in which functions exist, some documentation such as descriptions, return values or variable names or types may be missing.

Work in Progress. Documentation of Avorion Version: 2.5.7 c8e4beec84f7