add_buff

Adds the given buff to the entity.

Arguments

A table defining a buff configuration or a Buff UserData or a string representing a buff UUID

Errors

  • If an invalid type is passed to the function
  • If the buff definition does not have a valid UUID

Signature

---@param value Buff|table|string @UserData table or string representing a valid buff
---@return Buff
function Entity:add_buff(value)

Example of Usage

-- bind the exposed entity UserData to a local variable
local entityAPI = alacrity.Entity

-- create a new random unique user ID
local e = entityAPI.new({
    id = id
    name = "Ad-Hoc Test Entity",
    description = "Ad-Hoc test entity",
    attributes = {},
    properties = {
        { name = "level", value = 10, hide_from_conditions = false },
    },
})

local ok, err = pcall(function()
    entity:add_buff("648b13f8-2cbe-43d0-a493-6de63e8ba4ec")
end)

assert(ok)