Announcement: The amount of coins earned has been increased, visit the F.A.Q Section for more information!
Register and start earning coins for adding servers, creating threads, posting and much more!


Teleport Scroll [Unique Version] Watch Thread

Extrodus
Administrator

Posts: 112
~`Teleport Scroll`~
Developed By.. J.Dre / Sonik / Fallen / Shinmaru
Tested In 0.3.6 and Latest REV of TFS


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...



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..
local t = {
     = {pos = {x = 3000, y = 2098, z = 7}, storage = 1337, time = 30},   
     = {pos = {x = 2815, y = 2025, z = 7}, storage = 1338, time = 30},
     = {pos = {x = 1266, y = 880, z = 7}, storage = 1339, time = 30},
     = {pos = {x = 1127, y = 907,z = 6}, storage = 1340, time = 30},
     = {pos = {x = 2877, y = 2005, z = 7}, storage = 1341, time = 30},
     = {pos = {x = 3160, y = 1572, z = 7}, storage = 1342, time = 30},
     = {pos = {x = 2940, y = 2075, z = 7}, storage = 1343, time = 30},
     = {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"
            end

            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Current Teleportation Locations: " .. i)
        else
            local p = t
            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..
<event type="textedit" name="teleportpaper" event="script" value="teleportpaper.lua"/>





In Login.lua..
    registerCreatureEvent(cid, "teleportpaper")

Created 21 December 2013 03:56:27 Updated 23 December 2013 15:11:22#post-27
Who is viewing this thread?
nobody
Copyright OTList.net Follow us on Facebook