• 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 is catching a player from maximum 2 square.

Nutaharion

New Member
Joined
Oct 29, 2008
Messages
133
Reaction score
4
Location
Poland
Hi,

I have a few selfmade NPC and I have problem with interraction with NPC. I need to stay at least 1 or 2 squares if I want to talk with him. If I'm farther then 2 squares NPC do not want to talk. The worst thing is that I don't know how to repair that.

Let's for example take one of NPC.
There is his code:
Code:
<?xml version="1.0"?>
<npc name="Captain Seal" walkinterval="3000" floorchange="0">
	<health now="100" max="100"/>
	<look type="146" head="20" body="74" legs="11" feet="4" />

  <interaction range="5" idletime="45" defaultpublic="0">

    <interact keywords="hi" focus="1">
      <!--These are the alternative keywords-->
      <keywords>hello</keywords>
      <response>
       	 <action name="script">
       		 <![CDATA[
			selfSay("Hi "..getCreatureName(cid)..". I'm a captain and I can travel with you to {free area}.", cid)
       		 ]]>
       	 </action>
      </response>
    </interact>

    <interact keywords="free;area">
      <response text="Do you want travel to free area?">
       	 <action name="script">
            		_state.topic = 1  		
       	 </action>
      </response>
    </interact>

    <interact keywords="yes" topic="1">
      <response text="Let's go!">
       	 <action name="script">
       		 <![CDATA[
			pos = {x=990, y=1138, z=6}
			doTeleportThing(cid, pos) 
            		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
       		 ]]>
       	 </action>
        <action name="idle" value="1"/>
      </response>
    </interact>

    <interact keywords="bye" focus="0">
      <keywords>farewell</keywords>

      <response text="Have a nice day |NAME|."/>
    </interact>

    <interact event="onPlayerLeave" focus="0">
      <response text="Have a nice day |NAME|."/>
    </interact>

  </interaction>
</npc>
*interaction tange not working ^,^

I know that's different way of making NPC than usually TFS have but I used to it ;-p

I'm thinking that I need something in NPC system but what? NPC system is the same as TFS 0.3.6 is having.

Any ideas?
 
Last edited:
Haha guys, is not that hard.... The error here is obvious :p It's not even necessary to know the distribution he's using in this case.

Use this:
XML:
<?xml version="1.0"?>
<npc name="Captain Seal" walkinterval="3000" floorchange="0">
	<health now="100" max="100"/>
	<look type="146" head="20" body="74" legs="11" feet="4" />

  <interaction range="5" idletime="45" defaultpublic="0" />

    <interact keywords="hi" focus="1">
      <!--These are the alternative keywords-->
      <keywords>hello</keywords>
      <response>
       	 <action name="script">
       		 <![CDATA[
			selfSay("Hi "..getCreatureName(cid)..". I'm a captain and I can travel with you to {free area}.", cid)
       		 ]]>
       	 </action>
      </response>
    </interact>

    <interact keywords="free;area">
      <response text="Do you want travel to free area?">
       	 <action name="script">
            		_state.topic = 1  		
       	 </action>
      </response>
    </interact>

    <interact keywords="yes" topic="1">
      <response text="Let's go!">
       	 <action name="script">
       		 <![CDATA[
			pos = {x=990, y=1138, z=6}
			doTeleportThing(cid, pos) 
            		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
       		 ]]>
       	 </action>
        <action name="idle" value="1"/>
      </response>
    </interact>

    <interact keywords="bye" focus="0">
      <keywords>farewell</keywords>

      <response text="Have a nice day |NAME|."/>
    </interact>

    <interact event="onPlayerLeave" focus="0">
      <response text="Have a nice day |NAME|."/>
    </interact>

  </interaction>

You forgot to close the tag... It's supposed to be closed with "/>"
 
Haha guys, is not that hard.... The error here is obvious :p It's not even necessary to know the distribution he's using in this case.

