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

Lua Action Door Level

skovroski

New Member
Joined
Dec 23, 2019
Messages
29
Reaction score
3
Hello, I would like some help,
I'm trying to put an action for this type of door with level 250+ This door is not normal, I would like this door because as you pass it closes, it is not open.
Can anybody help me? Can I use storage?

Base OTServBr-Global 12x

Code:
function onStepIn(creature, item, position, fromPosition)
    if not creature:isPlayer() then
        return false
    end

    if creature:getLevel() < item.actionid - 250 then
        creature:sendTextMessage(MESSAGE_INFO_DESCR, "Only the worthy may pass.")
        creature:teleportTo(fromPosition, true)
        return false
    end
    return true
end

1578276391501.png
 
Solution
Lua:
if player:getLevel() >= 250 then
means that if player is equal or higher level then the code below it will run.
Judgding by the photo you sent the door in that image is itemid 6261, and yes you could just add another door id if needed, however I strongly reccomend that you use this script with a corresponding action id, eg.

actions.xml
XML:
<action actionid="20206" script="other/customdoor.lua" />

and then add 20206 as action id for the door in the map editor.
I don't understand why you don't just use a Gate of Expertise and set it to 250?

It'd also be a action for onUse not On Step in, since you can't step in while it's closed and you need to use it to open it.
 
I don't understand why you don't just use a Gate of Expertise and set it to 250?

It'd also be a action for onUse not On Step in, since you can't step in while it's closed and you need to use it to open it.

Just change to onUse ?
Post automatically merged:

I took this code for another type, it was a teleprot code in a statua. Would you have a different code? already tried for only 1250 on actionid and it also doesn't work
 
Try this
Code:
local lvl = 250

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getLevel < lvl then
        if item.itemid == 5114 then
            player:teleportTo(toPosition, true)
        end
    else
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Only the worthy may pass.")
    end
    return true
end
 
This tutorial should still be valid:


Door of Expertise (Level Door)
To use and set up doors of expertise, you just only have to set the action ID of the door.
The first number of the action ID must be 1 (don't ask me why), then the next three numbers will be the level of the door that a player must be to enter.
For example: If you want players that are level 50 and over to enter, set the action ID of the door to 1050.
 
Just change to onUse ?
Post automatically merged:

I took this code for another type, it was a teleprot code in a statua. Would you have a different code? already tried for only 1250 on actionid and it also doesn't work

I mean in RME, edit the door and you can just set a required level to use the door.

If you're not sure, find another Door of Expertise and copy it, then change the required level.
 
Hello, I would like some help,
I'm trying to put an action for this type of door with level 250+ This door is not normal, I would like this door because as you pass it closes, it is not open.
Can anybody help me? Can I use storage?

Base OTServBr-Global 12x

Code:
function onStepIn(creature, item, position, fromPosition)
    if not creature:isPlayer() then
        return false
    end

    if creature:getLevel() < item.actionid - 250 then
        creature:sendTextMessage(MESSAGE_INFO_DESCR, "Only the worthy may pass.")
        creature:teleportTo(fromPosition, true)
        return false
    end
    return true
end

View attachment 41574
whatever is the ITEMID it is added twice in movements.xml remove the line that is related to the script closingdoor.lua or quest_door.lua with the itemid of that door.
 
This tutorial should still be valid:
i'm test this post, and don't work
Post automatically merged:

whatever is the ITEMID it is added twice in movements.xml remove the line that is related to the script closingdoor.lua or quest_door.lua with the itemid of that door.

I make this in movements
Code:
function onStepIn(creature, item, position, fromPosition)
    if not creature:isPlayer() then
        return false
    end

    if creature:getLevel() < item.actionid - 250 then
        creature:sendTextMessage(MESSAGE_INFO_DESCR, "Only the worthy may pass.")
        creature:teleportTo(fromPosition, true)
        return false
    end
    return true
end

<movevent event="StepOut" itemid="25163" script="others/doorfalcon.lua"/>
<movevent event="StepOut" itemid="25163" script="others/doorfalcon.lua"/>

and dont work
 
Last edited:
i'm test this post, and don't work
Post automatically merged:



I make this in movements
Code:
function onStepIn(creature, item, position, fromPosition)
    if not creature:isPlayer() then
        return false
    end

    if creature:getLevel() < item.actionid - 250 then
        creature:sendTextMessage(MESSAGE_INFO_DESCR, "Only the worthy may pass.")
        creature:teleportTo(fromPosition, true)
        return false
    end
    return true
end

<movevent event="StepOut" itemid="25163" script="others/doorfalcon.lua"/>
<movevent event="StepOut" itemid="25163" script="others/doorfalcon.lua"/>

and dont work
check if this line is there

Code:
    <movevent event="StepIn" itemid="25163" script="quest_door.lua" />
if it is delete it
 
Man door don’t work with movements.
How you will step in door??? Try use this script in actions
yess man, i know!! a try in movements and actions!

Try adding the door id to levelDoors
inside data/global.lua

dont work!
Post automatically merged:

Code:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getStorageValue(Storage.AnnihilatorDone) < 0 then
        if item.itemid == 5114 then <--ID DOR
            player:teleportTo(toPosition, true)
            item:transform(item.itemid + 1)
        end
    else
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The door seems to be sealed against unwanted intruders.")
    end
    return true
end
I thy this in actions, and done!
but, i want door to level, no for quest (storage)
 
Last edited:
yess man, i know!! a try in movements and actions!



dont work!
Post automatically merged:

Code:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getStorageValue(Storage.AnnihilatorDone) < 0 then
        if item.itemid == 5114 then <--ID DOR
            player:teleportTo(toPosition, true)
            item:transform(item.itemid + 1)
        end
    else
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The door seems to be sealed against unwanted intruders.")
    end
    return true
end
I thy this in actions, and done!
but, i want door to level, no for quest (storage)


Try this
Code:
local lvl = 250

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getLevel < lvl then
        if item.itemid == 5114 then
            player:teleportTo(toPosition, true)
        end
    else
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Only the worthy may pass.")
    end
    return true
end
Use this my script.
 
Try This
Code:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getLevel < lvl then
            player:teleportTo(toPosition, true)
    else
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Only the worthy may pass.")
    end
    return true
end
 
I am so confused when reading this post and the people trying to help.

You are trying to use a quest door as a level door? That's not what it's intended for, it's coded for quests in this tfs release and in general in tibia.

If you want a level door, just use the gate of expertise door in RME instead? This tfs release has all working doors (I am using it myself) so I don't know why you're having an issue?

Simple, if you want a door that only allows players with a certain level to pass then use the gate of expertise in RME and not the quest door.
 
Im so confused, why do you want to use a quest door for level requirement?
either way
maybe this will help you out
Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getLevel() >= 250 then
        if item.itemid == 6261 then
            player:teleportTo(toPosition, true)
            item:transform(item.itemid + 1)
        end
    else
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The door seems to be sealed against unwanted intruders.")
    end
    return true
end
You should set an action id to that specific door, and add it to the script.
Otherwise this will just work on every quest door out there that has the same item id.
 
Last edited:
Back
Top