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

Adding my script into Jido's npc system

Vanitas

Anaerobe
Joined
Jul 7, 2008
Messages
34
Reaction score
0
I tried to do something like that:
Lua:
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

some my code here

npcHandler:addModule(FocusModule:new())
"some my code" works good without Jido's system
Jido's system works good without "some my code"
When I put them together NPC doesn't answer any hi, hello or trade.
How can I join together those scripts to work correctly?

My example code:
Lua:
   if msg=="hi" or msg=="hello" then
			selfSay("Welcome!", cid, TRUE)		
	end
 
bump

@EDIT
I did something with my script but I get that error:
Code:
Lua Script Error: [Npc interface]
data/npc/scripts/sample.lua

luagetDistanceTo(). Thing not found

Lua Script Error: [Npc interface]
data/npc/scripts/sample.lua
Does it mean that I must add some function to npchandler.lua? Where can I find this function (to copy it)?
 
Last edited:
:confused:
Yea, but my npc looks that:
Lua:
  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

npcHandler:onCreatureSay(cid, type, msg)
	local talk_var
   local storage=getPlayerStorageValue(cid, 1038)
   local sex=getPlayerSex(cid)
   local msgsstory={"msg one","msg two","msg three"}
   
   if msg=="hi" or msg=="hello" then
		if sex == 0 then
			npcHandler:say('Welcome, |PLAYERNAME|! The lovely sound of your voice shines like a beam of light through my solitary darkness!', cid)
		else
			npcHandler:say('Greetings, |PLAYERNAME|. I do not see your face, but I can read a thousand things in your voice!', cid)
		end	
      
   if msg=="story" or msg=="fate" then
		npcHandler:say('would you like to hear my story?', cid)
      if msg=="yes'" then
		talk_var=doNPCTalkALot(msgsstory,6000) --delay
	  else
		npcHandler:say('As you wish, stranger.', cid)
	  end	  
	end	
		
	end
	
npcHandler:addModule(FocusModule:new())
And what now?
 
Back
Top