• 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!
  • If you're using Gesior 2012 or MyAAC, please review this thread for information about a serious security vulnerability and a fix.

Teleport item TFS 1.3

Mr Noxi

Noxus Otserver
Premium User
Joined
May 13, 2010
Messages
252
Solutions
3
Reaction score
88
Location
Sweden
Hello there community, its all about sharing i guess, this is a paid script that was made for me a while ago and i thought why not share it for those that are in need of it!

So idk if there is a better script out there for TFS 1.3 or not but am dropping it for the community anyways so enjoy, or not :)

Info:

A teleport item that takes you to your home town /Tempel destination.

Installation below!

data/actions.xml (remember to change itemID to your own item.

Lua:
    <action itemid="2344" script="teleport.lua"/>

new script file in data/actions/scripts and i named the script teleport.lua

Lua:
local cfg = {
useEffect = true, -- display effect after item used? true = yes, false = no
removeCharge = true, -- remove rune after using it? true = yes, false = no
minLevel = 8, --level to use
effect = CONST_ME_TELEPORT -- id or name of Effect
}


local exhaust = createConditionObject(CONDITION_EXHAUST_HEAL)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 2000))


function onUse(cid, item, fromPosition, itemEx, toPosition)
local player = Player(cid)

if(getCreatureCondition(cid, CONDITION_EXHAUST_HEAL) == TRUE) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
return true
end

if player:getLevel() < cfg.minLevel then
player:say("You need " .. cfg.minLevel .. " level to use this item.", TALKTYPE_MONSTER_SAY)
doAddCondition(cid, exhaust)
return true
end

if player:getCondition(CONDITION_INFIGHT, CONDITIONID_DEFAULT) then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You cannot teleport with pz.")
doAddCondition(cid, exhaust)
return true
end

if cfg.useEffect then
player:say("Teleported Home!", TALKTYPE_MONSTER_SAY)
player:getPosition():sendMagicEffect(cfg.effect)
end
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))

if cfg.useEffect then
player:getPosition():sendMagicEffect(cfg.effect)
end
doAddCondition(cid, exhaust)

if cfg.removeCharge then
doRemoveItem(item.uid, 1)
end

return true
end
 

N e r o n Z

Banned User
Joined
Jul 12, 2016
Messages
308
Reaction score
81
Hey
If u prefer revscriptys and new code style, here we go:

Lua:
local teleportScript = Action()

local cfg = {
    useEffect = true, -- display effect after item used? true = yes, false = no
    removeCharge = true, -- remove rune after using it? true = yes, false = no
    minLevel = 8, --level to use
    effect = CONST_ME_TELEPORT -- id or name of Effect
}

function teleportScript.onUse(player, item, fromPosition, target, toPosition, isHotkey)

    if player:getStorageValue(52346) >= os.time() then
        player:sendCancelMessage("You cant use it now")
        return true
    end

    if player:getLevel() < cfg.minLevel then
        player:say("You need " .. cfg.minLevel .. " level to use this item.", TALKTYPE_MONSTER_SAY)
        return true
    end

    if player:getCondition(CONDITION_INFIGHT, CONDITIONID_DEFAULT) then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You cannot teleport with pz.")
        return true
    end

    if cfg.useEffect then
        player:say("Teleported Home!", TALKTYPE_MONSTER_SAY)
        player:getPosition():sendMagicEffect(cfg.effect)
    end

    if cfg.removeCharge then
        item:remove(1)
    end
   
    player:teleportTo(player:getTown():getTemplePosition())
    player:setStorageValue(52346, os.time() + 10) -- 10 means 10 seconds
    return true
end

teleportScript:id(4848)
teleportScript:register()
 

wafuboe

Member
Joined
Dec 24, 2010
Messages
860
Solutions
2
Reaction score
17
Hey
If u prefer revscriptys and new code style, here we go:

Lua:
local teleportScript = Action()

local cfg = {
    useEffect = true, -- display effect after item used? true = yes, false = no
    removeCharge = true, -- remove rune after using it? true = yes, false = no
    minLevel = 8, --level to use
    effect = CONST_ME_TELEPORT -- id or name of Effect
}

function teleportScript.onUse(player, item, fromPosition, target, toPosition, isHotkey)

    if player:getStorageValue(52346) >= os.time() then
        player:sendCancelMessage("You cant use it now")
        return true
    end

    if player:getLevel() < cfg.minLevel then
        player:say("You need " .. cfg.minLevel .. " level to use this item.", TALKTYPE_MONSTER_SAY)
        return true
    end

    if player:getCondition(CONDITION_INFIGHT, CONDITIONID_DEFAULT) then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You cannot teleport with pz.")
        return true
    end

    if cfg.useEffect then
        player:say("Teleported Home!", TALKTYPE_MONSTER_SAY)
        player:getPosition():sendMagicEffect(cfg.effect)
    end

    if cfg.removeCharge then
        item:remove(1)
    end
  
    player:teleportTo(player:getTown():getTemplePosition())
    player:setStorageValue(52346, os.time() + 10) -- 10 means 10 seconds
    return true
end

teleportScript:id(4848)
teleportScript:register()
may i ask what is revscripts??? have seen that lately
 

Xikini

