• 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.
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(cid) >= 250 then -- LEVEL TO PASS
        if item.itemid == 6261 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
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.
Hmm, let me check!

if player:getLevel(cid) >= 250 then -- LEVEL TO PASS
if item.itemid == 6261 then -- ID DOR

its correct?
if i need more doors i can adds just 6261, 6061, and more.. or not?
 
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.
 
Last edited:
Solution
Back
Top