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

Walking on Square and Recieve text!

Stormoguden

Professional Mapper~
Joined
Nov 3, 2008
Messages
441
Reaction score
6
Location
Sweden/Stockholm
Hello, I've tried to find a script that when you walk on a special tile, you recieve a message. Simple as that, I know it's very easy to make but I'm not much of a scripter. I've tried to search for it but can't find it.

Anyone got it? I give rep++
 
I'm going to bed, but here's the basics. In Mapeditor, give a Unique ID to your tile(s)

You have to add a line in movements.xml

Lua:
<movement uniqueid = "yourtileuid" function = "onStepIn" script="blah.xml"/>

Then you need to create a file called blah.xml in movements/scripts

Lua:
function onStepIn(cid)
doPlayerSendTextMessage(cid, MSG_DEFAULT_STATUS, "BLAH")
end

Something like that. If you need further help, you can find it on my OT. We have a lot of those tiles. Just ask for Arnold.
 
Please provide us with more information (Server version)
This is very important when it comes to things like this one.
 
data/movements/movements.xml
  1. If you're using TFS 0.3.x:
    PHP:
    <movement function="onStepIn" uniqueid="Unique ID of the tile" script="scriptname.lua" />
  2. If you're using TFS 0.2.x:
    PHP:
    <movevent event="StepIn" uniqueid="Unique ID of the tile" script="scriptname.lua" />

New file: data/movements/scripts/scriptname.lua
Lua:
function onStepIn(cid, item, position, fromPosition)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Message")
end
 
data/movements/movements.xml
  1. If you're using TFS 0.3.x:
    PHP:
    <movement function="onStepIn" uniqueid="Unique ID of the tile" script="scriptname.lua" />
  2. If you're using TFS 0.2.x:
    PHP:
    <movevent event="StepIn" uniqueid="Unique ID of the tile" script="scriptname.lua" />

New file: data/movements/scripts/scriptname.lua
Lua:
function onStepIn(cid, item, position, fromPosition)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Message")
end

Thanks alot, works! Tho is itpossible to change colour on the text?
 
Thanks alot, works! Tho is itpossible to change colour on the text?

List of message types for use with doPlayerSendTextMessage(cid, MESSAGETYPE, "Message"):
PHP:
MESSAGE_STATUS_CONSOLE_RED = 18
MESSAGE_EVENT_ORANGE = 19
MESSAGE_STATUS_CONSOLE_ORANGE = 20
MESSAGE_STATUS_WARNING = 21
MESSAGE_EVENT_ADVANCE = 22
MESSAGE_EVENT_DEFAULT = 23
MESSAGE_STATUS_DEFAULT = 24
MESSAGE_INFO_DESCR = 25
MESSAGE_STATUS_SMALL = 26
MESSAGE_STATUS_CONSOLE_BLUE = 27

List of text colours for use with doSendAnimatedText(position, "Text", color):
http://83.226.185.245/colors.php
 
Back
Top