• 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 don't sell new item added to my server

Diarreamental

Banned User
Joined
Jul 6, 2015
Messages
463
Solutions
1
Reaction score
85
Well the problem it's that i've added an item, in this case, it's a royal spear i added it in my sprites with object builder and to my items otb and items.xml
the item is working if i do it via the the id example /i 5281
i dont have error in console the npcs just keep trying to sell me a normal spear

but the npcs don't sell it i've tried with two npcs differents , in this case the new item it's a royal spear
i dont have error in console the npcs just keep trying to sell me a normal spear

galuna.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Galuna" script="data/npc/scripts/default.lua" walkinterval="2000" access="3" floorchange="0">
    <health now="100" max="100"/>
    <look type="137" head="40" body="96" legs="95" feet="96" addons="0"/>
    <parameters>
       
        <parameter key="message_greet" value="Oh, please come in, |PLAYERNAME|. What do you need? Distance weapons? I sell lots of them."/>
        <parameter key="message_farewell" value="Good bye."/>
       
        <parameter key="message_sendtrade" value="Of course, just browse through my wares."/>
        <parameter key="module_keywords" value="1" />
        <parameter key="keywords" value="name;job;offer;" />
        <parameter key="keyword_reply1" value="I am Galuna, paladin and fletcher." />
        <parameter key="keyword_reply2" value="I am the local fletcher. I am selling bows, crossbows, and ammunition. Do you need anything?" />
        <parameter key="keyword_reply3" value="My offers are bows, crossbows and ammunition." />

        <parameter key="module_shop" value="1"/>
        <parameter key="shop_buyable" value="crossbow,2455,500;bow,2456,400;bolt,2543,4;arrow,2544,3;spear,2389,10;royal spear,5281,25;" />
        <parameter key="shop_sellable" value="spear,2389,3;" />
    </parameters>
</npc>

willard.lua
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)

-- Items Rookgaard by Rodrigo (Nottinghster)

-- Itens para vender
shopModule:addSellableItem({'steel helmet'},2457,190,'steel helmet')
shopModule:addSellableItem({'double axe'},2387,260,'double axe')
shopModule:addSellableItem({'chain helmet'},2458,17,'chain helmet')
shopModule:addSellableItem({'iron helmet'},2459,150,'iron helmet')
shopModule:addSellableItem({'leather helmet'},2461,4,'leather helmet')
shopModule:addSellableItem({'chain legs'},2648,25,'chain legs')
shopModule:addSellableItem({'plate armor'},2463,400,'plate armor')
shopModule:addSellableItem({'chain armor'},2464,70,'chain armor')
shopModule:addSellableItem({'brass armor'},2465,150,'brass armor')
shopModule:addSellableItem({'leather armor'},2467,12,'leather armor')
shopModule:addSellableItem({'steel shield'},2509,80,'steel shield')
shopModule:addSellableItem({'wooden shield'},2512,5,'wooden shield')
shopModule:addSellableItem({'battle shield'},2513,95,'battle shield')
shopModule:addSellableItem({'viking shield'},2531,85,'viking shield')
shopModule:addSellableItem({'two handed sword'},2377,450,'two handed sword')
shopModule:addSellableItem({'spike sword'},2383,240,'spike sword')
shopModule:addSellableItem({'short sword'},2406,10,'short sword')
shopModule:addSellableItem({'morning star'},2394,90,'morning star')
shopModule:addSellableItem({'battle hammer'},2417,120,'battle hammer')
shopModule:addSellableItem({'clerical mace'},2423,170,'clerical mace')
shopModule:addSellableItem({'battle axe'},2378,80,'battle axe')
shopModule:addSellableItem({'barbarian axe'},2429,185,'barbarian axe')
shopModule:addSellableItem({'hand axe'},2380,4,'hand axe')
shopModule:addSellableItem({'dagger'},2379,2,'dagger')
shopModule:addSellableItem({'rapier'},2384,5,'rapier')
shopModule:addSellableItem({'sabre'},2385,12,'sabre')
shopModule:addSellableItem({'mace'},2398,30,'mace')
shopModule:addSellableItem({'halberd'},2381,400,'halberd')
shopModule:addSellableItem({'crossbow'},2455,120,'crossbow')
shopModule:addSellableItem({'bow'},2456,100,'bow')
shopModule:addSellableItem({'spear'},2389,3,'spear')
shopModule:addSellableItem({'royal spear'},5281,15,'royal spear')

