• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

Spell checking if casters have same target TFS 1.0

Moj mistrz

Monster Creator
Joined
Feb 1, 2008
Messages
932
Solutions
10
Reaction score
308
Location
Poland
Hello, I want you great scripters to tell me if it's possible to make one spell used by two different monsters, checking if they have same target and returns some value.

Like -
Code:
if monster1 target = monster2 target then
docreaturesay(we have same target!)
else
docreaturesay(we have different targets)

Waiting for responses. Thanks for any help.
@Ninja , @Mark , @Summ , @Printer , @Evan, @cbrm
 
For 0.3+

Code:
function onCastSpell(cid, var)
    local t = getSpectators(getCreaturePosition(getCreatureTarget), 7, 5, false)
    local check = 0
    if #t ~= nil then
        for i = 1, #t do
            if getCreatureName(t[i]) == getCreatureName(cid) then
                if getCreatureTarget(t[i]) == getCreatureTarget(cid) then
                    check = check + 1
                end
            end
        end
    end
    if check >= 2 then
        --
        --
        doCombat(cid, combat, var)
        --
        --
    end
    return true
end
 
Back
Top