• 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 NPC response onStepIn

Savly

Member
Joined
Jan 28, 2012
Messages
316
Reaction score
21
Is it possible to let a NPC say something when you walk on a tile?
Example: A player walks on a tile, the NPC says: you can not pass, and the movement script will move the player back.
I used search on otland and google, but couldn't find anything.

I'm using TFS 0.3.6
Thanks for reading :)
 
I'm not looking for a full script, just how I can do it, so an example, where to place etc :p
The example I gave is just to explain what I mean.
 
It's a movement script

onStepIn
isPlayer(cid)
doCreatureSay(find the npc, "you can not pass", TALKTYPE_SAY)
doTeleportThing(cid, fromPosition)

Something like that.
 
I was thinking about the possibility of letting the npc itself respond (so you can go on from that point in the npc channel), but I guess this will be to hard. Also thought about a movement line, but I didn't know how it can check the position and name of the npc.

So for this line, how could I do that?
doCreatureSay(find the npc, "you can not pass", TALKTYPE_SAY)
 
If it is a unique NPC name then:
Lua:
doCreatureSay(getCreatureByName("Santa Clause"), "Ho ho ho")

and if it has a fixed position:
Lua:
local position = {x = 1, y = 1, z = 7, stackpos = STACKPOS_TOP_CREATURE}
local thing = getThingFromPos(position)
if thing.uid > 0 and isCreature(thing.uid) and getCreatureName(thing) == "Santa Clause" then
    doCreatureSay(thing.uid, "Ho ho ho")
end
 
Back
Top