• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Action Discovery Teleport System

Amare Aeternam

New Member
Joined
Aug 19, 2009
Messages
26
Reaction score
1
Location
That van outside!
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

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" />
*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!
 
its a great idea and concept, though the scripting is..different its really good for a beginner, I was using a script similar to this for the AEsoft project.
 
Well, it's also possible to write on script for rather infinite amount of teleports. With arrays. Nice idea tho but not new.
 
Back
Top