-- Itens para comprar
shopModule:addBuyableItem({'chain helmet'},2458,52,'chain helmet')
shopModule:addBuyableItem({'leather helmet'},2461,12,'leather helmet')
shopModule:addBuyableItem({'chain legs'},2648,80,'chain legs')
shopModule:addBuyableItem({'chain armor'},2464,200,'chain armor')
shopModule:addBuyableItem({'brass armor'},2465,450,'brass armor')
shopModule:addBuyableItem({'leather armor'},2467,35,'leather armor')
shopModule:addBuyableItem({'steel shield'},2509,240,'steel shield')
shopModule:addBuyableItem({'wooden shield'},2512,15,'wooden shield')
shopModule:addBuyableItem({'viking shield'},2531,260,'viking shield')
shopModule:addBuyableItem({'battle hammer'},2417,350,'battle hammer')
shopModule:addBuyableItem({'clerical mace'},2423,540,'clerical mace')
shopModule:addBuyableItem({'barbarian axe'},2429,590,'barbarian axe')
shopModule:addBuyableItem({'throwing star'},2399,42,'throwing star')
shopModule:addBuyableItem({'dagger'},2379,5,'dagger')
shopModule:addBuyableItem({'rapier'},2384,15,'rapier')
shopModule:addBuyableItem({'sabre'},2385,35,'sabre')
shopModule:addBuyableItem({'mace'},2398,90,'mace')
shopModule:addBuyableItem({'crossbow'},2455,500,'crossbow')
shopModule:addBuyableItem({'bow'},2456,400,'bow')
shopModule:addBuyableItem({'spear'},2389,10,'spear')
shopModule:addBuyableItem({'arrow'},2544,3,'arrow')
shopModule:addBuyableItem({'bolt'},2543,4,'bolt')

npcHandler:addModule(FocusModule:new())
 
Well the problem it's that i've added an item, in this case, it's a royal spear i added it in my sprites with object builder and to my items otb and items.xml
the item is working if i do it via the the id example /i 5281
i dont have error in console the npcs just keep trying to sell me a normal spear

but the npcs don't sell it i've tried with two npcs differents , in this case the new item it's a royal spear
i dont have error in console the npcs just keep trying to sell me a normal spear

galuna.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Galuna" script="data/npc/scripts/default.lua" walkinterval="2000" access="3" floorchange="0">
    <health now="100" max="100"/>
    <look type="137" head="40" body="96" legs="95" feet="96" addons="0"/>
    <parameters>
      
        <parameter key="message_greet" value="Oh, please come in, |PLAYERNAME|. What do you need? Distance weapons? I sell lots of them."/>
        <parameter key="message_farewell" value="Good bye."/>
      
        <parameter key="message_sendtrade" value="Of course, just browse through my wares."/>
        <parameter key="module_keywords" value="1" />
        <parameter key="keywords" value="name;job;offer;" />
        <parameter key="keyword_reply1" value="I am Galuna, paladin and fletcher." />
        <parameter key="keyword_reply2" value="I am the local fletcher. I am selling bows, crossbows, and ammunition. Do you need anything?" />
        <parameter key="keyword_reply3" value="My offers are bows, crossbows and ammunition." />

        <parameter key="module_shop" value="1"/>
        <parameter key="shop_buyable" value="crossbow,2455,500;bow,2456,400;bolt,2543,4;arrow,2544,3;spear,2389,10;royal spear,5281,25;" />
        <parameter key="shop_sellable" value="spear,2389,3;" />
    </parameters>
