• 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 script trouble

7804364

Member
Joined
Mar 6, 2010
Messages
457
Reaction score
10
when i talk to a npc, they wont say hi back, the error in console said somthign like npchandler nip. so i went inside npc handler.

if(NpcHandler == nil) then
-- Constant talkdelay behaviors.
TALKDELAY_NONE = 0 -- No talkdelay. Npc will reply immedeatly.
TALKDELAY_ONTHINK = 1 -- Talkdelay handled through the onThink callback function. (Default)
TALKDELAY_EVENT = 2 -- Not yet implemented



WHAT DO I CHANGE NIL TO?
 
That's because you've copied your NPC folder from other server and that doesn't match ;/.. I Have similar problem.. When i'm using my own NPC Pack, they're dont responding and when i use standard NPC lib, scripts (From OTXServer, thats OTServ distro am i right?) then i recieve something like that:

[19/5/2012 18:10:53] [Warning - Joe - Teleport Room] NpcSystem:
[19/5/2012 18:10:53] ShopModule.onBuy - Item not found on shopItems list

and the strange thing is.. That i try to buy runes in npc Pacolina, and everytime i say 'bye' 'hi' then error shows other, random npc name in console ^^...wtf though?
 
umm it says this as error

[18:26:34.882] [Error - NpcScript Interface]
[18:26:34.882] data/npc/scripts/default.lua:eek:nCreatureSay
[18:26:34.882] Description:
[18:26:34.882] data/npc/lib/npcsystem/npchandler.lua:558: attempt to call global 'getDistanceTo' (a nil value)
[18:26:34.882] stack traceback:
[18:26:34.882] data/npc/lib/npcsystem/npchandler.lua:558: in function 'isInRange'
[18:26:34.882] data/npc/lib/npcsystem/npchandler.lua:381: in function 'onCreatureSay'
[18:26:34.882] data/npc/scripts/default.lua:7: in function <data/npc/scripts/default.lua:7>
 
OK I CAN ADD THE NPC WHICH MAKES ERROR IN MY OT. (ERROR IS: I can't buy items from 'trade' and in engine it says
Code:
[19/5/2012 18:10:53] [Warning - Joe - Teleport Room] NpcSystem:
[19/5/2012 18:10:53] ShopModule.onBuy - Item not found on shopItems list
.

PACOLINA.XML
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Pacolina" nameDescription="Pacolina, the premium lady." script="data/npc/scripts/pacc.lua" walkinterval="2000" floorchange="0">
	<health now="100" max="100"/>
	<look type="288" head="114" body="92" legs="132" feet="0" addons="3"/>
	<parameters>
		<parameter key="message_greet" value="Hello |PLAYERNAME|. I sell Premium Runes! Say {trade} to begin shopping."/>
		<parameter key="message_decline" value="Is |TOTALCOST| gold coins too much for you? Get out of here!"/>
	</parameters>
</npc>


PACOLINA SCRIPT:
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 shopModule = ShopModule:new()
npcHandler:addModule(shopModule)

shopModule:addBuyableItem({'amulet of loss'}, 2307, 20000, '1 Day Pacc Rune')
shopModule:addBuyableItem({'protection amulet'}, 2298, 70000, '5 Day Pacc Rune')


npcHandler:addModule(FocusModule:new())


IN ENGINE THERE IS "JOE - TELEPORT ROOM" BUT ERROR SHOWS WHILE WRITING TO 'PACOLINA' AND IDK WHY IT SHOWS RANDOM NPC IN ERROR EVERYTIME SOMEONE SAYS HI TO THE NPC..
 
Back
Top