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

[SOLVED] NPC MSG, if walk on sqm.

Exoltes

Novia OTserv Developer
Joined
Jul 2, 2009
Messages
563
Reaction score
47
Location
Belgium
I'm working on a 8.54 Open Tibia Server using The Forgotten Server - Version 0.2.7 (Mystic Spirit).

I have made an sqm which you can walk over if you have certain 'player storage value' if you do not have it you will be teleported back. I also have an npc next to this sqm.

What I'm looking for is a way to make this npc say something once you walk on this sqm.
-> if you have the right player storage value, he will say: Welcome!
-> if you don't have the right player storage value, he will say: Begone!

Thanks in advance.
 
Is the NPC walking or standing on 1 position? If it's standing still, you can add this to the movement script.
Code:
local pos = {x = 100, y = 100, z = 7, stackpos = 253}

doCreatureSay(getThingfromPos(pos).uid, "Welcome", TALKTYPE_SAY)
 
Yes, my npcs are not moving.

Tried adding your script into my movement script, my npc scipt and my npc itself but it didn't work.

--NPC
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Nightmare Guard" script="data/npc/scripts/nightmareguard.lua" walkinterval="0">
<look type="268" head="114" body="114" legs="114" feet="114" addons="3"/>
</npc>

--NPC Script
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

function onCreatureAppear(cid) selfTurn(SOUTH) npcHandler:eek:nCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:eek:nCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:eek:nCreatureSay(cid, type, msg) end
function onThink() npcHandler:eek:nThink() end

--Movement Script
elseif item.actionid == 30102 then
queststatus = getPlayerStorageValue(cid,6580)
if queststatus == -1 then
doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You are not allowed to enter the nightmare knights castle.')
doTeleportThing(cid,{x = 837, y = 942, z = 7})
end


Just to be sure I didn't add your script in the wrong place I pasted the scripts that are used by these actions here.

Also your solution just gives 1 msg for either action. (which is a nice start ofc, but still looking for the 2 way reactions)
 
It's an example, the other message should be the same way. You don't have to add anything in the NPC, only in the movement script.
So like this.
Code:
local pos = {x = 100, y = 100, z = 7, stackpos = 253}

queststatus = getPlayerStorageValue(cid, 6580)
if queststatus == -1 then
     doCreatureSay(getThingfromPos(pos).uid, "Begone", TALKTYPE_SAY)
else
     doCreatureSay(getThingfromPos(pos).uid, "Welcome", TALKTYPE_SAY)
end

Btw, use code tags for scripts
[ code]
your script
[/code]
 
Back
Top