No categories assigned

LUA:HasSpellEffect

Revision as of 13:48, 30 August 2013 by Jabantiz (talk | contribs) (Created page with "= LUA Functions: HasSpellEffect() = Will check to see if the given spawn has the given spell effect ==== Syntax ==== HasSpellEffect(param1, param2, [param3]) ==== Parameters ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

LUA Functions: HasSpellEffect()

Will check to see if the given spawn has the given spell effect


Syntax

HasSpellEffect(param1, param2, [param3])


Parameters

Required - param1 (Spawn), param2 (int32)
param1 is the spawn we want to check
param2 is the spell id we want to check for
Optional - param3 (int8)
param3 is the tier of the spell we want to check for


Usage

function hailed(NPC, Spawn)
    if HasSpellEffect(Spawn, 12345) then
        Say(NPC, "You already have the buff")
    else
        CastSpell(Spawn, 12345, 5, NPC)
    end
end

This will cause the NPC to cast a spell on the player who hailed it if they don't already have the spell on them.

Notes

If a tier is not given it will just look for a matching spell id

This will work on both Players and NPC's