• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Item work like a key

Kisskotte

New Member
Joined
May 26, 2008
Messages
60
Reaction score
1
Hello i wonder if its possible to make an item work like a key to a door? Like à sword or à Rune or something like that?


/R.
 
yes, here:

LUA:
local item = XXX -- item id of item used as key.
local location = {x=111, y=111, z=1} -- location of where to be moved upon using the door

function onUse(cid, item, frompos, item2, topos)
    if getPlayerItemCount(cid,item) >= 1 then
        doTeleportThing(cid, location)
    else
        doPlayerSendCancel(cid, "You are required to have a key to access this door!")
    end
end
 
dident get it to work :(

firerunedoor.lua
local item = 2304 -- item id of item used as key.
local location = {x=198, y=477, z=7} -- location of where to be moved upon using the door

function onUse(cid, item, frompos, item2, topos)
if getPlayerItemCount(cid,item) >= 1 then
doTeleportThing(cid, location)
else
doPlayerSendCancel(cid, "You are required to have the fire rune of fire master to open this door!")
end
end

Actions.xml
<action uniqueid="32000" script="Other/firerunedoor.lua"/>
 
Hm maybe I'm a retard but dident work have put out the door set the action id to 32000 but when i try to open it no message appear that whould have been
You are required to have the fire rune of fire master to open this door!
and when i try the rune on the door. it just say not possible?
 
if you want to add new item, what will works like a key, and make it fully automatic you have to edit a bit your key.lua and door.lua by adding there new ids

otherwise you have to make new script for each doors with new keys you have.
 
Back
Top