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

Solved rune two attacks

Tegardee

The Boss
Joined
Jun 18, 2014
Messages
106
Reaction score
0
Location
Brazil
Hello guys, I am having a problem with my rune, is she attacks normally everything works 100%, but what happens is that instead give two hits, she's giving three hits, how can I fix?

Code:
local damageTypes = {COMBAT_POISONDAMAGE, COMBAT_HOLYDAMAGE}
local shootEffects = {29, 30}
local effects = {20, 21}

local combats = {}
for i = 0, 2 do
        combats[i] = createCombatObject()
        setCombatParam(combats[i], COMBAT_PARAM_TYPE, (damageTypes[i] or 255))
        setCombatParam(combats[i], COMBAT_PARAM_EFFECT, (effects[i] or 255))
        setCombatParam(combats[i], COMBAT_PARAM_DISTANCEEFFECT, (shootEffects[i] or 255))
        setCombatFormula(combats[i], COMBAT_FORMULA_LEVELMAGIC, -2400, -2400, -2400, -2400)

local area = createCombatArea( { {1, 1, 1}, {1, 3, 1}, {1, 1, 1} } )
setCombatArea(combats[i], area)
end

function onCastSpell(cid, var)
local vip = "yes"
local days = 0

if (vip == "yes") and getAccountVipDays(cid) <= days then
    doPlayerSendCancel(cid, "Only Players Vip Can Use This.")
return false
end

for i = 0, (#combats - 0) do
addEvent(function()
if isCreature(cid) then
return doCombat(cid, combats[i], var)
end
return true
end, i * 200)
end
return true
end
 
this part is wrong
Code:
for i = 0, (#combats - 0) do
from 0 t 2 means it loops 3 times so that's why it attacks 3 times
change to:
Code:
local combats = {}
for i = 1, 2 do
combats[i] = createCombatObject()
setCombatParam(combats[i], COMBAT_PARAM_TYPE, (damageTypes[i] or 255))
setCombatParam(combats[i], COMBAT_PARAM_EFFECT, (effects[i] or 255))
setCombatParam(combats[i], COMBAT_PARAM_DISTANCEEFFECT, (shootEffects[i] or 255))
setCombatFormula(combats[i], COMBAT_FORMULA_LEVELMAGIC, -2400, -2400, -2400, -2400)

local area = createCombatArea( { {1, 1, 1}, {1, 3, 1}, {1, 1, 1} } )
setCombatArea(combats[i], area)
end

function onCastSpell(cid, var)
local vip = "yes"
local days = 0

if (vip == "yes") and getAccountVipDays(cid) <= days then
doPlayerSendCancel(cid, "Only Players Vip Can Use This.")
return false
end

for i = 1, #combats do
addEvent(function()
if isCreature(cid) then
return doCombat(cid, combats[i], var)
end
return true
end, i * 200)
end
return true
end
 
Back
Top