Usually it's not a script. You just make the actionid on the key and the door to match up to each other and it'll work like that. But what he wants would require a custom script for that.post your keyscript
or you can just put "doRemoveItem(itemEx.uid)" in the script
function onUse(cid, item, fromPosition, itemEx, toPosition)
if itemEx.actionid == item.actionid and itemEx.itemid == CLOSED_DOOR_ID then
doRemoveItem(item.uid)
doTransformItem(itemEx.uid, OPEN_DOOR_ID)
return true
end
end
local location = {x=1000, y=1000, z=1000}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if itemEx.actionid == item.actionid then
doRemoveItem(item.uid)
doTeleportThing(cid, location)
return true
end
end
remember to change the uppercase stuff, and they need to have same actionid'sLUA:function onUse(cid, item, fromPosition, itemEx, toPosition) if itemEx.actionid == item.actionid and itemEx.itemid == CLOSED_DOOR_ID then doRemoveItem(item.uid) doTransformItem(itemEx.uid, OPEN_DOOR_ID) return true end end
function onUse(cid, item, fromPosition, itemEx, toPosition)
if itemEx.actionid == item.actionid and itemEx.itemid == 9279 then
doRemoveItem(item.uid)
doTransformItem(itemEx.uid, 9280)
return true
end
end
<action itemid="2091" event="script" value="door1.lua"/>
you can.I can't add the key a actionID because the key should be dropped by a boss monster
<item id="2091" actionId="1234" chance="100000"/>
function onUse(cid, item, fromPosition, itemEx, toPosition)
if itemEx.actionid == item.actionid and itemEx.itemid == 9271then
doRemoveItem(item.uid)
doTransformItem(itemEx.uid, 9280)
return true
end
end
<action itemid="2091" event="script" value="door1.lua"/>
<action action="2091" event="script" value="door1.lua"/>
22:56 You see a golden key (Key:2091).
It weighs 1.00 oz.
ItemID: [2091], ActionID: [2091].
22:57 You see a closed door.
ItemID: [10272], ActionID: [2091].
local tp = {x=100, y=100, z=7} -- new position
function onUse(cid, item, fromPosition, itemEx, toPosition)
if itemEx.actionid == 2091 then
doRemoveItem(item.uid)
doTeleportThing(cid, tp)
doSendMagicEffect(tp, CONST_ME_TELEPORT)
return true
end
end
<action actionid="2091" event="script" value="door1.lua"/>
local tp = {x = 1254, y = 1015, z = 10} -- new position
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.itemid == 2091 and itemEx.actionid == 2091 then
doRemoveItem(item.uid)
doTeleportThing(cid, tp)
doSendMagicEffect(tp, CONST_ME_TELEPORT)
return true
end
end
<action actionid="2091" event="script" value="door1.lua"/>