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

Door script

hejd12345

New Member
Joined
Apr 11, 2012
Messages
255
Reaction score
1
Location
Sweden
Is it possible to make a script where you need 1 Dream Matter(id 22397) and 25 Cluster of Solaces(id 22396) to pass a door? And when you pass the door, the items disappear and you can not walk into that door again until you collect the items again?
Door id 11138

Using TFS 1.0 btw
 
Last edited:
i can give you basics :)

use actionid or uniqueid in door

and make script onUse
and code will be like this
if((item.itemid == 22397) >= 1 and (item.itemid == 22396) >= 25) then
doTeleportThing << continue code >>
doRemoveItem(22397, 1)
doRemoveItem(22396, 25)

else
doSendCancel(cid, " you need to get required items to pass this door ")

try to convert these things to make ur code
i'm busy atm so i can't make fully code
 
Add this right after "function" in your door script.
change the "0000" to an action-id you will add on the door in the game.

it's not necessary to add this "action-id" to actions.xml.
but it's necessary you add this code of mine in the correct .lua file.

PHP:
if item.actionid == 0000 then
    if getPlayerItemCount(cid, 22397) >= 1 and getPlayerItemCount(cid, 22396) >= 25 then
        doPlayerRemoveItem(cid, 22397, 1)
        doPlayerRemoveItem(cid, 22396, 25)
    else
        doPlayerSendTextMessage(cid, 21, "Yo may not pass!")
        return true
    end
end

this will remove the items you need to pass.
If you do not have the items, it wont allow the script continue to being read (cancel the script before it reaches the part there you can open the door, and send you a message that you cannot pass)
 
Add this right after "function" in your door script.
change the "0000" to an action-id you will add on the door in the game.

it's not necessary to add this "action-id" to actions.xml.
but it's necessary you add this code of mine in the correct .lua file.

PHP:
if item.actionid == 0000 then
    if getPlayerItemCount(cid, 22397) >= 1 and getPlayerItemCount(cid, 22396) >= 25 then
        doPlayerRemoveItem(cid, 22397, 1)
        doPlayerRemoveItem(cid, 22396, 25)
    else
        doPlayerSendTextMessage(cid, 21, "Yo may not pass!")
        return true
    end
end

this will remove the items you need to pass.
If you do not have the items, it wont allow the script continue to being read (cancel the script before it reaches the part there you can open the door, and send you a message that you cannot pass)
What function do I need to use? function onUse(cid, item, fromPosition, itemEx, toPosition) ?
 
none..
do you have skype?
Nope :(

So the script should look like this?
Code:
function

    if item.actionid == 80 then
    if getPlayerItemCount(cid, 22397) >= 1 and getPlayerItemCount(cid, 22396) >= 25 then
        doPlayerRemoveItem(cid, 22397, 1)
        doPlayerRemoveItem(cid, 22396, 25)
    else
        doPlayerSendTextMessage(cid, 21, "You need 1 Dream Matter and 25 Clusters of Solaces in order to pass!")
        return true
    end
end
 
sad you don't have skype, I could help you through there a lot easier :(

Anyhow, you have scripts for all doors, yes?
Find the doors you want being able to do this on.
Add the function inside those scripts, right after the "function" in top of the script.

if you want this to apply on special doors (etc, exp doors, quest doors) you will have to change my script from using action-id to uniqueid instead.

But screw all I said earlier, lets do it over (I assume you only use action ids for doors, mostly at least).

find ALL your door files (etc door.lua, questdoor.lua, m.m)
add this right after the first line of "function":
PHP:
if item.uid == 6666 then
    if getPlayerItemCount(cid, 22397) >= 1 and getPlayerItemCount(cid, 22396) >= 25 then
        doPlayerRemoveItem(cid, 22397, 1)
        doPlayerRemoveItem(cid, 22396, 25)
    else
        doPlayerSendTextMessage(cid, 21, "Yo may not pass!")
        return true
    end
end

Now you will only have to add "6666" as unique-id on the door to make it work.
This code will allow you to use this on level doors.

example level door:
PHP:
actionid: 1050        --level 50 for passage
uniqueid: 6666        --and you need the items to pass

that should work!
 
sad you don't have skype, I could help you through there a lot easier :(

Anyhow, you have scripts for all doors, yes?
Find the doors you want being able to do this on.
Add the function inside those scripts, right after the "function" in top of the script.

if you want this to apply on special doors (etc, exp doors, quest doors) you will have to change my script from using action-id to uniqueid instead.

But screw all I said earlier, lets do it over (I assume you only use action ids for doors, mostly at least).

find ALL your door files (etc door.lua, questdoor.lua, m.m)
add this right after the first line of "function":
PHP:
if item.uid == 6666 then
    if getPlayerItemCount(cid, 22397) >= 1 and getPlayerItemCount(cid, 22396) >= 25 then
        doPlayerRemoveItem(cid, 22397, 1)
        doPlayerRemoveItem(cid, 22396, 25)
    else
        doPlayerSendTextMessage(cid, 21, "Yo may not pass!")
        return true
    end
end

Now you will only have to add "6666" as unique-id on the door to make it work.
This code will allow you to use this on level doors.

example level door:
PHP:
actionid: 1050        --level 50 for passage
uniqueid: 6666        --and you need the items to pass

that should work!
I have created data/actions/scripts/umbraldoor1.lua with this code:
Code:
function

if item.uid == 6666 then
    if getPlayerItemCount(cid, 22397) >= 1 and getPlayerItemCount(cid, 22396) >= 25 then
        doPlayerRemoveItem(cid, 22397, 1)
        doPlayerRemoveItem(cid, 22396, 25)
    else
        doPlayerSendTextMessage(cid, 21, "You need 1 Dream Matter and 25 Clusters of Solaces in order to pass!")
        return true
    end
end

And this is my door ingame:
https://imgur.com/WEQCveK
 
Back
Top