I whore myself out for likes
Senator
Joined
Nov 17, 2010
Messages
6,285
Solutions
546
Reaction score
4,545
may i ask what is revscripts??? have seen that lately
It's the updated version of 0.4's mod folder.
Uses pure Lua instead of xml.

Basically a drag & drop file system, where a single file can self-register itself inside of data/scripts

Can utilise most of the /data directory systems. (action, creaturescripts, globalevent, spell, et cetera)

Here, is where it was first discussed, I believe.
 

wafuboe

Member
Joined
Dec 24, 2010
Messages
860
Solutions
2
Reaction score
17
It's the updated version of 0.4's mod folder.
Uses pure Lua instead of xml.

Basically a drag & drop file system, where a single file can self-register itself inside of data/scripts

Can utilise most of the /data directory systems. (action, creaturescripts, globalevent, spell, et cetera)

Here, is where it was first discussed, I believe.
ohhhhh i see yeah i remember everything i had it to register in the xml file, its pretty convenient i will check it out thanks!
 

lopez65

Member
Joined
May 10, 2012
Messages
286
Solutions
1
Reaction score
14
Location
Barcelona
Hey
If u prefer revscriptys and new code style, here we go:

Lua:
local teleportScript = Action()

local cfg = {
    useEffect = true, -- display effect after item used? true = yes, false = no
    removeCharge = true, -- remove rune after using it? true = yes, false = no
    minLevel = 8, --level to use
    effect = CONST_ME_TELEPORT -- id or name of Effect
}

function teleportScript.onUse(player, item, fromPosition, target, toPosition, isHotkey)

    if player:getStorageValue(52346) >= os.time() then
        player:sendCancelMessage("You cant use it now")
        return true
    end

    if player:getLevel() < cfg.minLevel then
        player:say("You need " .. cfg.minLevel .. " level to use this item.", TALKTYPE_MONSTER_SAY)
        return true
    end

    if player:getCondition(CONDITION_INFIGHT, CONDITIONID_DEFAULT) then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You cannot teleport with pz.")
        return true
    end

    if cfg.useEffect then
        player:say("Teleported Home!", TALKTYPE_MONSTER_SAY)
        player:getPosition():sendMagicEffect(cfg.effect)
    end

    if cfg.removeCharge then
        item:remove(1)
    end
 
    player:teleportTo(player:getTown():getTemplePosition())
    player:setStorageValue(52346, os.time() + 10) -- 10 means 10 seconds
    return true
end

teleportScript:id(4848)
teleportScript:register()
hello, you can put it so that instead of going to the temple he goes to his house. Thank you

edit: ok I already found one for my version TFS 1.4
 
Last edited:
OP
OP
Mr Noxi

Mr Noxi

Noxus Otserver
Premium User
Joined
May 13, 2010
Messages
252
Solutions
3
Reaction score
88
Location
Sweden
I have it here, its revscriptys , working for 1.4, idk about lower

Lua:
local destinations = {
    -- please use lower case names
    --["place name"] = { position=Position(100, 100, 7), inPz=true, level=100, infight=false }
    ["temple"] = { position=Position(1033, 1024, 7) },
    ["hunting area"] = { position=Position(952, 1078, 7) },
    ["house"] = { house=true, infight=false }
}

local destString = "Available destinations:"
for name, _ in pairs(destinations) do
    destString = string.format("%s %s%s", destString, name, (next(destinations, name) and ',' or '.'))
end

local talkAction = TalkAction("!tp")

function talkAction.onSay(player, words, param, type)
    local destName = param:trim()
    local destination = destinations[destName] or destinations[destName:lower()]
    if not destination then
        player:sendCancelMessage(string.format("Destination %s does not exists.", destName))
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, destString)
        return false
    end

    local tile
    if destination.house then
        local house = player:getHouse()
        if not house then
            player:sendCancelMessage("You dont have a house.")
            return false
        end

        tile = Tile(house:getExitPosition())
    else
        tile = Tile(destination.position)
    end

    if not tile then
        print(string.format("Destination %s dont have a correct position.", destName))
        player:sendCancelMessage(RETURNVALUE_NOTENOUGHROOM)
        return false
    end

    local playerPos = player:getPosition()
    if destination.inPz and not playerPos:getTile():hasFlag(TILESTATE_PROTECTIONZONE) then
        player:sendCancelMessage(string.format("Destination %s require you in PZ.", destName))
        return false
    end

    if destination.level and player:getLevel() < destination.level then
        player:sendCancelMessage(string.format("Destination %s only enabled for players level %d or higher.", destName, destination.level))
        return false
    end

    if not destination.infight and player:getCondition(CONDITION_INFIGHT, CONDITIONID_DEFAULT) then
        player:sendCancelMessage(string.format("Destination %s only work witout fight.", destName))
        return false
    end

    local destPos = tile:getPosition()
    playerPos:sendMagicEffect(CONST_ME_POFF)
    player:teleportTo(destPos, false)
    destPos:sendMagicEffect(CONST_ME_TELEPORT)
    player:sendCancelMessage("Teleported successfully!")
    return false
end

talkAction:separator(" ")
talkAction:register()
 
OP
OP
Mr Noxi

Mr Noxi

Noxus Otserver
Premium User
Joined
May 13, 2010
Messages
252
Solutions
3
Reaction score
88
Location
Sweden
Could be, am using it myself but i did not make it and not sure who made it xD but it was most likely from resource page :D
 
Top