• 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 Create Teleport's with a Magic Wand!

J.Dre

Unity Games
Joined
May 18, 2011
Messages
2,647
Solutions
3
Reaction score
648
Location
United States

Hello again! I am releasing another script. It is quite nice and can be very useful to some.
Please leave comments, feedback, and most of all, some reputation! ;)

Update Log:

  • [#01] - Updated Config
    You can now use town names, or a specific destination.

data/actions/actions.xml
Code:
<action itemid="7735" event="script" value="script.lua"/>
data/actions/scripts/script.lua
Lua:
local config, tps, others = {
    level = 50, -- level to use
    seconds = 10, -- how long it lasts
    createInPZ = false, -- true/false
    oneTeleport = true, -- true/false
    destination = 'Thais' -- town name or other position.
}, {}, {430} -- {430} = items that you can add to block TP from creating (e.g. {430, 2160})

local function remove(pos, guid)
    if config.oneTeleport then
        for i = 1, #tps do
            if tps[i] == guid then
                table.remove(tps, i)
                break
            end
        end
    end
    
    local item = getTileItemById(pos, 1387).uid
    return item > 0 and doRemoveItem(item) and doSendMagicEffect(pos, CONST_ME_POFF)
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local thing = getTopCreature(toPosition)
    if getPlayerLevel(cid) >= config.level then
        local guid = getPlayerGUID(cid)
        if not config.oneTeleport or not isInArray(tps, guid) then
            toPosition.stackpos = 0
            if not isPlayer(thing.uid) and not isMonster(thing.uid) and not isNpc(thing.uid) and not isCreature(thing.uid) and not isInArray({0, 65535}, toPosition.x) and not isInArray(others, itemEx.itemid) and (config.createInPZ or not getTileInfo(toPosition).protection) and not hasItemProperty(getTileThingByPos(toPosition).uid, CONST_PROP_MOVABLE) and not hasItemProperty(getTileThingByPos(toPosition).uid, CONST_PROP_BLOCKSOLID) and queryTileAddThing(cid, toPosition) == RETURNVALUE_NOERROR and getTileItemByType(toPosition, ITEM_TYPE_TELEPORT).uid == 0 then
                if not hasCondition(cid, CONDITION_INFIGHT) then
                    doCreateTeleport(1387, type(config.destination) == 'table' and config.destination or getTownTemplePosition(getTownId(config.destination)), toPosition)
                    if config.oneTeleport then
                        table.insert(tps, guid)
                    end
                
                    addEvent(remove, config.seconds * 1000, toPosition, guid)
                    doCreatureSay(cid, "Teleport created!", TALKTYPE_MONSTER, nil, nil, toPosition)
                    doSendMagicEffect(toPosition, CONST_ME_GROUNDSHAKER)
                else
                    doCreatureSay(cid, "You cannot create a teleport while in battle.", TALKTYPE_MONSTER)
                    doSendMagicEffect(toPosition, CONST_ME_POFF)
                end
            else
                doCreatureSay(cid, "You cannot create a teleport here.", TALKTYPE_MONSTER)
                doSendMagicEffect(toPosition, CONST_ME_POFF)
            end
        else
            doCreatureSay(cid, "You already have an active teleport.", TALKTYPE_MONSTER)
            doSendMagicEffect(toPosition, CONST_ME_POFF)
        end
    else
        doCreatureSay(cid, "You must be at least level (" .. config.level .. ") to use this.", TALKTYPE_MONSTER)
        doSendMagicEffect(toPosition, CONST_ME_POFF)
    end
    
    return true
end
Credits:
This is a 'create teleport' script, coded by J.Dre (updates and new features). However, originally released by Cykotitan (newfag version). :D
 
Last edited:
Sweet nice scirpt, im going to test it on my test server to check it out ingame.
 
Fun script, though i can't find any reason to have the script. Maybe use that instead of teleport scroll? Heh doesn't got a clue.. Would be awesome if someone gave some ideas :)
 
Fun script, though i can't find any reason to have the script. Maybe use that instead of teleport scroll? Heh doesn't got a clue.. Would be awesome if someone gave some ideas :)

I originally had used a version - similar to this - as a Gamemaster tool or for guild leaders, during events.

You may also find it useful in OTS donation shops.

J.Dre
 
Dude it works, but I need to know how to put destination : 1000,1000,7!
Rep+ if you answered!
 
U think u can make it go away after use?
how do i make that happen Rep+ for the script :)
 
U think u can make it go away after use?
how do i make that happen Rep+ for the script :)

after:
Lua:
doSendMagicEffect(toPosition, CONST_ME_GROUNDSHAKER)

just add this line:
Lua:
doRemoveItem(item.uid, 1)
 
And if I want this to teleport me to MY city, My temple like /t does?
 
Put
XML:
 destination = cityname
as was originally stated.
 
Back
Top