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

[Request] Door closing after X seconds

Phantastix

New Member
Joined
Mar 14, 2008
Messages
10
Reaction score
0
Ok so this is what i wan't.

It will be used for a quest.

You will kill a monster that drops a key.
You open a door with the key you looted.
If the door is left open after leaving the room the door will automaticly close after 2 minutes to prevent other quest teams to just run threw the quest.

If you need more info just ask.

Regards, Phantastix.
 
Code:
function onDeath(cid, corpse, killer)
    local key = 2089 -- key number
    local creaturename = getCreatureName(cid)
    if creaturename == 'demon' then -- <span class="highlight">monster</span> name
        local key = doAddContainerItem(corpse, key, 1)
        doSetItemActionId(key, 6000) -- action ID, same as door action ID
 
    end
end

Edit, that's the current thing the quest uses.
Would like to add a timer.
 
Add to doors an addEvent function.
Code:
addEvent(doTransformItem, delay, { item.uid, newitemid })
 
Thats the timer thing O_O

make an onUse for doors, when someones opens it with a key, the addEvent starts counting, after *delay* time it closes the doors.
 
Code:
function onUse(cid, item, itemEx)
    local delay = 120 -- seconds
    if item.actionid == itemEx.actionid then
        doTransformItem(itemEx.uid, itemEx.itemid + 1) -- probably
        addEvent(doTransformItem, delay * 1000, { itemEx.uid, itemEx.itemid - 1 })
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "The key does not match.")
    end
    return TRUE
end

Not sure if this will work.
 
Back
Top