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

reworking an old script to fit my server

dragondarc

New Member
Joined
Apr 7, 2009
Messages
14
Reaction score
0
on the forums theres a very old hookshot script that i wish to use on my otserv 8.6 distribution map, the animation still works from the hookshot, but it doesnt move the player to the desired location (doesnt move them at all) and i get a timer error in the server window, and then it says something about doTeleportThing

anyway here is the script im trying to edit

-- >> Stuff --
local reqActnId = 11111 -- Action id the hookshot will work on
local maxDstnce = 7 -- Max hookshot stretch lenght (in SQ)
-- Stuff << --

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 = {493, 4608, 4609, 4610, 4611, 4612, 4613, 4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625}

function onUse(cid, item, fromPosition, itemEx, toPosition)
if isInArray(waterIds, itemEx.itemid) == true then
if itemEx.itemid ~= 493 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
doPlayerAddItem(cid, ITEM_FISH, 1)
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)
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

thanks in advance
 
test this
Lua:
-- >> Stuff --
local reqActnId = 11111 -- Action id the hookshot will work on
local maxDstnce = 15 -- Max hookshot stretch lenght (in SQ)
-- Stuff << --

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 = {493, 4608, 4609, 4610, 4611, 4612, 4613, 4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if isInArray(waterIds, itemEx.itemid) == TRUE then
		if itemEx.itemid ~= 493 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
					doPlayerAddItem(cid, ITEM_FISH, 1)
				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)
		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
 
tried and still no teleport / same error in my server window but thankyou for trying =D

- - - Updated - - -

Bump

- - - Updated - - -

if it helps

Lua Script Error: [action interface]
in a timer event called from:
data/actions/scripts/hookshot.lua:eek:nUse

attempt to index boolean value
stack traceback:
[C]: in function 'doTeleportThing'
data/actions/scripts/hookshot.lua:8: in function <data/actions/script/hookshot.lua:6>
 
Back
Top