✨Status Effects

An addon script to handle additional special effects for RP. Adds a framework that can be extended by servers to add their own effects.

More information about status effects and the associated job can be found on the store: Status Effects.

Framework Integrations

TMC.Common.TryApplyLuck

Attempts to apply luck to a value if statuseffects is running and the player has luck effects. For more info look at the ApplyLuck section.

local reward = TMC.Common.TryApplyLuck(
    50, --[[ original value ]],
    false, -- [[ negative check, if the luck should reduce the output instead ]])
    1, -- [[ If called from the server, this is the player server id. Otherwise unused.]]
)

TMC.Common.RandomChanceWithLuck

This works the same way as TMC.Common.RandomChance however will apply luck internally to return a true/false value

TMC.Common.RandomChanceWithLuck(
    1, -- [[ min ]]
    100, -- [[ max ]]
    50, -- [[ chance ]]
    false, -- [[ negative check, if the luck should reduce the chance instead ]]
    70, -- [[ optional, a maximum possible percentage after adjustment ]]
    1 -- [[ required on server side, player server id ]]
)

Client Exports

GetEffectValue

A client function that can be used to get the current (total) value of an effect.

ApplyLuck

Apply luck onto a value using the luck status effect. This is used to increase/decrease returned values based on the luck the player has. Useful for increasing robbery payouts, reducing rob chances, etc.

Server Exports

ApplyLuck

This works in the same way as the client function however must be provided with the player's server id.

Player Functions

Player functions are available via the player object (TMC.Functions.GetPlayer)

GetStatusEffectValue

Gets the current (total) value of an effect for a player.

GetStatusEffect

Returns the full list of items contributing to the status effect value.

HasStatusEffects

Returns true if there are any active status effects for the player

AddStatusEffect

Used to add a status effect to a player

RemoveStatuseffect

Remove status effect by the unique reference

Last updated