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

NPC doesnt buy items

pejsolo

New Member
Joined
Apr 24, 2014
Messages
34
Reaction score
1
Using TFS 0.3.6 v8.2 and i can only sell stackable items. Items that are non stackable cannot be sold

Error:
Code:
[25/04/2014 23:31:21] [Error - Npc interface]
[25/04/2014 23:31:21] (Unknown script file)
[25/04/2014 23:31:21] Description:
[25/04/2014 23:31:21] data/npc/lib/npcsystem/modules.lua:1229: bad argument #2 to 'error' (number expected, got string)
[25/04/2014 23:31:21] stack traceback:
[25/04/2014 23:31:21]    [C]: in function 'error'
[25/04/2014 23:31:21]    data/npc/lib/npcsystem/modules.lua:1229: in function 'callbackOnSell'
[25/04/2014 23:31:21]    data/npc/lib/npcsystem/npchandler.lua:265: in function 'processModuleCallback'
[25/04/2014 23:31:21]    data/npc/lib/npcsystem/npchandler.lua:450: in function 'onSell'
[25/04/2014 23:31:21]    data/npc/lib/npcsystem/modules.lua:1296: in function <data/npc/lib/npcsystem/modules.lua:1295>

Modules.lua
http://pastebin.com/3D6B55mp
Npchandler.lua
http://pastebin.com/T4K76jR3
 
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Romella" script="default.lua" walkinterval="4000" floorchange="0">
    <health now="150" max="150"/>
    <look type="139" head="79" body="39" legs="77" feet="115" addons="1"/>
<voices>
<voice text="Check out my good and sturdy weapons!" interval2="100" margin="1" yell="no"/>
</voices>
    <parameters>
        <parameter key="module_shop" value="1"/>
            <parameter key="message_greet" value="I welcome thee, |PLAYERNAME|! I suppose you are looking for a trade in fine weapons!"/>
            <parameter key="message_farewell" value="Goodbye and please bring more gold next time. I mean, it would be nice to see you again."/>
        <parameter key="message_walkaway" value="Goodbye and please bring more gold next time. I mean, it would be nice to see you again." />
        <parameter key="message_sendtrade" value="Of course, just browse through my wares." />
        <parameter key="shop_sellable" value="angelic axe,7436,5000;barbarian axe,2429,185;battle axe,2378,80;beastslayer axe,3962,1500;butcher axe,7412,18000;daramanian waraxe,2440,1000;double axe,2387,260;dragon lance,2414,9000;drakinata,11299,10000;dreaded cleaver,7419,15000;dwarven axe,2435,1500;fire axe,2432,8000;glorious axe,7454,3000;guardian halberd,2427,11000;halberd,2381,400;hatchet,2388,25;headchopper,7380,6000;heroic axe,7389,30000;knight axe,2430,2000;noble axe,7456,10000;obsidian lance,2425,500;orcish axe,2428,350;ripper lance,3964,500;royal axe,7434,40000;titan axe,7413,4000;vile axe,7388,30000;war axe,2454,12000;zaoan halberd,11317,500;abyss hammer,7414,20000;amber staff,7426,8000;arcane staff,2453,42000;battle hammer,2417,120;blessed sceptre,7429,40000;bonebreaker,7428,10000;brutetamer staff,7379,1500;chaos mace,7427,9000;clerical mace,2423,170;cranial basher,7415,30000;crystal mace,2445,12000;daramanian mace,2439,110;diamond sceptre,7387,3000;dragon hammer,2434,2000;dragonbone staff,7430,3000;furry club,7432,1000;hammer of wrath,2444,30000;heavy mace,2452,50000;jade hammer,7422,25000;lunar staff,7424,5000;mace,2398,30;mammoth whopper,7381,300;morning star,2394,100;onyx flail,7421,22000;orcish maul,7392,6000;sapphire hammer,7437,7000;shadow sceptre,7451,10000;skull staff,2436,6000;spiked squelcher,7452,5000;taurus mace,7425,500;war hammer,2391,1200;assassin dagger,7404,20000;berserker,7403,40000;blacksteel sword,7406,6000;blade of corruption,12610,60000;bloody edge,7416,30000;bone sword,2450,20;bright sword,2407,6000;broadsword,2413,500;crystal sword,7449,600;demonrage sword,7382,36000;dragon slayer,7402,15000;epee,2438,8000;fire sword,2392,4000;giant sword,2393,17000;haunted blade,7407,8000;ice rapier,2396,5000;longsword,2397,51;mercenary sword,7386,12000;mystic blade,7384,30000;nightmare blade,7418,35000;poison dagger,2411,50;relic sword,7383,25000;runed sword,7417,45000;sabre,2385,12;scimitar,2419,150;serpent sword,2409,900;silver dagger,2402,500;spike sword,2383,1000;sword,2376,25;templar scytheblade,3963,200;thaian sword,7391,16000;avenger,6528,42000;justice seeker,7390,40000;twiceslicer,12574,28000;twin hooks,11303,500;two handed sword,2377,450;wyvern fang,7408,1500;zaoan sword,11301,30000"/>
        <parameter key="shop_buyable" value="barbarian axe,2429,590;clerical mace,2423,540;crimson sword,7385,610;ice rapier,2396,5000"/>
    </parameters>
