local reqActnId = 8927 -- Action id the hookshot will work on
local maxDstnce = 15 -- Max hookshot stretch lenght (in SQ)
function grappleAnim(parameters)
if (parameters.counter == 10) then
local fromPosition = getCreaturePosition(parameters.cid)
doTeleportThing(parameters.cid, parameters.toPosition, FALSE)
doSendMagicEffect(fromPosition, CONST_ME_POFF)
return TRUE
end
parameters.counter = parameters.counter + 1
doSendDistanceShoot(getCreaturePosition(parameters.cid), parameters.toPosition, CONST_ANI_THROWINGSTAR)
doSendDistanceShoot(getCreaturePosition(parameters.cid), parameters.toPosition, CONST_ANI_ARROW)
doSendDistanceShoot(getCreaturePosition(parameters.cid), parameters.toPosition, CONST_ANI_SMALLSTONE)
addEvent(grappleAnim, 100, parameters)
end
local useWorms = FALSE
local waterIds = {1549}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if isInArray(waterIds, itemEx.itemid) == TRUE then
if itemEx.itemid ~= 1549 then
if useWorms == FALSE or useWorms == TRUE and doPlayerRemoveItem(cid, ITEM_WORM, 1) == TRUE then
if math.random(1, (100 + (getPlayerSkill(cid, SKILL_FISHING) / 10))) <= getPlayerSkill(cid, SKILL_FISHING) then
player:teleportTo(toPos)
end
doPlayerAddSkillTry(cid, SKILL_FISHING, 1)
end
end
doSendMagicEffect(toPosition, CONST_ME_LOSEENERGY)
return TRUE
end
if (itemEx.actionid == reqActnId and getDistanceBetween(getCreaturePosition(cid), toPosition) <= maxDstnce) then
doSendDistanceShoot(fromPosition, toPosition, CONST_ANI_HUNTINGSPEAR)
doSendMagicEffect(toPosition, CONST_ME_BLOCKHIT)
doTeleportThing(parameters.cid, parameters.toPosition, FALSE)
local parameters = {cid = cid, toPosition = toPosition, counter = 0}
addEvent(grappleAnim, 100, parameters)
else
doPlayerSendCancel(cid, "Nothing to hook to in range.")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
end
return TRUE
end