• 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!

Lua Target Spell.

Joined
May 23, 2010
Messages
185
Reaction score
23
Oh, i have a problem with this spell,

Code:
local scom1 = createCombatObject()
local scom2 = createCombatObject()
local scom3 = createCombatObject()
local scom4 = createCombatObject()

local combat1 = createCombatObject()
setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat1, COMBAT_PARAM_EFFECT, CONST_ME_DRAWBLOOD)
setCombatParam(combat1, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_WEAPONTYPE)
setCombatFormula(combat1, COMBAT_FORMULA_SKILL, 0, 0, 3.0, 0)
 
local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat2, COMBAT_PARAM_EFFECT, CONST_ME_DRAWBLOOD)
setCombatParam(combat2, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_WEAPONTYPE)
setCombatFormula(combat2, COMBAT_FORMULA_SKILL, 0, 0, 3.0, 0)

local combat3 = createCombatObject()
setCombatParam(combat3, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat3, COMBAT_PARAM_EFFECT, CONST_ME_DRAWBLOOD)
setCombatParam(combat3, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_WEAPONTYPE)
setCombatFormula(combat3, COMBAT_FORMULA_SKILL, 0, 0, 3.0, 0)
 
local combat4 = createCombatObject()
setCombatParam(combat4, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat4, COMBAT_PARAM_EFFECT, CONST_ME_DRAWBLOOD)
setCombatParam(combat4, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_WEAPONTYPE)
setCombatFormula(combat4, COMBAT_FORMULA_SKILL, 0, 0, 3.0, 0)


arr1 =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0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
}

    

arr4 = {
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
}

local area1 = createCombatArea(arr1)
local area2 = createCombatArea(arr2)
local area3 = createCombatArea(arr3)
local area4 = createCombatArea(arr4)
setCombatArea(scom1, area1)
setCombatArea(scom2, area2)
setCombatArea(scom3, area3)
setCombatArea(scom4, area4)

function onTargetTile1(cid, pos)
          doCombat(cid,combat1,positionToVariant(pos))
end

function onTargetTile2(cid, pos)
    doCombat(cid,combat2,positionToVariant(pos))
end

function onTargetTile3(cid, pos)
          doCombat(cid,combat3,positionToVariant(pos))
end

function onTargetTile4(cid, pos)
    doCombat(cid,combat4,positionToVariant(pos))
end

setCombatCallback(scom1, CALLBACK_PARAM_TARGETTILE, "onTargetTile1")
setCombatCallback(scom2, CALLBACK_PARAM_TARGETTILE, "onTargetTile2")
setCombatCallback(scom3, CALLBACK_PARAM_TARGETTILE, "onTargetTile3")
setCombatCallback(scom4, CALLBACK_PARAM_TARGETTILE, "onTargetTile4")

local function onCastSpell1(parameters)
     doCombat(parameters.cid, scom1, parameters.var)
end

local function onCastSpell2(parameters)
   doCombat(parameters.cid, scom2, parameters.var)
end

local function onCastSpell3(parameters)
     doCombat(parameters.cid, scom3, parameters.var)
end

local function onCastSpell4(parameters)
   doCombat(parameters.cid, scom4, parameters.var)
end

function onCastSpell(cid, var)
local parameters = { cid = cid, var = var}
addEvent(onCastSpell1, 100, parameters)
addEvent(onCastSpell2, 300, parameters)
addEvent(onCastSpell3, 500, parameters)
addEvent(onCastSpell4, 700, parameters)
end

I using Coldown 8.7, and this spell is the only that doesn't work with the colddown icon system, i don't know what is happening.
 
Last edited:
yes i have, the problem is, when i cast the spell, i can control it in the protection zone, and kill other people inside DP, i don~t get PZ locked.
 
Back
Top