Effect Functions¶
GetMaxEffect(aIndex)¶
Returns the maximum number of effect slots an object can have.
AddEffect(lpObj, type, index, count, v1, v2, v3, v4, v5, v6, buffSendValue, attackerIndex, rmv)¶
Adds a buff/debuff effect to an object.
- Parameters:
lpObj(GameObject) — target objecttype(number) — effect type (0 or 1)index(number) — effect IDcount(number) — duration in seconds or charge countv1..v6(number) — effect values (damage, defense, etc.)buffSendValue(number) — client buff icon valueattackerIndex(number) — index of the effect sourcermv(number) — success chance (0-100), or -1 for always- Returns:
number— 1 on success, 0 on failure
-- Add +50 physical damage buff for 60 seconds, guaranteed
AddEffect(player, 1, 15, 60, 50, 0, 0, 0, 0, 0, 0, player.Index, -1)
DelEffect(lpObj, index)¶
Removes a specific effect by its ID.
- Returns:
boolean
DelEffectByGroup(lpObj, group)¶
Removes all effects belonging to a group.
- Returns:
boolean
GetEffect(lpObj, index)¶
Returns the GameCEffect object for the given effect ID, or nil if not found.
local eff = GetEffect(player, 1)
if eff then
LogAdd(LOG_RED, "Poison remaining: " .. eff.m_time .. "s")
end
GetEffectByGroup(lpObj, group)¶
Returns the first GameCEffect in the given group, or nil.
local scroll = GetEffectByGroup(player, 20)
if scroll then
LogAdd(LOG_BLUE, "Scroll value: " .. scroll.m_value[1])
end
CheckEffect(lpObj, index)¶
Returns true if the object has the effect active.
if CheckEffect(target, 16) then -- Mana Shield
LogAdd(LOG_BLUE, "Target has Mana Shield active.")
end
CheckEffectByGroup(lpObj, group)¶
Returns true if the object has any effect from the given group.
if CheckEffectByGroup(player, 35) then
GCNoticeSend(player.Index, 1, "You already have an event buff.")
end
CheckStunEffect(lpObj)¶
Returns true if the object is stunned.
CheckImmobilizeEffect(lpObj)¶
Returns true if the object is immobilized.
if CheckImmobilizeEffect(player) then
GCNoticeSend(player.Index, 1, "You are frozen and cannot move!")
end
CheckDebuffSend(index)¶
Returns true if the given effect index is classified as a debuff for client display.
ClearAllEffect(lpObj)¶
Removes all effects from the object.
ClearDebuffEffect(lpObj, count)¶
Removes up to count debuff effects from the object.
UpgradeDamageByClass(lpObj)¶
Calculates and returns bonus damage based on the character's class and stats.
- Returns:
number
Help