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

Horizontal wall problem

esigma94

Well-Known Member
Joined
Nov 1, 2009
Messages
87
Solutions
14
Reaction score
69
It actually depends on your creativity.
1. You can set some action id on the floor inside the room and if player stands on such floor then teleport him outside on door use. Otherwise teleport him inside.
2. You can set some storage value to the player and teleport him outside based on that. You have to remember to reset that storage value every time player leaves the room.
3. You can check player's position and based on that decide whether player is inside or outside the room. (keep the positions inside the room from which player can reach the doors)
4. You can mark whole area as no-logout zone and based on that you'll know that player is inside or outside.
5. You can keep in some variable 2 opposite corners of the room and calculate whether player is in this area. (there are already similar functions prepared).
6. You can ...
 

Unknown Soldier

Tibian Geodesist
Premium User
Joined
Oct 30, 2010
Messages
139
Solutions
5
Reaction score
185
See for example how it is done in otservbr global... I copied only fragments of script

Lua:
local entry = {
    metalWallId = 36284,
    roomEntryPos = Position(33395, 32666, 6),
    roomExitPos = Position(33395, 32668, 6)
}

if item.itemid == entry.metalWallId then
            if player:getPosition().y == entry.roomExitPos.y then
                player:teleportTo(entry.roomEntryPos)
            else
                player:teleportTo(entry.roomExitPos)
            end
end
 

Xikini

I whore myself out for likes
Support Team
Joined
Nov 17, 2010
Messages
4,732
Solutions
262
Reaction score
2,820
See for example how it is done in otservbr global... I copied only fragments of script

Lua:
local entry = {
    metalWallId = 36284,
    roomEntryPos = Position(33395, 32666, 6),
    roomExitPos = Position(33395, 32668, 6)
}

if item.itemid == entry.metalWallId then
            if player:getPosition().y == entry.roomExitPos.y then
                player:teleportTo(entry.roomEntryPos)
            else
                player:teleportTo(entry.roomExitPos)
            end
end
Here's the same idea, but without requiring specific positions added into the script.

Lua:
if player:getPosition().y < toPosition.y then
	-- player is north of door
	player:teleportTo(Position(toPosition.x, toPosition.y + 1, toPosition.z))
else
	-- player is south of door
	player:teleportTo(Position(toPosition.x, toPosition.y - 1, toPosition.z))
end
 
OP
V
Joined
Mar 14, 2020
Messages
98
Solutions
3
Reaction score
5
Here's the same idea, but without requiring specific positions added into the script.

Lua:
if player:getPosition().y < toPosition.y then
    -- player is north of door
    player:teleportTo(Position(toPosition.x, toPosition.y + 1, toPosition.z))
else
    -- player is south of door
    player:teleportTo(Position(toPosition.x, toPosition.y - 1, toPosition.z))
end
My problem is that when the player gets teleported to the other side he clicks in the wall and nothing happens, the script doesn't even calls :/
Post automatically merged:

See for example how it is done in otservbr global... I copied only fragments of script

Lua:
local entry = {
    metalWallId = 36284,
    roomEntryPos = Position(33395, 32666, 6),
    roomExitPos = Position(33395, 32668, 6)
}

if item.itemid == entry.metalWallId then
            if player:getPosition().y == entry.roomExitPos.y then
                player:teleportTo(entry.roomEntryPos)
            else
                player:teleportTo(entry.roomExitPos)
            end
end
my problem ins't the script is the fact that when player is above the wall he clicks in it and nothing happens, not even call the script to do something.
Post automatically merged:

It actually depends on your creativity.
1. You can set some action id on the floor inside the room and if player stands on such floor then teleport him outside on door use. Otherwise teleport him inside.
2. You can set some storage value to the player and teleport him outside based on that. You have to remember to reset that storage value every time player leaves the room.
3. You can check player's position and based on that decide whether player is inside or outside the room. (keep the positions inside the room from which player can reach the doors)
4. You can mark whole area as no-logout zone and based on that you'll know that player is inside or outside.
5. You can keep in some variable 2 opposite corners of the room and calculate whether player is in this area. (there are already similar functions prepared).
6. You can ...
my problem ins't the script is the fact that when player is above the wall he clicks in it and nothing happens, not even call the script to do something.
 

Xikini

I whore myself out for likes
Support Team
Joined
Nov 17, 2010
Messages
4,732
Solutions
262
Reaction score
2,820
My problem is that when the player gets teleported to the other side he clicks in the wall and nothing happens, the script doesn't even calls :/
Post automatically merged:


my problem ins't the script is the fact that when player is above the wall he clicks in it and nothing happens, not even call the script to do something.
Post automatically merged:


my problem ins't the script is the fact that when player is above the wall he clicks in it and nothing happens, not even call the script to do something.

I hate to be that guy, but you're literally giving us nothing to work with here.


#5 - no server version, no script, no errors, no video.

Give us more information to help you.
 
OP
V
Joined
Mar 14, 2020
Messages
98
Solutions
3
Reaction score
5
I hate to be that guy, but you're literally giving us nothing to work with here.


#5 - no server version, no script, no errors, no video.

Give us more information to help you.
this \/
1610553287663.png

When i click in the wall to go back to the other side doesn't call the script, this is what i mean, when i click first time is printed in the distro this: "done", but the print doens't show when i click to go back.

script:

Lua:
function onUse(cid, item, fromPosition, target, toPosition, isHotkey)
    print("done")
    local player = Player(cid)
    if not player then
        return true
    end
    
    local playerPos = Player:getPosition()
    local pos1 = Position(33394, 32666, 6)
    local pos2 = Position(33395, 32666, 6)
    local pos3 = Position(33396, 32666, 6)
    
    if playerPos == pos1 or playerPos == pos2 or playerPos == pos3 then
        player:teleportTo(Position(33395, 32668, 6))
        player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
        return true
    end

    if player:getStorageValue(332202) >= 4 then
        player:teleportTo(Position(33395, 32666, 6))
        player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
        return true
    end
return true
end
 

Unknown Soldier

Tibian Geodesist
Premium User
Joined
Oct 30, 2010
Messages
139
Solutions
5
Reaction score
185
this \/
View attachment 53659

When i click in the wall to go back to the other side doesn't call the script, this is what i mean, when i click first time is printed in the distro this: "done", but the print doens't show when i click to go back.

script:

Lua:
function onUse(cid, item, fromPosition, target, toPosition, isHotkey)
    print("done")
    local player = Player(cid)
    if not player then
        return true
    end
   
    local playerPos = Player:getPosition()
    local pos1 = Position(33394, 32666, 6)
    local pos2 = Position(33395, 32666, 6)
    local pos3 = Position(33396, 32666, 6)
   
    if playerPos == pos1 or playerPos == pos2 or playerPos == pos3 then
        player:teleportTo(Position(33395, 32668, 6))
        player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
        return true
    end

    if player:getStorageValue(332202) >= 4 then
        player:teleportTo(Position(33395, 32666, 6))
        player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
        return true
    end
return true
end

I think I know what you mean.
That probably happens because the wall is reachable only from southern side. Try changing it to another item, anything that isnt wall, a column for example. If it works, then it means you would have to edit properties of the wall item you want to use in ObjectBuilder and ItemEditor.
 
OP
V
Joined
Mar 14, 2020
Messages
98
Solutions
3
Reaction score
5
I think I know what you mean.
That probably happens because the wall is reachable only from southern side. Try changing it to another item, anything that isnt wall, a column for example. If it works, then it means you would have to edit properties of the wall item you want to use in ObjectBuilder and ItemEditor.
this is exactly what are happening.
 
Top