</npc>

Every other NPC is pretty much the same, they buy stackable items but they dont buy non-stackables (i can only sell through typing eg. sell 3 mace)
 
Bump

also, NPCs looking like that don't work either, only stackable items:
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}

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({'spellbook'}, 2175, 150, 'spellbook')

shopModule:addBuyableItem({'health potion'}, 7618, 45, 1, 'health potion')
shopModule:addBuyableItem({'mana potion'}, 7620, 50, 1, 'mana potion')
shopModule:addBuyableItem({'strong health'}, 7588, 100, 1, 'strong health potion')
shopModule:addBuyableItem({'strong mana'}, 7589, 80, 1, 'strong mana potion')
shopModule:addBuyableItem({'great health'}, 7591, 190, 1, 'great health potion')
shopModule:addBuyableItem({'great mana'}, 7590, 120, 1, 'great mana potion')
shopModule:addBuyableItem({'great spirit'}, 8472, 190, 1, 'great spirit potion')
shopModule:addBuyableItem({'ultimate health'}, 8473, 310, 1, 'ultimate health potion')

shopModule:addBuyableItem({'avalanche rune'}, 2274, 45, 1, 'avalanche rune')
shopModule:addBuyableItem({'intense healing rune'}, 2265, 95, 1, 'intense healing rune')
shopModule:addBuyableItem({'blank rune'}, 2260, 10, 1, 'blank rune')
shopModule:addBuyableItem({'chameleon rune'}, 2291, 210, 1, 'chameleon rune')
shopModule:addBuyableItem({'convince creature rune'}, 2290, 80, 1, 'convince creature rune')
shopModule:addBuyableItem({'destroy field rune'}, 2261, 15, 1, 'destroy field rune')
shopModule:addBuyableItem({'energy field rune'}, 2277, 38, 1, 'energy field rune')
shopModule:addBuyableItem({'energy wall rune'}, 2279, 85, 1, 'energy wall rune')
shopModule:addBuyableItem({'explosion rune'}, 2313, 31, 1, 'explosion rune')
shopModule:addBuyableItem({'fire bomb rune'}, 2305, 117, 1, 'fire bomb rune')
shopModule:addBuyableItem({'fire field rune'}, 2301, 28, 1, 'fire field rune')
shopModule:addBuyableItem({'fire wall rune'}, 2303, 61, 1, 'fire wall rune')
shopModule:addBuyableItem({'great fireball rune'}, 2304, 45, 1, 'great fireball rune')
shopModule:addBuyableItem({'light magic missile rune'}, 2287, 4, 1, 'light magic missile rune')
shopModule:addBuyableItem({'poison field rune'}, 2285, 21, 1, 'poison field rune')
shopModule:addBuyableItem({'poison wall rune'}, 2289, 52, 1, 'poison wall rune')
shopModule:addBuyableItem({'stalagmite rune'}, 2292, 12, 1, 'stalagmite rune')
shopModule:addBuyableItem({'sudden death rune'}, 2268, 108, 1, 'sudden death rune')
shopModule:addBuyableItem({'ultimate healing rune'}, 2273, 175, 1, 'ultimate healing rune')
shopModule:addBuyableItem({'animate dead rune'}, 2316, 375, 1, 'animate dead rune')
shopModule:addBuyableItem({'chameleon rune'}, 2291, 210, 1, 'chameleon rune')
shopModule:addBuyableItem({'desintegrate rune'}, 2310, 26, 1, 'desintegrate rune')
shopModule:addBuyableItem({'energy bomb rune'}, 2262, 162, 1, 'energy bomb rune')
shopModule:addBuyableItem({'fireball rune'}, 2302, 30, 1, 'fireball rune')
shopModule:addBuyableItem({'heavy magic missile rune'}, 2311, 12, 1, 'heavy magic missile rune')
shopModule:addBuyableItem({'holy missile rune'}, 2295, 16, 1, 'holy missile rune')
shopModule:addBuyableItem({'icicle rune'}, 2271, 30, 1, 'icicle rune')
shopModule:addBuyableItem({'magic wall rune'}, 2293, 116, 1, 'magic wall rune')
shopModule:addBuyableItem({'paralyze rune'}, 2278, 700, 1, 'paralyze rune')
shopModule:addBuyableItem({'poison bomb rune'}, 2286, 85, 1, 'poison bomb rune')
shopModule:addBuyableItem({'soulfire rune'}, 2308, 46, 1, 'soulfire rune')
shopModule:addBuyableItem({'stone shower rune'}, 2288, 37, 1, 'stone shower rune')
shopModule:addBuyableItem({'thunderstorm rune'}, 2315, 37, 1, 'thunderstorm rune')
shopModule:addBuyableItem({'wild growth rune'}, 2269, 160, 1, 'wild growth rune')

