• 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 Problem with npcs (NEED HELP!)

khang123321

New Member
Joined
Jan 3, 2011
Messages
25
Reaction score
2
Everytime i try to sell something on any npcs i get this error..
[18/2/2013 15:2:30] [Error - NpcScript Interface]
[18/2/2013 15:2:30] (Unknown script file)
[18/2/2013 15:2:30] Description:
[18/2/2013 15:2:30] (luaDoPlayerRemoveItem) Player not found

Here's one of the npc script
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Perac" script="data/npc/scripts/default.lua" walkinterval="2000" floorchange="0">
	<health now="100" max="100"/>
	<look type="134" head="57" body="59" legs="40" feet="76" addons="3" corpse="2212"/>
<parameters>
        <parameter key="module_shop" value="1"/>
        <parameter key="shop_sellable" value="
0,2455,150,crossbows;
0,3965,25,hunting spear;
bow,2456,130,bow"/>
        <parameter key="shop_buyable" value="
crossbow,2455,500,0;
bow,2456,400,0;
spear,2389,10;
poison arrow,2545,4;
burst arrow,2546,10;
bolt,2543,4;
arrow,2544,3;
assassin star,7368,100;
earth arrow,7850,5;
flaming arrow,7840,5;
flash arrow,7838,5;
shiver arrow,7839,5;
piercing bolt,7363,5;
power bolt,2547,7;
sniper arrow,7364,5;
royal spear,7378,15;
throwing knife,2410,25;
throwing star,2399,4;
onyx arrow,7365,7
"/>
    </parameters>
</npc>
 
The Forgotten Server Version: 0.3.7 - Crying Damson (GOLD).
LIMOS !!!!

- - - Updated - - -

this is in modules..
PHP:
		if(doPlayerRemoveItem(cid, itemid, amount, subType, ignoreEquipped)) then
			local msg = self.npcHandler:getMessage(MESSAGE_SOLD)
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, self.npcHandler:parseMessage(msg, parseInfo))

			doPlayerAddMoney(cid, amount * shopItem.sell)
			if(NPCHANDLER_CONVBEHAVIOR ~= CONVERSATION_DEFAULT) then
				self.npcHandler.talkStart[cid] = os.time()
			else
				self.npcHandler.talkStart = os.time()
			end

			return true
		end
which means it should be like this ?
<parameter key="shop_sellable" value="
getPlayerName(cid),2455,150,crossbow;
getPlayerName(cid),3965,25,hunting spear;
getPlayerName(cid),2456,130,bow"/>
 
Last edited:
Lua:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Perac" script="default.lua" walkinterval="2000" floorchange="0">
	<health now="150" max="150"/>
	<look type="134" head="57" body="59" legs="40" feet="76" addons="3" corpse="2212"/>
	<parameters>
		<parameter key="module_shop" value="1"/>
		<parameter key="message_greet" value="Hello |PLAYERNAME|. I sell all kinds of distance weapons and ammunition. Would you like to {trade}?"/>
		<parameter key="shop_sellable" value="crossbow,2455,150;hunting spear,3965,25;bow,2456,130"/>
		<parameter key="shop_buyable" value="crossbow,2455,500;bow,2456,400;spear,2389,10;poison arrow,2545,4;burst arrow,2546,10;bolt,2543,4;arrow,2544,3;assassin star,7368,100;earth arrow,7850,5;flaming arrow,7840,5;flash arrow,7838,5;shiver arrow,7839,5;piercing bolt,7363,5;power bolt,2547,7;sniper arrow,7364,5;royal spear,7378,15;throwing knife,2410,25;throwing star,2399,4;onyx arrow,7365,7"/>
	</parameters>
</npc>


Here in your script is where it gets messy
Lua:
        <parameter key="shop_sellable" value="
0,2455,150,crossbows;
0,3965,25,hunting spear;
bow,2456,130,bow"/>

- - - Updated - - -

The Forgotten Server Version: 0.3.7 - Crying Damson (GOLD).
LIMOS !!!!

- - - Updated - - -

this is in modules..
PHP:
		if(doPlayerRemoveItem(cid, itemid, amount, subType, ignoreEquipped)) then
			local msg = self.npcHandler:getMessage(MESSAGE_SOLD)
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, self.npcHandler:parseMessage(msg, parseInfo))

			doPlayerAddMoney(cid, amount * shopItem.sell)
			if(NPCHANDLER_CONVBEHAVIOR ~= CONVERSATION_DEFAULT) then
				self.npcHandler.talkStart[cid] = os.time()
			else
				self.npcHandler.talkStart = os.time()
			end

			return true
		end
which means it should be like this ?
<parameter key="shop_sellable" value="
getPlayerName(cid),2455,150,crossbow;
getPlayerName(cid),3965,25,hunting spear;
getPlayerName(cid),2456,130,bow"/>

It's (itemname,itemid,cost) when its npchandler
 
thanks for you help Cloow, i'm still getting the same error((luaDoPlayerRemoveItem) Player not found) :T though i tried what you did over 100 times and other ways with the params
 
thanks for you help Cloow, i'm still getting the same error((luaDoPlayerRemoveItem) Player not found) :T though i tried what you did over 100 times and other ways with the params

Did you get that error with the npc I just posted?


Try to replace default.lua

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:addModule(FocusModule:new())
 
PHP:
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:addModule(FocusModule:new())
 
deeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeng it
thanks for trying

- - - Updated - - -

found the solution. i swapped the modules.lua cause i had no other idea then BAAAM ! item sold.
items with charges can't be sold tough:T
 
Last edited:

Similar threads

Replies
0
Views
162
Back
Top