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

Lua trapdoor doesn't work when player standing on that tile

experienced

Intermediate OT User
Joined
Jan 13, 2011
Messages
418
Reaction score
102
Location
Poland
siema
I have problem with script when you switch lever tile transforming to trapdoor so you can go down but when player standing on that position then nothing happens I'm standing on trapdoor so on nothing :D
what to do?
 
If the trapdoor is open, and your not falling, then you need to edit items.xml to make it a 'hole'.
If the trapdoor is closed, and you want the character to fall through, you'll need to make a onStepIn script, to transform the item into the 'open' trapdoor, and they should automatically fall through.
 
no I'm talking about this standard ladder trapdoor
krJN1qU.jpg
and working fine you know
but I'm not falling down when I standing on standard tile and transform it to trapdoor using script
instead of falling down I standing "in the air"
I hope you know what I mean ;d
 
Ah yes I understand. I had the same problem before.
This happens because you've never executed the onStepIn for the hole itself, only the item you had transformed it from.
The only good solution is to add the relocate function to the script, so anything on top of the 'hole' is transported down.
Code:
doRelocate(pos, toPos[, creatures = true])
 
error unexpected symbol near ','
I posted the function.. not an actual script.
Plug in the correct values
Code:
doRelocate(pos, toPos[, creatures = true])
doRelocate(where_the_hole_is, where_they_get_moved_to, true)
 
You could edit your field runes to check if the tile your throwing it to has "attribute floorchange", and return 'sorry not possible'
If that doesn't work, you could make an array of itemID's, and just check if the tile contains anything in the array of items.
Code:
   local ids = {}
   thing = (getThingFromPos(toPosition).itemid)
   table.insert(ids, thing)
   if not isInArray({1111,2222}, ids[1]) then
       doPlayerSendCancel(cid, "Sorry not possible.")
       return true
   end
 
then remove that line, and just have return true by itself or
Code:
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
It's just an example, edit it however you like, or use the first option lol
 
Ye but I only want to remove fields blood etc because for example items eq like plate armor gps or some should falling down instead of being removed
Then relocate moveable items/creatures(doRelocate does that) -> remove remaining items -> create trapdoor
 
Code:
local ground_tile = 1111
local hole_tile = 1111
local tile_pos = {x = 1000, y = 1000, z = 7}

doRelocate(tile_pos, {x = tile_pos.x, y = tile_pos.y, z = tile_pos.z + 1}, true)
for a = 1, 500 do
   if getThingFromPos(tile_pos).itemid ~= ground_tile then
     doRemoveItem(getThingFromPos(tile_pos).uid)
   else
     doTransformItem(getThingFromPos({x = tile_pos.x, y = tile_pos.y, z = tile_pos.z, stackpos = 0).uid, hole_tile)
     break
   end      
end

Sorry for earlier, I didn't understand the problem you were having.
 
Last edited:
Back
Top