Use this:
XML:
<?xml version="1.0"?>
<npc name="Captain Seal" walkinterval="3000" floorchange="0">
	<health now="100" max="100"/>
	<look type="146" head="20" body="74" legs="11" feet="4" />

  <interaction range="5" idletime="45" defaultpublic="0" />

    <interact keywords="hi" focus="1">
      <!--These are the alternative keywords-->
      <keywords>hello</keywords>
      <response>
       	 <action name="script">
       		 <=!=[=C=D=A=T=A=[
			selfSay("Hi "..getCreatureName(cid)..". I'm a captain and I can travel with you to {free area}.", cid)
       		 ]=]=>
       	 </action>
      </response>
    </interact>

    <interact keywords="free;area">
      <response text="Do you want travel to free area?">
       	 <action name="script">
            		_state.topic = 1  		
       	 </action>
      </response>
    </interact>

    <interact keywords="yes" topic="1">
      <response text="Let's go!">
       	 <action name="script">
       		 <=!=[=C=D=A=T=A=[
			pos = {x=990, y=1138, z=6}
			doTeleportThing(cid, pos) 
            		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
       		 ]=]=>
       	 </action>
        <action name="idle" value="1"/>
      </response>
    </interact>

    <interact keywords="bye" focus="0">
      <keywords>farewell</keywords>

      <response text="Have a nice day |NAME|."/>
    </interact>

    <interact event="onPlayerLeave" focus="0">
      <response text="Have a nice day |NAME|."/>
    </interact>

  </interaction>

You forgot to close the tag... It's supposed to be closed with "/>"

I'm getting errors :-(

[25/06/2012 17:24:28] [Warning - Npc::loadFromXml] Cannot load npc file (data/npc/Captain Seal.xml).
[25/06/2012 17:24:29] Line: 52, Info: Extra content at the end of the document

- - - Updated - - -

uhm, may I ask which distro you're using? or try changing it to another distro that uses the same vers. of tibia

This one: http://otland.net/f18/8-60-forgotten-server-0-3-6-crying-damson-v5-147913/

I had the problem with all previous versions of distributions so it is somewhere in data.
 
Last edited:
I'm getting errors :-(

[25/06/2012 17:24:28] [Warning - Npc::loadFromXml] Cannot load npc file (data/npc/Captain Seal.xml).
[25/06/2012 17:24:29] Line: 52, Info: Extra content at the end of the document

Your error is most likely just a missing end. Write </npc> after </interaction>.
 
Ok man :) Try this steps:

1) Go to your serv folder/data/npc
2) Select the npc of captain seal (for example; captain seal.xml)
3) Make a backup of it just in case
4) Open captain seal.xml (The original one, not the backup), erase all the code and paste this:
Lua:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Captain Seal" script="default.lua" walkinterval="3000" floorchange="0">
	<health now="150" max="150"/>
	<look type="146" head="20" body="74" legs="11" feet="4" />    
                      <parameters>
                                  <parameter key="module_travel" value="1"/>
		            <parameter key="message_greet" value="Hello |PLAYERNAME|. I'm a captain and I can travel with you to {free area}."/>
                                  <parameter key="travel_destinations" value="free,990,1138,6,0;area,990,1138,6,0;"/>
                      </parameters>
</npc>
5) Restart your server and check it. Maybe, and I say maybe, this will solve it. Hope it works!
 
Last edited:
Your error is most likely just a missing end. Write </npc> after </interaction>.

Yee, I know. Just forgotten to select this. But problem is that it's still do not work.

- - - Updated - - -

Ok man :) Try this steps:

1) Go to your serv folder/data/npc
2) Select the npc of captain seal (for example; captain seal.xml)
3) Make a backup of it just in case
4) Open captain seal.xml (The original one, not the backup), erase all the code and paste this:
Lua:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Captain Seal" script="default.lua" walkinterval="3000" floorchange="0">
	<health now="150" max="150"/>
	<look type="146" head="20" body="74" legs="11" feet="4" />    
                      <parameters>
                                  <parameter key="module_travel" value="1"/>
		            <parameter key="message_greet" value="Hello |PLAYERNAME|. I'm a captain and I can travel with you to {free area}."/>
                                  <parameter key="travel_destinations" value="free,990,1138,6,0;area,990,1138,6,0;"/>
                      </parameters>
</npc>
5) Restart your server and check it. Maybe, and I say maybe, this will solve it. Hope it works!

Code:
[27/06/2012 09:47:30] [Error - Npc interface] 
[27/06/2012 09:47:30] (Unknown script file)
[27/06/2012 09:47:30] Description: 
[27/06/2012 09:47:30] attempt to call a nil value
[27/06/2012 09:47:30] stack traceback:

Not workuing. I check my default.lua it's the same like everywhere ;-/

- - - Updated - - -

Also I need to say that I chosen this NPC system because it's the simpliest way to change player storage value ;-/
 
I think that this problem is configurable in engine. I tried to fix it by myself but compilator show a lot of warrnings and errors so... can somebody download V5 source from this topic: http://otland.net/f18/8-60-forgotten-server-0-3-6-crying-damson-v5-147913/ and change in npc.cpp
talkRadius = 2;
to
talkRadius = 3;

and send me a link to download (may be PW) ;-p?
 
Back
Top