Paulix
Active Member
- Joined
- Sep 13, 2012
- Messages
- 129
- Solutions
- 7
- Reaction score
- 26
I have this weapon on my server, that hits up to 3 targets (target +2) and it is working fine, the problem is that it igore walls if the "target" is in 2x2 range,
people can attack creatures in protection zones and behind walls if in area, how do check if it can attack the secondary targets to prevent this?
people can attack creatures in protection zones and behind walls if in area, how do check if it can attack the secondary targets to prevent this?
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_POISONDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_POISON)
function onGetFormulaValues(cid, level, maglevel)
local min = -(((((level/80)+5) * (maglevel/2.2)) * 1.7) * ((getExtra(cid, EXTRA_DAMAGE)/6)+1))
local max = -(((((level/80)+5) * (maglevel/2.2)) * 2.1) * ((getExtra(cid, EXTRA_DAMAGE)/6)+1))
return min, max
end
setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
function onUseWeapon(cid, var)
local blind = getCreatureStorage(cid, 50005)
if (blind*20) >= math.random(1,100) then
doSendAnimatedText(getPlayerPosition(cid), "Miss!", COLOR_GREY)
else
local c = getSpectators(getCreaturePosition(var.number), 2, 2)
local v = 1
for i=1,#c do
if v <= 2 then
if isPlayer(var.number) then
if c[i] ~= cid and c[i] ~= var.number then
c[i] = {number = c[i], type = 1}
doCombat(cid, combat, c[i])
v = v+1
end
else
if c[i] ~= cid and c[i] ~= var.number and not isPlayer(c[i]) then
c[i] = {number = c[i], type = 1}
doCombat(cid, combat, c[i])
v = v+1
end
end
end
end
doCombat(cid, combat, var)
end
return 1
end