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

Teleports conditionals.

gracielo

New Member
Joined
May 25, 2024
Messages
5
Reaction score
1
Im trying to figure out how to add a conditional to a teleport. For example, i set a portal on remeres with its coords. So far, so good, i can use the portal and get teleported, now since im making a reset based ot, i want the portal to be used from players whose resets are above certain number. Example, portal can be used by a player with 10 resets. I already store player resets in storage and database, but i have no clue hwo to add that conditional to a teleport.
 
I don't know which version of TFS you have,

so I made a revscript. Place it in data/scripts TFS 1.3+, I included an example with only 2 resets required to pass the teleport. You will need to set the action ID using RME.
Lua:
local config = {
    msgDenied = "You need to have at least 2 resets to access this area.",
    requiredResets = 2,
    actionId = 4545
}

local moveevent = MoveEvent()

function moveevent.onStepIn(player, item, position, fromPosition)
    if not player then
        return true
    end

    local playerResets = player:getStorageValue(378378)
    if playerResets < config.requiredResets then
        player:teleportTo(fromPosition, true)
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, config.msgDenied)
        position:sendMagicEffect(CONST_ME_MAGIC_BLUE)
        return true
    end

    position:sendMagicEffect(CONST_ME_MAGIC_GREEN)
    return true
end

moveevent:aid(config.actionId)
moveevent:register()
 
I don't know which version of TFS you have,

so I made a revscript. Place it in data/scripts TFS 1.3+, I included an example with only 2 resets required to pass the teleport. You will need to set the action ID using RME.
Lua:
local config = {
    msgDenied = "You need to have at least 2 resets to access this area.",
    requiredResets = 2,
    actionId = 4545
}

local moveevent = MoveEvent()

function moveevent.onStepIn(player, item, position, fromPosition)
    if not player then
        return true
    end

    local playerResets = player:getStorageValue(378378)
    if playerResets < config.requiredResets then
        player:teleportTo(fromPosition, true)
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, config.msgDenied)
        position:sendMagicEffect(CONST_ME_MAGIC_BLUE)
        return true
    end

    position:sendMagicEffect(CONST_ME_MAGIC_GREEN)
    return true
end

moveevent:aid(config.actionId)
moveevent:register()


Thanks for the response. But im not using TFS. Im using Canary. Dunno if it will also work.
 
Thanks for the response. But im not using TFS. Im using Canary. Dunno if it will also work.
you are using canary for evo ots?
it should still work for most part u might need to replace a function or two or none at all.

Canary engine after you put reset system:
thread gets GIF
 
you are using canary for evo ots?
it should still work for most part u might need to replace a function or two or none at all.

Canary engine after you put reset system:
thread gets GIF
lol. Reset system is already in place, it lets ur hp/mana stay as before the reset and get a 0.75% extra dmg per reset. it works like a charm. Now that the system is out of the way, i want to know who do i condition tps. Im new in this OT thing. Old tibia player but not familiarized with OT dev.
 
Dunno if it will also work.
What system are you using for resets? Database or storage? If it's storage, just change this line.
player:getStorageValue(378378)
to match your storage and you're done. If it's a database, that's a different matter. But of course, I can help with that too; it's very easy.

Regarding the actionID, you should set it to 4545 on the teleport using RME and save it. Then, open and test it. It will block access initially. If you have the required resets, it will allow access as normal.
 
What system are you using for resets? Database or storage? If it's storage, just change this line.

to match your storage and you're done. If it's a database, that's a different matter. But of course, I can help with that too; it's very easy.

Regarding the actionID, you should set it to 4545 on the teleport using RME and save it. Then, open and test it. It will block access initially. If you have the required resets, it will allow access as normal.
Oh i know how the actionid and everything works my issue is primeraly where the script should be located. Should be under actions?
 
Oh i know how the actionid and everything works my issue is primeraly where the script should be located. Should be under actions?
It’s revscripts. I’ll send the link where it should be placed.
or
or
Place it and test to see if it works correctly.
 
It’s revscripts. I’ll send the link where it should be placed.
or
or
Place it and test to see if it works correctly.
Ye after figuring it out, it seems data/scripts/... is the best place, data loads first then data-canary and data-otserv depending on which of those you choose on config.lua.

Thank you for the help, the script had an error with the message output, which is already corrected.
 
Back
Top