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

marcos16

Falkhonn
Joined
May 4, 2012
Messages
224
Reaction score
1
Magic when used in the same sqm of giving effect to two.

Example:
If a player is in the same sqm than the other and use this magic effect goes to the two, which modify the effect to be only those who use magic?

Code:
local combat1 = createCombatObject()
setCombatParam(combat1, COMBAT_PARAM_EFFECT, 0)
setCombatParam(combat1, COMBAT_PARAM_AGGRESSIVE, FALSE)

local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_AGGRESSIVE, FALSE)
local condition2 = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition2, CONDITION_PARAM_TICKS, 40000)
setConditionParam(condition2, CONDITION_PARAM_STAT_MAXHEALTHPERCENT, 90)
setConditionParam(condition2, CONDITION_PARAM_SKILL_AXE, 20)
setConditionParam(condition2, CONDITION_PARAM_SKILL_CLUB,20)
setCombatParam(combat2, COMBAT_PARAM_EFFECT, CONST_ME_STONES)
setConditionParam(condition2, CONDITION_PARAM_BUFF, true)
setCombatCondition(combat2, condition2)

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

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

local area1 = createCombatArea(arr1)
local area2 = createCombatArea(arr2)
setCombatArea(combat1, area1)
setCombatArea(combat2, area2)

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

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

function onCastSpell(cid, var)
doCreatureSay(cid,"Hoooooold!", TALKTYPE_ORANGE_1)  
local parameters = { cid = cid, var = var, combat1 = combat1, combat2 = combat2 }
addEvent(onCastSpell1, 10, parameters)
addEvent(onCastSpell2, 10, parameters)

return TRUE
end
 
I don't see the need to for the 2 combat area's but here you go.
Code:
local area = {
    { -- 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, 0, 0, 0, 0, 0, 0, 0},
        {0, 0, 0, 0, 0, 3, 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, 0},
        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    },
    { -- 2
        {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, 1, 1, 0, 0, 0, 0},
        {0, 0, 0, 0, 1, 3, 1, 0, 0, 0, 0},
        {0, 0, 0, 0, 1, 1, 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 combat = {}

for i = 1, #area do
    combat[i] = createCombatObject()
    setCombatArea(combat[i], createCombatArea(area[i]))
end

setCombatParam(combat[2], COMBAT_PARAM_AGGRESSIVE, FALSE)
setCombatParam(combat[2], COMBAT_PARAM_EFFECT, CONST_ME_STONES)

local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_TICKS, 40000)
setConditionParam(condition, CONDITION_PARAM_STAT_MAXHEALTHPERCENT, 90)
setConditionParam(condition, CONDITION_PARAM_SKILL_AXE, 20)
setConditionParam(condition, CONDITION_PARAM_SKILL_CLUB,20)
setConditionParam(condition, CONDITION_PARAM_BUFF, true)
setCombatCondition(combat[2], condition)

function onCastSpell(cid, var)
    doCreatureSay(cid,"Hoooooold!", TALKTYPE_ORANGE_1)
    for x = 1, #area do
        addEvent(doCombat, 10, cid, combat[x], var)
    end
    return true
end

I just re-wrote the script, I don't understand your question.
 
nowdays when making spell areas you dont need to map out the entire area, just the player and the effects relative to the player, eg in first case its enough with
{{3}}
and in second case
{1,1,1}
{1,3,1}
{1,1,1}
saves quite a bit of table creating on cast :)
 
nowdays when making spell areas you dont need to map out the entire area, just the player and the effects relative to the player, eg in first case its enough with
{{3}}
and in second case
{1,1,1}
{1,3,1}
{1,1,1}
saves quite a bit of table creating on cast :)
Just copy and pasting. ;)
 
Back
Top