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

The door won't close itself

carre

Advanced OT User
Joined
Apr 23, 2013
Messages
881
Solutions
1
Reaction score
160
Location
Sweden
Hi
I'm working on VOC door on the island of destiny 8.6.
Screenshot_1.pngScreenshot_2.pngScreenshot_3.png
won't close it´self after opening the door.
Post automatically merged:

My vocdoor.lua
Code:
function onUse(cid, item, frompos, item2, topos)
playervoc = getPlayerVocation(cid)


if item.actionid == (4531) then
if getPlayerVocation(cid) == 1 or playervoc == 5 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,'You need to be in front of the door.')
return 1
end

doTransformItem(item.uid, 1258)

else
doPlayerSendTextMessage(cid,22,"Only Sorcerer's can pass.")
end

elseif item.actionid == (4532) then
if getPlayerVocation(cid) == 2 or playervoc == 6 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,'You need to be in front of the door.')
return 1
end

doTeleportThing(cid,pos)
doSendMagicEffect(topos,12)
else
doPlayerSendTextMessage(cid,22,"Only Druid's can pass.")
end

elseif item.actionid == (4533) then
if getPlayerVocation(cid) == 3 or playervoc == 7 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,'You need to be in front of the door.')
return 1
end

doTransformItem(item.uid, 1258)
doSendMagicEffect(topos,12)
else
doPlayerSendTextMessage(cid,22,"Only Paladin's can pass.")
end

elseif item.actionid == (4534) then
if getPlayerVocation(cid) == 4 or playervoc == 8 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,'You need to be in front of the door.')
return 1
end

doTransformItem(item.uid, 1258)
doSendMagicEffect(topos,12)
else
doPlayerSendTextMessage(cid,22,"Only Knight's can pass.")
end
return 1
else
return 0
end
end
 
Solution
The closingDoor script only works when the player steps out of the door, as I see, when your script opens the door, the player does not get into the door, you must add the
LUA:
doTeleportThing(cid, topos)
after opening the door in your actions script

Like this
LUA:
function onUse(cid, item, frompos, item2, topos)
local playervoc = getPlayerVocation(cid)
local pos = getPlayerPosition(cid)
if item.actionid == (4531) then
if getPlayerVocation(cid) == 1 or playervoc == 5 then
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,'You need to be in front of...
You should have inside movements\scripts\closingdoor.lua, If you found it then add to data\movements\movements.xml this line with your door ID.
XML:
    <movevent type="StepOut" itemid="xxxx" event="script" value="closingdoor.lua"/>
 
You should have inside movements\scripts\closingdoor.lua, If you found it then add to data\movements\movements.xml this line with your door ID.
XML:
    <movevent type="StepOut" itemid="xxxx" event="script" value="closingdoor.lua"/>
I already have this on my closingdoor.lua
<movevent type="StepOut" itemid="1258" event="script" value="closingdoor.lua"/>
the door is is 1258
Mybe something do with vocdoor.lua?
 
Last edited:
You have a script in your movements called walkback.lua? Check if the door is added there too like
XML:
<movevent type="StepIn" itemid="xxxx" event="script" value="walkback.lua"/>
 
You have a script in your movements called walkback.lua? Check if the door is added there too like
XML:
<movevent type="StepIn" itemid="xxxx" event="script" value="walkback.lua"/>
<movevent type="StepIn" itemid="1258" event="script" value="walkback.lua"/>
also have this

Code:
local SPECIAL_QUESTS = {2001}
local chests = {1738,1740,1746,1747,1748,1749}
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
    local container = isContainer(item.uid)
    if (isInArray(chests, item.itemid) == TRUE) then 
    if((container and not isInArray(SPECIAL_QUESTS, item.actionid) and
        item.uid > 65535) or (fromPosition.x ~= 0 and getTileInfo(fromPosition).floorChange[9])
        or (not container and getTileInfo(position).creatures <= 1)) then
        return true
    end

    if(lastPosition.x == 0) then -- player just logged in
        lastPosition = getTownTemplePosition(getPlayerTown(cid))
        doSendMagicEffect(lastPosition, CONST_ME_TELEPORT)
    end

    doTeleportThing(cid, lastPosition, true)
    end
    return true
end
 
in data\lib\000-constant.lua is the door added to closingDoors? If not then add it by yourself.
 
