Amare Aeternam
New Member
Well, this is prolly the first useful thing I made myself so I thought Id share. Basicly its a teleport system that requires the player to walk to the destination and "use" it, before he can teleport there. Mine is for a place called the Jungle of Eden and uses a skull as the teleport item.
eden.lua
in data/actions/scripts
in data/actions/actions.xml add
*Note that the Action ID changes dependng on what you chaned in the lua.
I know its a lil impractical but hey! Im new to Lua. Helpful feedback is always welcome!
eden.lua
in data/actions/scripts
HTML:
function onUse(cid, item, fromPosition, itemEx, toPosition)
-- The storage ID for discovering the teleport
local storage = 6532;
-- Your Home Location (cant tele from unless discovered)
local destinationtemple = {x=992, y=1017, z=4}
-- Your Destination that they discover and tele to
local destinationtarget = {x=1207, y=957, z=7}
-- The Item Id of your "teleport item"
local magicitem = 2320;
-- The ActionId of the Item at the destination
local targetaid = 4443;
-- The ActionId of the Home Item(cant tele from unless discovered)
local templeaid = 4444;
if item.itemid == magicitem then
if(getPlayerStorageValue(cid, storage) < 1) then
if item.actionid == targetaid then
doPlayerSendTextMessage(cid,21,"DISCOVED MESSAGE HERE!")
setPlayerStorageValue(cid, storage, 1)
elseif item.actionid == templeaid then
doPlayerSendTextMessage(cid,21,"REJECTED IF NOT DISCOVED MESSAGE!")
end
elseif (getPlayerStorageValue(cid, storage) == 1) then
if item.actionid == targetaid then
doTeleportThing(cid, destinationtemple)
doSendMagicEffect(destinationtemple, CONST_ME_TELEPORT)
elseif item.actionid == templeaid then
doTeleportThing(cid, destinationtarget)
doSendMagicEffect(destinationtarget, CONST_ME_TELEPORT)
end
end
end
end
in data/actions/actions.xml add
HTML:
<action actionid="4443-4444" event="script" value="eden.lua" />
I know its a lil impractical but hey! Im new to Lua. Helpful feedback is always welcome!