can anyone fix so this script works?
--------------------------------------
When player hold throwing knife, he throws additional throwing knives at two targets standing next to target after each attack.
~/data/weapons/weapons.xml
XML Code:
~/data/weapons/scripts/throwing_knife.lua
Lua Code:
- - - Updated - - -
bump
- - - Updated - - -
bump
- - - Updated - - -
bump
--------------------------------------
When player hold throwing knife, he throws additional throwing knives at two targets standing next to target after each attack.
~/data/weapons/weapons.xml
XML Code:
LUA:
<distance id="2410" event="script" value="throwing_knife.lua"/>
~/data/weapons/scripts/throwing_knife.lua
Lua Code:
LUA:
local combat, sub_combat = createCombatObject(), createCombatObject()
for param, value in pairs({[COMBAT_PARAM_TYPE] = COMBAT_PHYSICALDAMAGE,
[COMBAT_PARAM_BLOCKARMOR] = true, [COMBAT_PARAM_EFFECT] = CONST_ME_HITAREA,
[COMBAT_PARAM_DISTANCEEFFECT] = CONST_ANI_THROWINGKNIFE}) do
setCombatParam(combat, param, value)
setCombatParam(sub_combat, param, value)
end
function combat_skillvalue(cid, level, skill, attack, element, factor)
return -math.ceil((2 * (attack * (skill + 5.8) / 25 + (level - 1) / 10))
/ factor)
end
setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "combat_skillvalue")
function sub_combat_skillvalue(cid, level, skill, attack, element, factor)
return -math.ceil(((2 * (attack * (skill + 5.8) / 25 + (level - 1) / 10))
/ factor) * 0.14)
end
setCombatCallback(sub_combat, CALLBACK_PARAM_SKILLVALUE, "sub_combat_skillvalue")
function onUseWeapon(cid, var)
local ret = doCombat(cid, combat, var)
if not ret then
return false
end
local target = variantToNumber(var)
if target ~= 0 then
local throws = 0
for _, position in pairs(getArea(getCreaturePosition(target), 1, 1)) do
local tmp = getTopCreature(position).uid
if tmp ~= 0 and tmp ~= cid and tmp ~= target then
if doCombat(cid, sub_combat, numberToVariant(tmp)) then
throws = throws + 1
if throws >= 2 then
break
end
end
end
end
end
return ret
end
- - - Updated - - -
bump
- - - Updated - - -
bump
- - - Updated - - -
bump