what is missile speed, to concatenate as perfect as possible?
Lua:
-- NORMAL ATTACK
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SMALLICE)
function onGetFormulaValues(cid, level, skill, attack, element, factor)
local magicLevel = getPlayerMagLevel(cid)
local min = LV500_STAFF_MIN * (1 + (magicLevel / 100)) * (1 + (attack / 100))
local max = LV500_STAFF_MAX * (1 + (magicLevel / 100)) * (1 + (attack / 100))
return -math.ceil(min), -math.ceil(max)
end
setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
-- PASSIVE ATK
local function check_pos(fromPos, toPos)
local x1 = fromPos.x
local y1 = fromPos.y
local x2 = toPos.x
local y2 = toPos.y
if (x1 > x2) and (y1 > y2) then
return choose({0, y1 - y2}, {x1 - x2, 0}) -- 9
elseif (x1 > x2) and (y1 == y2) then
return {math.floor((x1 - x2) / 2), math.ceil((x1 - x2) / 2) * choose(-1, 1)} -- 4
elseif (x1 > x2) and (y1 < y2) then
return choose({0, y1 - y2}, {x1 - x2, 0}) -- 7
elseif (x1 == x2) and (y1 > y2) then
return {math.ceil((y1 - y2) / 2) * choose(-1, 1), math.floor((y1 - y2) / 2)} -- 8
elseif (x1 == x2) and (y1 == y2) then
return {0, 0} -- 5
elseif (x1 == x2) and (y1 < y2) then
return {math.floor((y1 - y2) / 2) * choose(-1, 1), math.ceil((y1 - y2) / 2)} -- 2
elseif (x1 < x2) and (y1 > y2) then
return choose({0, y1 - y2}, {x1 - x2, 0}) -- 3
elseif (x1 < x2) and (y1 == y2) then
return {math.ceil((x1 - x2) / 2), math.floor((x1 - x2) / 2) * choose(-1, 1)} -- 6
elseif (x1 < x2) and (y1 < y2) then
return choose({0, y1 - y2}, {x1 - x2, 0}) -- 1
end
end
local function distEffect(cid)
local player_pos = getCreaturePosition(cid)
local target_pos = getCreaturePosition(getCreatureTarget(cid))
local var = check_pos(player_pos, target_pos)
local aux_pos = {x = target_pos.x+var[1], y = target_pos.y+var[2], z = target_pos.z}
doSendDistanceShoot(player_pos, aux_pos, CONST_ANI_ICE)
doSendDistanceShoot(aux_pos, target_pos, CONST_ANI_ICE)
--[[
addEvent(function()
local vel = 1100
if var[1] > var[2] then
vel = vel * var[1]
elseif var[2] > var[1] then
vel = vel * var[2]
end
if isCreature(getCreatureTarget(cid)) then
doSendDistanceShoot(aux_pos, target_pos, 28)
end
end, vel)
]]
end
local combat_passive = createCombatObject()
setCombatParam(combat_passive, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
function onGetFormulaValues(cid, level, skill, attack, element, factor)
local magicLevel = getPlayerMagLevel(cid)
local min = (magicLevel * attack) * 0.025
local max = (magicLevel * attack) * 0.075
distEffect(cid)
return -math.ceil(min), -math.ceil(max)
end
setCombatCallback(combat_passive, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
function onUseWeapon(cid, var)
doCombat(cid, combat, var)
if isPlayer(getCreatureTarget(cid)) or not PASSIVE_ONLY_PLAYER then
addEvent(function()
if isCreature(getCreatureTarget(cid)) then
doCombat(cid, combat_passive, var)
end
end, 100)
end
return true
end
Attachments
-
Missle_speed.png2.2 MB · Views: 19 · VirusTotal
-
Missle_speed2.png2.2 MB · Views: 19 · VirusTotal