in data\lib\000-constant.lua is the door added to closingDoors? If not then add it by yourself.
closingDoors = {1224, 1226, 1228, 1230, 1242, 1244, 1246, 1248, 1256, 1258,
already been added.
Post automatically merged:

I have a feeling something have do with vocdoor.lua
 
Last edited:
hey @carre look at this


hope it helps
it mantains the door closed but teleports the player inside the room...

since I don't know how to code properly, I would:
1. on use transform item to open door ID
2. make player move 2 squares inside the room
3. transform door back to normal
 
Last edited:
hey @carre look at this


hope it helps
it mantains the door closed but teleports the player inside the room
but I don't want the teleports, only want a normal auto door close.
 
@carre look at my previous comment, I added something at the end
I know that the closed door is on closingdoor and movevents and so on, but forget about that and (maybe)use a simple script,
also I know that you dont want to use teleports but this is the safest choice.

I'm at work rigth now so i cant' help you until I get home. :(

also, look at this ---- the same problem as yours
the code have a typo on the first line, just erase that.
Post automatically merged:

Code:
<movevent type="StepOut" itemid="1258" actionid="4531" event="script" value="closingdoor.lua"/>
or try this on movevents.xml
 
Last edited:
The closingDoor script only works when the player steps out of the door, as I see, when your script opens the door, the player does not get into the door, you must add the
LUA:
doTeleportThing(cid, topos)
after opening the door in your actions script

Like this
LUA:
function onUse(cid, item, frompos, item2, topos)
local playervoc = getPlayerVocation(cid)
local pos = getPlayerPosition(cid)
if item.actionid == (4531) then
if getPlayerVocation(cid) == 1 or playervoc == 5 then
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,'You need to be in front of the door.')
return 1
end
doTeleportThing(cid, topos)
doTransformItem(item.uid, 1258)
doSendMagicEffect(topos,12)
else
doPlayerSendTextMessage(cid,22,"Only Sorcerer's can pass.")
end
elseif item.actionid == (4532) then
if getPlayerVocation(cid) == 2 or playervoc == 6 then
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,'You need to be in front of the door.')
return 1
end
doTeleportThing(cid, topos)
doTransformItem(item.uid, 1258)
doSendMagicEffect(topos,12)
else
doPlayerSendTextMessage(cid,22,"Only Druid's can pass.")
end
elseif item.actionid == (4533) then
if getPlayerVocation(cid) == 3 or playervoc == 7 then
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,'You need to be in front of the door.')
return 1
end
doTeleportThing(cid, topos)
doTransformItem(item.uid, 1258)
doSendMagicEffect(topos,12)
else
doPlayerSendTextMessage(cid,22,"Only Paladin's can pass.")
end
elseif item.actionid == (4534) then
if getPlayerVocation(cid) == 4 or playervoc == 8 then
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,'You need to be in front of the door.')
return 1
end
doTeleportThing(cid, topos)
doTransformItem(item.uid, 1258)
doSendMagicEffect(topos,12)
else
doPlayerSendTextMessage(cid,22,"Only Knight's can pass.")
end
return 1
else
return 0
end
end
 
Last edited:
Solution
look at what Limos Said on here

 
The closingDoor script only works when the player steps out of the door, as I see, when your script opens the door, the player does not get into the door, you must add the
LUA:
doTeleportThing(cid, topos)
after opening the door in your actions script

Like this
LUA:
function onUse(cid, item, frompos, item2, topos)
local playervoc = getPlayerVocation(cid)
local pos = getPlayerPosition(cid)
if item.actionid == (4531) then
if getPlayerVocation(cid) == 1 or playervoc == 5 then
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,'You need to be in front of the door.')
return 1
end
doTeleportThing(cid, topos)
doTransformItem(item.uid, 1258)
doSendMagicEffect(topos,12)
else
doPlayerSendTextMessage(cid,22,"Only Sorcerer's can pass.")
end
elseif item.actionid == (4532) then
if getPlayerVocation(cid) == 2 or playervoc == 6 then
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,'You need to be in front of the door.')
return 1
end
doTeleportThing(cid, topos)
doTransformItem(item.uid, 1258)
doSendMagicEffect(topos,12)
else
doPlayerSendTextMessage(cid,22,"Only Druid's can pass.")
end
elseif item.actionid == (4533) then
if getPlayerVocation(cid) == 3 or playervoc == 7 then
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,'You need to be in front of the door.')
return 1
end
doTeleportThing(cid, topos)
doTransformItem(item.uid, 1258)
doSendMagicEffect(topos,12)
else
doPlayerSendTextMessage(cid,22,"Only Paladin's can pass.")
end
elseif item.actionid == (4534) then
if getPlayerVocation(cid) == 4 or playervoc == 8 then
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,'You need to be in front of the door.')
return 1
end
doTeleportThing(cid, topos)
doTransformItem(item.uid, 1258)
doSendMagicEffect(topos,12)
else
doPlayerSendTextMessage(cid,22,"Only Knight's can pass.")
end
return 1
else
return 0
end
end
Omg it work!
Thank you very so much!
i'm so speechless... (:
 
Back
Top