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

(XML) NPC Issue (Responding in default)

bladeatblackd

New Member
Joined
Oct 19, 2010
Messages
7
Reaction score
0
I am working on a custom map TFS 8.6 server. The issue that I am running into is that my blessing NPC will not reply to the text "job" I have added it into her xml but she would say it in the default channel. I am trying to make it so that she says it in the NPC window. I had edited the blessing XML with the bless scripts and got it to work that way but I dont really want to clutter up that file. However my banker replys to the same keyword but its in his NPC XML and not his function XML

This is the XML I am trying to edit to respond in the NPC window
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Alice" script="bless.lua" walkinterval="2000" floorchange="0">
    <health now="100" max="100"/>
    <look type="139" head="20" body="39" legs="45" feet="7" addons="0"/>
   
    <interaction range="3" idletime="60">

    <interact keywords="hi" focus="1">
      <keywords>hello</keywords>

      <response text="May the gods be with you child.">
        <action name="idle" value="1"/>
      </response>
    </interact>

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

      <response text="Good bye."/>
    </interact>
   
    <interact keywords="job">
      <response text="I am a banker, my job is to exchange coins."/>
    </interact>
   
    </interaction>
</npc>

This is the XML file that I am using to try to mimic the correct actions.
Code:
<?xml version="1.0"?>
<npc name="Theodor" floorchange="0" walkinterval="4000">
    <health now="150" max="150"/>
    <look type="133" head="10" body="122" legs="19" feet="10"/>

  <interaction range="3" idletime="30" idleinterval="300" defaultpublic="0">
    <!--This will include the bankman interaction, in this way several npc can use the same interaction-->
    <include file="bankman.xml"/>

    <interact keywords="hi" focus="1">
      <!--These are the alternative keywords-->
      <keywords>hello</keywords>

      <response text="Hello. How may I help you |NAME|?"/>
    </interact>

    <interact keywords="bye" focus="0">
      <!--These are the alternative keywords-->
      <keywords>farewell</keywords>

      <response text="It was a pleasure to help you."/>
    </interact>

    <!--
    <interact event="onBusy">
      <response text="One moment please, |NAME|.">
        <action name="addqueue" value="|PLAYER|"/>
      </response>
    </interact>
    -->

    <interact event="onIdle">
      <response text="Beautiful day is it not |NAME|?" public="1">
        <action name="idle" value="1"/>
      </response>

      <response>
        <action name="script">
        <![CDATA[
          -- The npc will just say this on average once every 4 hours (240 minutes)
          local interval = 240 * 60

          local p = math.random(0, 10000000)
          local r = (10000000 * idleinterval) / interval
          --selfSay("r: " .. r .. ", p: " .. p)

          if(r >= p) then
            selfSay("Hey " .. name .. " can you help me?")
            _state.topic = 999
          end
        ]]>
        </action>

        <interact keywords="yes" topic="999">
          <response text="Ah great, would you mind holding this for me while I use the bathroom?">
            <action name="topic" value="-1"/>

            <interact keywords="yes">
              <response>
                <action name="script">
                <![CDATA[
                  local result = doPlayerAddItem(cid, 2157, 3, 0)
                  if(result == -1) then
                    selfSay("Never mind, I'll have to hold it in until I quit work.")
                  else
                    selfSay("Thanks alot! I'll be right back.")
                    _state.b1 = true
                  end
                ]]>
                </action>
              </response>
            </interact>

          </response>

          <interact keywords="|*|">
            <response text="Hmpf."/>
          </interact>

        </interact>

      </response>
    </interact>

    <interact event="onPlayerLeave" focus="0">
      <response text="It was a pleasure to help you |NAME|."/>
      <response b1="1" text="Hey hey give back my gold nuggets! POLICE HELP!"/>
    </interact>

    <interact keywords="name">
      <response text="My name is |NPCNAME|."/>
    </interact>

    <interact keywords="job">
      <response text="I am a banker, my job is to exchange coins."/>
    </interact>

  </interaction>

</npc>

This is the way I had the Bless XML set up to get the correct response action.
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)


function onCreatureAppear(cid)                npcHandler:onCreatureAppear(cid)            end
function onCreatureDisappear(cid)            npcHandler:onCreatureDisappear(cid)        end
function onCreatureSay(cid, type, msg)        npcHandler:onCreatureSay(cid, type, msg)    end
function onThink()                            npcHandler:onThink()                        end

local node1 = keywordHandler:addKeyword({'first bless'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to buy the first blessing for 2000 (plus level depending amount) gold?'})
    node1:addChildKeyword({'yes'}, StdModule.bless, {npcHandler = npcHandler, number = 1, premium = true, baseCost = 2000, levelCost = 200, startLevel = 30, endLevel = 120})
    node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Too expensive, eh?'})

local node2 = keywordHandler:addKeyword({'second bless'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to buy the second blessing for 2000 (plus level depending amount) gold?'})
    node2:addChildKeyword({'yes'}, StdModule.bless, {npcHandler = npcHandler, number = 2, premium = true, baseCost = 2000, levelCost = 200, startLevel = 30, endLevel = 120})
    node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Too expensive, eh?'})

local node3 = keywordHandler:addKeyword({'third bless'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to buy the third blessing for 2000 (plus level depending amount) gold?'})
    node3:addChildKeyword({'yes'}, StdModule.bless, {npcHandler = npcHandler, number = 3, premium = true, baseCost = 2000, levelCost = 200, startLevel = 30, endLevel = 120})
    node3:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Too expensive, eh?'})

local node4 = keywordHandler:addKeyword({'fourth bless'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to buy the fourth blessing for 2000 (plus level depending amount) gold?'})
    node4:addChildKeyword({'yes'}, StdModule.bless, {npcHandler = npcHandler, number = 4, premium = true, baseCost = 2000, levelCost = 200, startLevel = 30, endLevel = 120})
    node4:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Too expensive, eh?'})

local node5 = keywordHandler:addKeyword({'fifth bless'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to buy the fifth blessing for 2000 (plus level depending amount) gold?'})
    node5:addChildKeyword({'yes'}, StdModule.bless, {npcHandler = npcHandler, number = 5, premium = true, baseCost = 2000, levelCost = 200, startLevel = 30, endLevel = 120})
    node5:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Too expensive, eh?'})
   
local node6 = keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I am here to share the blessings of the gods.'})


npcHandler:addModule(FocusModule:new())


Any help would be greatly appreciated.
 
Back
Top