Joriku
Working in the mines, need something?
Here's a simple teleport scroll script that teleports you to x, y, z and checks for battle status.
Lua:
-- Simple teleport scroll script
local testAction = Action() -- this is our header, the first thing we have to write (except for configuration tables and such)
local destination = {x=1002, y=1002, z=5} -- Change your destination here.
function testAction.onUse(cid, item, fromPosition, target, toPosition, isHotkey) -- now we can design the action itself
if getCreatureCondition(cid, CONDITION_INFIGHT) == false then -- check if player is in a fight
doTeleportThing(cid, destination) -- send player to position above at destination
doPlayerSendTextMessage(cid, 19, "Your teleport scroll has been destroyed while you used its magic.") -- send scroll use message
item:remove() -- remove the scroll
else
doPlayerSendTextMessage(cid, 22, "You cant teleport while in battle.") -- send cancel msg
end
return true
end
testAction:id(5952) -- now its taking an item as id instead of an action id.
testAction:register() -- this is our footer, it has to be the last function executed