</npc>

willard.lua
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)

-- Items Rookgaard by Rodrigo (Nottinghster)

-- Itens para vender
shopModule:addSellableItem({'steel helmet'},2457,190,'steel helmet')
shopModule:addSellableItem({'double axe'},2387,260,'double axe')
shopModule:addSellableItem({'chain helmet'},2458,17,'chain helmet')
shopModule:addSellableItem({'iron helmet'},2459,150,'iron helmet')
shopModule:addSellableItem({'leather helmet'},2461,4,'leather helmet')
shopModule:addSellableItem({'chain legs'},2648,25,'chain legs')
shopModule:addSellableItem({'plate armor'},2463,400,'plate armor')
shopModule:addSellableItem({'chain armor'},2464,70,'chain armor')
shopModule:addSellableItem({'brass armor'},2465,150,'brass armor')
shopModule:addSellableItem({'leather armor'},2467,12,'leather armor')
shopModule:addSellableItem({'steel shield'},2509,80,'steel shield')
shopModule:addSellableItem({'wooden shield'},2512,5,'wooden shield')
shopModule:addSellableItem({'battle shield'},2513,95,'battle shield')
shopModule:addSellableItem({'viking shield'},2531,85,'viking shield')
shopModule:addSellableItem({'two handed sword'},2377,450,'two handed sword')
shopModule:addSellableItem({'spike sword'},2383,240,'spike sword')
shopModule:addSellableItem({'short sword'},2406,10,'short sword')
shopModule:addSellableItem({'morning star'},2394,90,'morning star')
shopModule:addSellableItem({'battle hammer'},2417,120,'battle hammer')
shopModule:addSellableItem({'clerical mace'},2423,170,'clerical mace')
shopModule:addSellableItem({'battle axe'},2378,80,'battle axe')
shopModule:addSellableItem({'barbarian axe'},2429,185,'barbarian axe')
shopModule:addSellableItem({'hand axe'},2380,4,'hand axe')
shopModule:addSellableItem({'dagger'},2379,2,'dagger')
shopModule:addSellableItem({'rapier'},2384,5,'rapier')
shopModule:addSellableItem({'sabre'},2385,12,'sabre')
shopModule:addSellableItem({'mace'},2398,30,'mace')
shopModule:addSellableItem({'halberd'},2381,400,'halberd')
shopModule:addSellableItem({'crossbow'},2455,120,'crossbow')
shopModule:addSellableItem({'bow'},2456,100,'bow')
shopModule:addSellableItem({'spear'},2389,3,'spear')
shopModule:addSellableItem({'royal spear'},5281,15,'royal spear')

-- Itens para comprar
shopModule:addBuyableItem({'chain helmet'},2458,52,'chain helmet')
shopModule:addBuyableItem({'leather helmet'},2461,12,'leather helmet')
shopModule:addBuyableItem({'chain legs'},2648,80,'chain legs')
shopModule:addBuyableItem({'chain armor'},2464,200,'chain armor')
shopModule:addBuyableItem({'brass armor'},2465,450,'brass armor')
shopModule:addBuyableItem({'leather armor'},2467,35,'leather armor')
shopModule:addBuyableItem({'steel shield'},2509,240,'steel shield')
shopModule:addBuyableItem({'wooden shield'},2512,15,'wooden shield')
shopModule:addBuyableItem({'viking shield'},2531,260,'viking shield')
shopModule:addBuyableItem({'battle hammer'},2417,350,'battle hammer')
shopModule:addBuyableItem({'clerical mace'},2423,540,'clerical mace')
shopModule:addBuyableItem({'barbarian axe'},2429,590,'barbarian axe')
shopModule:addBuyableItem({'throwing star'},2399,42,'throwing star')
shopModule:addBuyableItem({'dagger'},2379,5,'dagger')
shopModule:addBuyableItem({'rapier'},2384,15,'rapier')
shopModule:addBuyableItem({'sabre'},2385,35,'sabre')
shopModule:addBuyableItem({'mace'},2398,90,'mace')
shopModule:addBuyableItem({'crossbow'},2455,500,'crossbow')
shopModule:addBuyableItem({'bow'},2456,400,'bow')
shopModule:addBuyableItem({'spear'},2389,10,'spear')
shopModule:addBuyableItem({'arrow'},2544,3,'arrow')
shopModule:addBuyableItem({'bolt'},2543,4,'bolt')

