First make a new file in data/actions/scripts
and call it leveldoor.lua
Put this in it:
function onUse(cid, item, frompos, item2, topos)
reqlevel = item.actionid – 1000
if reqlevel > 0 then
if getPlayerLevel(cid) >= reqlevel then
pos = getPlayerPosition(cid)
if pos.x topos.x then
if pos.y < topos.y then
pos.y = topos.y + 1
else
pos.y = topos.y - 1
end
elseif pos.y topos.y then
if pos.x < topos.x then
pos.x = topos.x + 1
else
pos.x = topos.x – 1
end
else
doPlayerSendTextMessage(cid,22,’Stand in front of the door.’)
return 1
end
doTeleportThing(cid,pos)
doSendMagicEffect(topos,12)
else
doPlayerSendTextMessage(cid,22,’You need level ’ .. reqlevel .. ’ to pass this door.’)
end
return 1
else
return 0
end
end
Also, add it to actrions.xml
<action itemid=”1227” script=”leveldoor.lua” />
<action itemid=”1229” script=”leveldoor.lua” />
You need to add it twice, because it uses two different doors.
THE REST IS SO SIMPLE NOW
Any time you wanna put a level door into your server, go on map editor, right click on one your level door (ID: 1227, 1229) then click “Properties” and in the “actionID” put the level you want, but add a 1000 to it. Remember: ONLY edit the action ID and leave the other one as 0
Example: If you want a level door for a lvl 100, put the action ID as 1100.
Related Articles
Action scripts tutorial
Open Tibia Server - creation
Open Tibia Server for absolute beginners
Ots map quests - otserv
Otserver - ot server general
Basic Tibia ots tutorials
Simple tutorials for Tibia 7.6
Making items on GM
Easy way to make a restarter
Raids
Previous article: OTS - Teleport rune
Next article: How to make GMs on your server