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

It is simple to make I guess!

Vrotz

Member
Joined
Apr 7, 2011
Messages
1,071
Reaction score
7
Location
Brazil
Hello,

Can anyone give me or do a script that when the player walk on tile, the tile send a message for all on broadcast.

Thanks! xD
 
try this

add this action id in movements.xml
Code:
<movevent event="StepIn" itemid="" actionid="1000" script="tilescript.lua" />

movements/scripts/tilescript.lua
Code:
function onStepIn(creature, item, position, fromPosition)
        if item.actionid == 1000 then
                doBroadcastMessage("msg..") -- your broadcast function here
        end
        return true
end

and also to the map on the tile you walk on
 
Last edited:
/\ forgot a end before return true

Please post tfs version.

I'll test it. My tfs is 3777.19 and the version is 8.6.

I forgot to say that I need this message saying the name of player when he walk on tile!

@edit
I have tested and the script is working. Now I need that the names appear too, please.
 
Last edited by a moderator:
try this:
Code:
doBroadcastMessage("msg ".. getPlayerName(cid) .. " here!")

btw this is a list of functions that may help you in future
https://otland.net/threads/lua-functions-list.14039/

i got this error
  1. [Error - MoveEvents Interface]
  2. data/movements/scripts/godly axe.lua: onStepIn
  3. Description:
  4. (luaGetCreatureName) Creature not found

  5. [Error - MoveEvents Interface]
  6. data/movements/scripts/godly axe.lua: onStepIn
  7. Description:
  8. data/movements/scripts/godly axe.lua:3: attempt to concatenate a boolean value
  9. stack traceback:
  10. data/movements/scripts/godly axe.lua:3: in function <data/movements/scripts/godly axe.lua:1>
 
It doesnt work
Try this
Code:
    function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition)

        if item.actionid == 1000 then
            if isPlayer(cid) then -- Check to avoid sending this message if a monster/NPC stepped on this tile
                doBroadcastMessage("Player named " .. getCreatureName(cid) .. " stepped onto the special tile.")
            end
        end

    return true
    end
yeah try this instead getCreatureName(cid), you might not have getPlayerName function

Problem is that the userdata was passed to the function under the variable name "creature" but it's being used as "cid" in getCreatureName.
 
Last edited by a moderator:
My problem is solved.
Thanks you all.

Cheers.

I would also recommend to edit the title of this topic to:
"[Solved] Broadcast when player steps on a tile"

That way, other people who may be looking for such a script can find it easier with the 'search' function.
 
Back
Top