npcHandler:addModule(FocusModule:new())
no idea if it makes any difference, but 'royal spear' isn't in the .lua file for a buyable item.
-shrugs-
 
no idea if it makes any difference, but 'royal spear' isn't in the .lua file for a buyable item.
-shrugs-
at least in galuna yes , it isn't if you can see galuna is using default script and willard is using the lua
here 's willard.xml( i show this because the script that i posted about willard is related with this
i did it (show once that works only with the xml and the wother with the lua to show tht none of them works)
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Willard" script="data/npc/scripts/willard.lua" walkinterval="2000" floorchange="0">
    <health now="100" max="100"/>
    <look type="131" head="58" body="104" legs="19" feet="116" addons="0"/>
  <parameters>
 
          <parameter key="message_greet" value="Greetings and Banor be with you, |PLAYERNAME|!"/>
        <parameter key="message_farewell" value="Farewell."/>
       
        <parameter key="module_keywords" value="1" />
        <parameter key="keywords" value="name;job;king;tibianus;army;ferumbras;excalibug;thais;tibia;carlin;edron;news;rumors;offer;weapon;ammunition;helmets;armors;shields;trousers;legs" />
        <parameter key="keyword_reply1" value="I am Willard, the smith." />
        <parameter key="keyword_reply2" value="I am the blacksmith of castle Bloodrock." />
        <parameter key="keyword_reply3" value="Hail to the King! He's our benevolent protector." />
        <parameter key="keyword_reply4" value="Hail to the King! He's our benevolent protector." />
        <parameter key="keyword_reply5" value="I supply them with all they need." />
        <parameter key="keyword_reply6" value="I would be honored if it's one of my blades that one day delivers him his punishment." />
        <parameter key="keyword_reply7" value="Adventurers search for this blade all over the world. Even here." />
        <parameter key="keyword_reply8" value="A fine city, but I love the peace of Edron more." />
        <parameter key="keyword_reply9" value="It's my dream that one day the whole world will profit from the Thaian governance." />
        <parameter key="keyword_reply10" value="If the king sees the time is right, he will certainly start a campaign to reclaim what belongs to Thais." />
        <parameter key="keyword_reply11" value="Edron is a fine city to live in." />
        <parameter key="keyword_reply12" value="Rumors are too sinister things that a true warrior would care for them." />
        <parameter key="keyword_reply13" value="Rumors are too sinister things that a true warrior would care for them." />
        <parameter key="keyword_reply14" value="My offers are weapons, ammunition, armors, helmets, legs, and shields." />
        <parameter key="keyword_reply15" value="What do you need? I sell weapons, armors, helmets, and shields." />
        <parameter key="keyword_reply16" value="I have hand axes, axes, barbarian axes, spears, maces, clerical maces, battle hammers, swords, rapiers, daggers, sabres, bows, and crossbows. What's your choice?" />
        <parameter key="keyword_reply17" value="I have arrows for bows and bolts for crossbows. What do you want?" />
        <parameter key="keyword_reply18" value="I am selling leather helmets and chain helmets. What do you want?" />
        <parameter key="keyword_reply19" value="I am selling leather, chain, and brass armor. What do you need?" />
        <parameter key="keyword_reply20" value="I am selling wooden shields, steel shields, and viking shields. What do you want?" />
        <parameter key="keyword_reply21" value="I am selling chain legs. Do you want to buy any?" />
        <parameter key="keyword_reply22" value="I am selling chain legs. Do you want to buy any?" />

    </parameters>
</npc>
i have to add the new item somewhere else?
 
Back
Top