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

Door receive a message help

carre

Advanced OT User
Joined
Apr 23, 2013
Messages
881
Solutions
1
Reaction score
157
Location
Sweden
Hi
I want the player to receive a message when the enter the door.

how can I do it?

I want to do like this, for example, =in this room,open all chest and equip yourself with what you find there.afterwars,you can hunt in the dungeon below
 
Last edited:
Is it normal door? or the one I was fixing yesterday? You can just add this to your door script
Lua:
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your message.")
 
Is it normal door? or the one I was fixing yesterday? You can just add this to your door script
Lua:
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your message.")
Thanks, I will try this, when I get home.
Post automatically merged:

Is it normal door? or the one I was fixing yesterday? You can just add this to your door script
Lua:
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your message.")
I mean I want players to get a message when the step inside the door.
Screenshot_2.png
 
Last edited:
Replace your script with this one and retry.
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, 1226)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "in this room, open all chest and equip yourself with what you find there. afterwars, you can hunt in the dungeon below.")

else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "The door seems to be sealed against unwanted intruders.")
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, 1226)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "in this room, open all chest and equip yourself with what you find there. afterwars, you can hunt in the dungeon below.")

else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "The door seems to be sealed against unwanted intruders.")
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, 1226)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "in this room, open all chest and equip yourself with what you find there. afterwars, you can hunt in the dungeon below.")

else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "The door seems to be sealed against unwanted intruders.")
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, 1226)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "in this room, open all chest and equip yourself with what you find there. afterwars, you can hunt in the dungeon below.")

else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "The door seems to be sealed against unwanted intruders.")
end
return 1
else
return 0
end
end
 
Replace your script with this one and retry.
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, 1226)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "in this room, open all chest and equip yourself with what you find there. afterwars, you can hunt in the dungeon below.")

else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "The door seems to be sealed against unwanted intruders.")
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, 1226)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "in this room, open all chest and equip yourself with what you find there. afterwars, you can hunt in the dungeon below.")

else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "The door seems to be sealed against unwanted intruders.")
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, 1226)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "in this room, open all chest and equip yourself with what you find there. afterwars, you can hunt in the dungeon below.")

else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "The door seems to be sealed against unwanted intruders.")
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, 1226)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "in this room, open all chest and equip yourself with what you find there. afterwars, you can hunt in the dungeon below.")

else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "The door seems to be sealed against unwanted intruders.")
end
return 1
else
return 0
end
end
It works but I want players to get this message only 1x not all the time when they open the door.
how can I fix this?

Screenshot_1.png
 
Thanks, I will try this, when I get home.
Post automatically merged:


I mean I want players to get a message when the step inside the door.
View attachment 42675
If you can enter the door whit the regular door script, you could use a movement script.
This example is quite bad since it would print the text all the time. but you can always modify it to only print the text unless the player looted the chest in the room

data\movements\scripts\TextDoor.lua
Lua:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "In this room, open all chest and equip yourself with what you find there. Afterwards, you can hunt in the dungeon below.")
    return true
end

data\movements\Movements.xml
XML:
<movevent type="StepIn" actionid="XXXX" event="script" value="TextDoor.lua"/>
Replace "XXXX" whit your actionid

Edit:
To make it only print if the player didnt loot a chest in the room
Lua:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
    if getPlayerStorageValue(cid, XXXX) < 1 then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "In this room, open all chest and equip yourself with what you find there. afterwars, you can hunt in the dungeon below.")
    end
    return true
end
Replace "XXXX" whit your storageid your quest chest in the room have
You could use the same method on the script M0ustafa posted
 
Last edited:
If you can enter the door whit the regular door script, you could use a movement script.
This example is quite bad since it would print the text all the time. but you can always modify it to only print the text unless the player looted the chest in the room

data\movements\scripts\TextDoor.lua
Lua:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "In this room, open all chest and equip yourself with what you find there. Afterwards, you can hunt in the dungeon below.")
    return true
end

data\movements\Movements.xml
XML:
<movevent type="StepIn" actionid="XXXX" event="script" value="TextDoor.lua"/>
Replace "XXXX" whit your actionid

Edit:
To make it only print if the player didnt loot a chest in the room
Lua:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
    if getPlayerStorageValue(cid, XXXX) < 1 then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "In this room, open all chest and equip yourself with what you find there. afterwars, you can hunt in the dungeon below.")
    end
    return true
end
Replace "XXXX" whit your storageid your quest chest in the room have
You could use the same method on the script M0ustafa posted
I did everthing you posted and still get same message over again ^^
<movevent type="StepIn" actionid="4534-4531-4532-4533" event="script" value="TextDoor.lua"/>
 
I did everthing you posted and still get same message over again ^^
<movevent type="StepIn" actionid="4534-4531-4532-4533" event="script" value="TextDoor.lua"/>
Depends on what script you used, the first one will always print the msg. The other one will check if a storageID is lower then 1 if that is the case then it will print the msg else nothing will happen. You should change it to the storage id you get when you loot the quest chest in the room

Could you give me more information on what item id's and if you would need vocations to enter a door. and also a storage id of a chest inside the room.
And i will make you a fully working system that opens the door and auto close it when you walk out of it and only prints a text msg when you didnt finnish the quest inside the room, and hopefully you can review the code and learn how i made it :)

Edit:
This should be the complete script, and i hope you got the door script that auto close the door but that should be inside the TFS server by default.
Just make sure to add the actionid to the right doors and change the storage id to a free one
Lua:
local function enterDoor(cid, item, position)
    if doTransformItem(item.uid, item.itemid+1) then
        doTeleportThing(cid, position, true)
    end
end

local function checkStorage(cid, storage)
    if getPlayerStorageValue(cid, storage) <= 0 then
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "In this room, open all chest and equip yourself with what you find there. Afterwards, you can hunt in the dungeon below.")
        doPlayerSetStorageValue(cid, storage, 1)
    end
end

function onUse(cid, item, fromPosition, itemEx, toPosition)

    local storageIdSorc = 1001    -- Set this to a empty storage id 1001 is just a temporary value
    local storageIdDruid = 1002    -- Set this to a empty storage id 1002 is just a temporary value
    local storageIdPaladin = 1003    -- Set this to a empty storage id 1003 is just a temporary value
    local storageIdKnight = 1004    -- Set this to a empty storage id 1004 is just a temporary value

    -- Sorcerer
    if isSorcerer(cid) and item.actionid == 4531 then
        enterDoor(cid, item, toPosition)
        checkStorage(cid, storageIdSorc)
        return true
    end
    
    -- Druid
    if isDruid(cid) and item.actionid == 4532 then
        enterDoor(cid, item, toPosition)
        checkStorage(cid, storageIdDruid)
        return true
    end
    
    -- Paladin
    if isPaladin(cid) and item.actionid == 4533 then
        enterDoor(cid, item, toPosition)
        checkStorage(cid, storageIdPaladin)
        return true
    end
    
    -- Knight
    if isKnight(cid) and item.actionid == 4534 then
        enterDoor(cid, item, toPosition)
        checkStorage(cid, storageIdKnight)
        return true
    end

    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "The door seems to be sealed against unwanted intruders.")
    return true

end
 
Last edited:
Solved

Code:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
    if getPlayerStorageValue(cid, 4534) < 1 then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "In this room, open all chest and equip yourself with what you find there. afterwars, you can hunt in the dungeon below.")
        doCreatureSetStorage(cid, 4534, 1)
    end
    return true
end

all I need is add to doCreatureSetStorage(cid, 4534, 1)

and registerCreatureEvent(cid, "TextDoor") login.lua
 
Back
Top