shopModule:addBuyableItem({'wand of vortex', 'vortex'}, 2190, 500, 'wand of vortex')
shopModule:addBuyableItem({'wand of dragonbreath', 'dragonbreath'}, 2191, 1000, 'wand of dragonbreath')
shopModule:addBuyableItem({'wand of decay', 'decay'}, 2188, 5000, 'wand of decay')
shopModule:addBuyableItem({'wand of cosmic energy', 'cosmic energy'}, 2189, 10000, 'wand of cosmic energy')
shopModule:addBuyableItem({'wand of inferno', 'inferno'}, 2187, 15000, 'wand of inferno')

shopModule:addBuyableItem({'snakebite rod', 'snakebite'}, 2182, 500, 'snakebite rod')
shopModule:addBuyableItem({'moonlight rod', 'moonlight'}, 2186, 1000, 'moonlight rod')
shopModule:addBuyableItem({'necrotic rod', 'necrotic'}, 2185, 5000, 'necrotic rod')
shopModule:addBuyableItem({'terra rod', 'terra'}, 2181, 10000, 'terra rod')
shopModule:addBuyableItem({'hailstorm rod', 'hailstorm'}, 2183, 15000, 'hailstorm rod')

shopModule:addSellableItem({'wand of vortex', 'vortex'}, 2190, 100, 'wand of vortex')
shopModule:addSellableItem({'wand of dragonbreath', 'dragonbreath'}, 2191, 200, 'wand of dragonbreath')
shopModule:addSellableItem({'wand of decay', 'decay'}, 2188, 1000, 'wand of decay')
shopModule:addSellableItem({'wand of draconia', 'draconia'}, 8921, 1500, 'wand of draconia')
shopModule:addSellableItem({'wand of cosmic energy', 'cosmic energy'}, 2189, 2000, 'wand of cosmic energy')
shopModule:addSellableItem({'wand of inferno', 'inferno'},2187, 3000, 'wand of inferno')
shopModule:addSellableItem({'wand of starstorm', 'starstorm'}, 8920, 3600, 'wand of starstorm')
shopModule:addSellableItem({'wand of voodoo', 'voodoo'}, 8922, 4400, 'wand of voodoo')

shopModule:addSellableItem({'snakebite rod', 'snakebite'}, 2182, 100,'snakebite rod')
shopModule:addSellableItem({'moonlight rod', 'moonlight'}, 2186, 200,  'moonlight rod')
shopModule:addSellableItem({'necrotic rod', 'necrotic'}, 2185, 1000, 'necrotic rod')
shopModule:addSellableItem({'northwind rod', 'northwind'}, 8911, 1500, 'northwind rod')
shopModule:addSellableItem({'terra rod', 'terra'}, 2181, 2000, 'terra rod')
shopModule:addSellableItem({'hailstorm rod', 'hailstorm'}, 2183, 3000, 'hailstorm rod')
shopModule:addSellableItem({'springsprout rod', 'springsprout'}, 8912, 3600, 'springsprout rod')
shopModule:addSellableItem({'underworld rod', 'underworld'}, 8910, 4400, 'underworld rod')

shopModule:addSellableItem({'spellbook of enlightenment'}, 8900, 4000, 'spellbook of enlightenment')
shopModule:addSellableItem({'spellbook of lost souls'}, 8903, 19000, 'spellbook of lost souls')
shopModule:addSellableItem({'spellbook of mind control'}, 8902, 13000, 'spellbook of mind control')
shopModule:addSellableItem({'spellbook of warding'}, 8901, 8000, 'spellbook of warding')

local items = {[1] = 2190, [2] = 2182, [5] = 2190, [6] = 2182}
function creatureSayCallback(cid, type, msg)
    if(not npcHandler:isFocused(cid)) then
        return false
    end

    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
    if(msgcontains(msg, 'first rod') or msgcontains(msg, 'first wand')) then
        if(isSorcerer(cid) or isDruid(cid)) then
            if(getPlayerStorageValue(cid, 30002) <= 0) then
                selfSay('So you ask me for a {' .. getItemNameById(items[getPlayerVocation(cid)]) .. '} to begin your advanture?', cid)
                talkState[talkUser] = 1
            else
                selfSay('What? I have already gave you one {' .. getItemNameById(items[getPlayerVocation(cid)]) .. '}!', cid)
            end
        else
            selfSay('Sorry, you aren\'t a druid either a sorcerer.', cid)
        end
    elseif(msgcontains(msg, 'yes')) then
        if(talkState[talkUser] == 1) then
            doPlayerAddItem(cid, items[getPlayerVocation(cid)], 1)
            selfSay('Here you are young adept, take care yourself.', cid)
            setPlayerStorageValue(cid, 30002, 1)
        end
        talkState[talkUser] = 0
    elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser])) then
        selfSay('Ok then.', cid)
        talkState[talkUser] = 0
    end

    return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Back
Top