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

CreatureEvent Teleport Scroll [Unique Version]

Alyhide

Banned User
Joined
Aug 21, 2010
Messages
1,945
Reaction score
54
Location
Switzerland
~`Teleport Scroll`~
Developed By.. J.Dre / Sonik / Fallen / Shinmaru
Tested In 0.3.6 [8.54] and Latest REV of TFS [9.1]

Hello people of OTLand, I am here to release a very useful script that took some people a lot of time and frustration to make. Below is the code, and instructions on how to use this, along with an example.


The Idea..

You have a writable item (1949). Then, you will edit the item to go a location of your liking. Example 'Depot'. You can have various locations. It has a 30 second cooldown to go to the same location once. It cannot be used if you are in combat. You can also write 'locations' or 'places' to see the current teleport locations.


An Example..

Lets say your going to the trainers...

f0c9wz.jpg


You would then click 'Ok.' and it would teleport your character to the trainers.
It has a 30 second cooldown time for that location.


The Script..
Lua:
local t = {
	["Temple"] = {pos = {x = 3000, y = 2098, z = 7}, storage = 1337, time = 30},	
	["Teleports"] = {pos = {x = 2815, y = 2025, z = 7}, storage = 1338, time = 30},
	["Addons"] = {pos = {x = 1266, y = 880, z = 7}, storage = 1339, time = 30},
	["Addon Bosses"] = {pos = {x = 1127, y = 907,z = 6}, storage = 1340, time = 30},
	["Trainers"] = {pos = {x = 2877, y = 2005, z = 7}, storage = 1341, time = 30},
	["Donation Quest"] = {pos = {x = 3160, y = 1572, z = 7}, storage = 1342, time = 30},
	["Shops"] = {pos = {x = 2940, y = 2075, z = 7}, storage = 1343, time = 30},
	["Sailors Quarter"] = {pos = {x = 3010, y = 2192, z = 6}, storage = 1344, time = 30}
}
 
function onTextEdit(cid, item, newText)
	if item.itemid == 1949 then
		if isPlayerPzLocked(cid) then
			doCreatureSay(cid, "You are in a battle!", TALKTYPE_MONSTER)
			return false
		end	
		if isInArray({'locations', 'places', 'place'}, newText) then
			local i = ''
			for text, x in pairs(t) do
				i = i .. "\n[" .. text .. "]"
			end
 
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Current Teleportation Locations: " .. i)
		else
			local p = t[newText]
			if not p then
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Invalid location")
				return false
			end
 
			local st = p.storage
			if getCreatureStorage(cid, st) > os.time() then
				doCreatureSay(cid, "You must wait another " .. getCreatureStorage(cid, st) - os.time() .. ' second' .. (getCreatureStorage(cid, st) - os.time() == 1 and "" or "s") .. " to travel there again.", TALKTYPE_MONSTER)
				return true
			end
 
			local ti = p.time
			local pos = p.pos
			doTeleportThing(cid, pos, true)
			doSendMagicEffect(pos, CONST_ME_TELEPORT)
			doCreatureSetStorage(cid, st, os.time() + ti)
			doCreatureSay(cid, "You have been teleported!", TALKTYPE_MONSTER)
		end
	end
	return true
end

CreatureScripts.xml..​

Lua:
<event type="textedit" name="teleportpaper" event="script" value="teleportpaper.lua"/>




In Login.lua..​

Lua:
	registerCreatureEvent(cid, "teleportpaper")
 
Last edited:
You guys, are friggin awesome! PWNZOR!
But :( [06/08/2011 22:49:18] [Warning - Event::loadScript] Event onUse not found (data/actions/scripts/other/tp scroll.lua)
I added it to actions? :eek: Where shud i edit it, it has OnTextEdit.. Weirdo, like creature scripts? lol.. Sorry im kinda noobish but it looks like its supposed to be in actions,
Im using naxed ot 8.6
 
Oh thanks :)
Rep++ to u!

EDIT: You must spread some Reputation around before giving it to Sonik again. :'(
 
Better version of this script would like that. System send to player window in which the list of possibilities where you can teleport. He must choose a one option, after click OK, he is teleported to the selected location. This panel would be like this where we choose a channel (trade, game-chat, help ect.). What you think about it?
Btw. this script is good.
 
Better version of this script would like that. System send to player window in which the list of possibilities where you can teleport. He must choose a one option, after click OK, he is teleported to the selected location. This panel would be like this where we choose a channel (trade, game-chat, help ect.). What you think about it?
Btw. this script is good.

We were thinking about that right after we released it. Yet, it would be very buggy, and it could just mess up the player permanently if we do it wrong, so we just released this for now lol.
 
If not you, i'll do this script for few days.
 
Well, i tested the script now its tellin me You have been teleported, in my place lol. I dont get tped anywhere.

EDIT: No errors btw
 
Ye i edited them..

EDIT: Oh no i didnt, when i added them to actions i did but i deleted them then added yours to creaturescripts, forgot about that sorry.
 
Nice work!
Really nice idea to use writeables for that :D
Easier to make RPG out of it if you don't have to use !blablacommand all the time :p
 
Ye i edited them..

EDIT: Oh no i didnt, when i added them to actions i did but i deleted them then added yours to creaturescripts, forgot about that sorry.

That's fine, we all make mistakes xD.
If it still gives an error, post back.
 
If not you, i'll do this script for few days.
Don't be disapointed when you do it.
It may work fine, but there is one problem, the "NPCs channel" will stay in the list, so you need custom client to remove it.

Thx for release :ninja:
 
[05/08/2014 16:10:10] [Error - CreatureEvent::configureEvent] No valid type for creature event.textedit
[05/08/2014 16:10:10] Warning: [BaseEvents::loadFromXml] Can not configure event

guessing this doesn't work with 0.2.5?
 
Back
Top