• 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 1 NPC dont sell me the items

Thorn

Spriting since 2013
Joined
Sep 24, 2012
Messages
2,203
Solutions
1
Reaction score
921
Location
Chile
hello guys, well i have a situation and i can't figure why does this happen, i hav compared this npc to others and i don't see a problem
this npc shows you his offer, if u have the money lets you click the item in the shop, but you click to buy it and nothing happens, not even in console, so if u could help me would be great!
tfs 0.3
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Portos" script="data/npc/scripts/default.lua" walkinterval="2000" floorchange="0">
    <health now="100" max="100"/>
    <look type="472" head="58" body="113" legs="76" feet="57" addons="3"/>
    <parameters>
        <parameter key="module_shop" value="1"/>
        <parameter key="message_greet" value="Hola |PLAYERNAME|. Yo vendo monturas, di {trade}."/>
        <parameter key="shop_buyable" value="Raikou Scroll, 21712, 100000000;Suicune Scroll, 21709, 100000000;
        Fire War Horse Scroll, 21708, 100000000;Blazebringer Scroll, 21707, 100000000;Uniwheel Scroll, 21706, 100000000;
        Mechanical Bird Scroll, 21704, 100000000;Tauros Scroll, 21699, 100000000;Entei Scroll, 21694, 100000000;
        Arcanine Scroll, 21717, 100000000;Shiny Arcanine Scroll, 21718, 100000000;Kinto Scroll, 21722, 100000000;"/>
       
    </parameters>
</npc>

bump plz help
 
Last edited by a moderator:
Try thys;
script/portos.lua
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({'Raikou Scroll'}, 21712, 100000000, 1,'Raikou Scroll')
shopModule:addBuyableItem({'Suicune Scroll'}, 21709, 100000000, 1,'Suicune Scroll')
shopModule:addBuyableItem({'Fire War Horse Scroll'}, 21708, 100000000, 1,'Fire War Horse Scroll')
shopModule:addBuyableItem({'Blazebringer Scroll'}, 21707, 100000000, 1,'Blazebringer Scroll')
shopModule:addBuyableItem({'Uniwheel Scroll'}, 21706, 100000000, 1,'Uniwheel Scroll')
shopModule:addBuyableItem({'Mechanical Bird Scroll'}, 21704, 100000000, 1,'Mechanical Bird Scroll')
shopModule:addBuyableItem({'Tauros Scroll'}, 21699, 100000000, 1,'Tauros Scroll')
shopModule:addBuyableItem({'Entei Scroll'}, 21694, 100000000, 1,'Entei Scroll')
shopModule:addBuyableItem({'Arcanine Scroll'}, 21717, 100000000, 1,'Arcanine Scroll')
shopModule:addBuyableItem({'Shiny Arcanine Scroll'}, 21718, 100000000, 1,'Shiny Arcanine Scroll')
shopModule:addBuyableItem({'Kinto Scroll'}, 21722, 100000000, 1,'Kinto Scroll')



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

portos.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Portos" script="portos.lua " walkinterval="1000" floorchange="1">
  <health now="100" max="100"/>    
  <look type="472" head="58" body="113" legs="76" feet="57" addons="3"/>
    <parameters>
       
        <parameter key="message_farewell" value="Come back soon!"/>
        <parameter key="message_sendtrade" value="Take all the time you need to decide what you want!"/>
        <parameter key="module_keywords" value="1" />
        <parameter key="keywords" value="hi;name;buy;sell;food;" />
        <parameter key="keyword_reply1" value="Welcome, welcome! Have a seat! If you like a drink or something to eat, just ask me for a {trade}!" />
        

       
    </parameters>
</npc>
 
Try thys;
script/portos.lua
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({'Raikou Scroll'}, 21712, 100000000, 1,'Raikou Scroll')
shopModule:addBuyableItem({'Suicune Scroll'}, 21709, 100000000, 1,'Suicune Scroll')
shopModule:addBuyableItem({'Fire War Horse Scroll'}, 21708, 100000000, 1,'Fire War Horse Scroll')
shopModule:addBuyableItem({'Blazebringer Scroll'}, 21707, 100000000, 1,'Blazebringer Scroll')
shopModule:addBuyableItem({'Uniwheel Scroll'}, 21706, 100000000, 1,'Uniwheel Scroll')
shopModule:addBuyableItem({'Mechanical Bird Scroll'}, 21704, 100000000, 1,'Mechanical Bird Scroll')
shopModule:addBuyableItem({'Tauros Scroll'}, 21699, 100000000, 1,'Tauros Scroll')
shopModule:addBuyableItem({'Entei Scroll'}, 21694, 100000000, 1,'Entei Scroll')
shopModule:addBuyableItem({'Arcanine Scroll'}, 21717, 100000000, 1,'Arcanine Scroll')
shopModule:addBuyableItem({'Shiny Arcanine Scroll'}, 21718, 100000000, 1,'Shiny Arcanine Scroll')
shopModule:addBuyableItem({'Kinto Scroll'}, 21722, 100000000, 1,'Kinto Scroll')



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

portos.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Portos" script="portos.lua " walkinterval="1000" floorchange="1">
  <health now="100" max="100"/>   
  <look type="472" head="58" body="113" legs="76" feet="57" addons="3"/>
    <parameters>
      
        <parameter key="message_farewell" value="Come back soon!"/>
        <parameter key="message_sendtrade" value="Take all the time you need to decide what you want!"/>
        <parameter key="module_keywords" value="1" />
        <parameter key="keywords" value="hi;name;buy;sell;food;" />
        <parameter key="keyword_reply1" value="Welcome, welcome! Have a seat! If you like a drink or something to eat, just ask me for a {trade}!" />
       

      
    </parameters>
</npc>


thanks i'll check it later!
 
Try thys;
script/portos.lua
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({'Raikou Scroll'}, 21712, 100000000, 1,'Raikou Scroll')
shopModule:addBuyableItem({'Suicune Scroll'}, 21709, 100000000, 1,'Suicune Scroll')
shopModule:addBuyableItem({'Fire War Horse Scroll'}, 21708, 100000000, 1,'Fire War Horse Scroll')
shopModule:addBuyableItem({'Blazebringer Scroll'}, 21707, 100000000, 1,'Blazebringer Scroll')
shopModule:addBuyableItem({'Uniwheel Scroll'}, 21706, 100000000, 1,'Uniwheel Scroll')
shopModule:addBuyableItem({'Mechanical Bird Scroll'}, 21704, 100000000, 1,'Mechanical Bird Scroll')
shopModule:addBuyableItem({'Tauros Scroll'}, 21699, 100000000, 1,'Tauros Scroll')
shopModule:addBuyableItem({'Entei Scroll'}, 21694, 100000000, 1,'Entei Scroll')
shopModule:addBuyableItem({'Arcanine Scroll'}, 21717, 100000000, 1,'Arcanine Scroll')
shopModule:addBuyableItem({'Shiny Arcanine Scroll'}, 21718, 100000000, 1,'Shiny Arcanine Scroll')
shopModule:addBuyableItem({'Kinto Scroll'}, 21722, 100000000, 1,'Kinto Scroll')



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

portos.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Portos" script="portos.lua " walkinterval="1000" floorchange="1">
  <health now="100" max="100"/>   
  <look type="472" head="58" body="113" legs="76" feet="57" addons="3"/>
    <parameters>
      
        <parameter key="message_farewell" value="Come back soon!"/>
        <parameter key="message_sendtrade" value="Take all the time you need to decide what you want!"/>
        <parameter key="module_keywords" value="1" />
        <parameter key="keywords" value="hi;name;buy;sell;food;" />
        <parameter key="keyword_reply1" value="Welcome, welcome! Have a seat! If you like a drink or something to eat, just ask me for a {trade}!" />
       

      
    </parameters>
</npc>


sorry i got this at the console
Code:
[3/5/2017 20:51:28] [Warning - Portos] NpcSystem:
[3/5/2017 20:51:28] Parameter 'keyword_reply2' missing. Skipping...
[3/5/2017 20:51:28] [Warning - Portos] NpcSystem:
[3/5/2017 20:51:28] Parameter 'keyword_reply3' missing. Skipping...
[3/5/2017 20:51:28] [Warning - Portos] NpcSystem:
[3/5/2017 20:51:28] Parameter 'keyword_reply4' missing. Skipping...
[3/5/2017 20:51:28] [Warning - Portos] NpcSystem:
[3/5/2017 20:51:28] Parameter 'keyword_reply5' missing. Skipping...
 
My God. This is obvious.




Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Portos" script="portos.lua " walkinterval="1000" floorchange="1">
  <health now="100" max="100"/> 
  <look type="472" head="58" body="113" legs="76" feet="57" addons="3"/>
    <parameters>
    
        <parameter key="message_farewell" value="Come back soon!"/>
        <parameter key="message_sendtrade" value="Take all the time you need to decide what you want!"/>
        <parameter key="module_keywords" value="1" />
        <parameter key="keywords" value="hi;name;buy;sell;food;" />
        <parameter key="keyword_reply1" value="Welcome, welcome! Have a seat! If you like a drink or something to eat, just ask me for a {trade}!" />



         <parameter key="keyword_reply2" value="Welcome, welcome! Have a seat! If you like a drink or something to eat, just ask me for a {trade}!" />         
<parameter key="keyword_reply3" value="Welcome, welcome! Have a seat! If you like a drink or something to eat, just ask me for a {trade}!" />        
<parameter key="keyword_reply4" value="Welcome, welcome! Have a seat! If you like a drink or something to eat, just ask me for a {trade}!" />        
<parameter key="keyword_reply5" value="Welcome, welcome! Have a seat! If you like a drink or something to eat, just ask me for a {trade}!" />     

    
    </parameters>
</npc>
 
My God. This is obvious.




Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Portos" script="portos.lua " walkinterval="1000" floorchange="1">
  <health now="100" max="100"/>
  <look type="472" head="58" body="113" legs="76" feet="57" addons="3"/>
    <parameters>
  
        <parameter key="message_farewell" value="Come back soon!"/>
        <parameter key="message_sendtrade" value="Take all the time you need to decide what you want!"/>
        <parameter key="module_keywords" value="1" />
        <parameter key="keywords" value="hi;name;buy;sell;food;" />
        <parameter key="keyword_reply1" value="Welcome, welcome! Have a seat! If you like a drink or something to eat, just ask me for a {trade}!" />



         <parameter key="keyword_reply2" value="Welcome, welcome! Have a seat! If you like a drink or something to eat, just ask me for a {trade}!" />       
<parameter key="keyword_reply3" value="Welcome, welcome! Have a seat! If you like a drink or something to eat, just ask me for a {trade}!" />      
<parameter key="keyword_reply4" value="Welcome, welcome! Have a seat! If you like a drink or something to eat, just ask me for a {trade}!" />      
<parameter key="keyword_reply5" value="Welcome, welcome! Have a seat! If you like a drink or something to eat, just ask me for a {trade}!" />   

  
    </parameters>
</npc>


thanks no errors now, but he is still not selling me, just like at the beginning :(
i click buy and nothing happens
Vf-c-TN.png


bump? :S

bump :(
 
Last edited by a moderator:
You need to change this
Lua:
shopModule:addBuyableItem({'Raikou Scroll'}, 21712, 100000000, 1,'Raikou Scroll')
to this
Lua:
shopModule:addBuyableItem({'Raikou Scroll'}, 21712, 100000000,'Raikou Scroll')

do you understand? if not lemme explain, you are adding an extra field (maybe you think that ways is how count works), so remove it and done.

as you can see on modules.lua
Lua:
function ShopModule:addBuyableItem(names, itemid, cost, itemSubType, realName)
if itemSubType == nil then itemSubType = 1 end

that field is for subtype
 
You need to change this
Lua:
shopModule:addBuyableItem({'Raikou Scroll'}, 21712, 100000000, 1,'Raikou Scroll')
to this
Lua:
shopModule:addBuyableItem({'Raikou Scroll'}, 21712, 100000000,'Raikou Scroll')

do you understand? if not lemme explain, you are adding an extra field (maybe you think that ways is how count works), so remove it and done.

as you can see on modules.lua
Lua:
function ShopModule:addBuyableItem(names, itemid, cost, itemSubType, realName)
if itemSubType == nil then itemSubType = 1 end

that field is for subtype
but check the first post, the main post, the npc file i had at the start was just like you just said D:
 
You need to change this
Lua:
shopModule:addBuyableItem({'Raikou Scroll'}, 21712, 100000000, 1,'Raikou Scroll')
to this
Lua:
shopModule:addBuyableItem({'Raikou Scroll'}, 21712, 100000000,'Raikou Scroll')

do you understand? if not lemme explain, you are adding an extra field (maybe you think that ways is how count works), so remove it and done.

as you can see on modules.lua
Lua:
function ShopModule:addBuyableItem(names, itemid, cost, itemSubType, realName)
if itemSubType == nil then itemSubType = 1 end

that field is for subtype
hello man i did what you asked but the npc still doesn't give you the item even if u have the money and no error in the console. by the way this is the only npc that is not selling things :S all my other npcs works

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({'Raikou Scroll'}, 21712, 100000000,'Raikou Scroll')
shopModule:addBuyableItem({'Suicune Scroll'}, 21709, 100000000,'Suicune Scroll')
shopModule:addBuyableItem({'Fire War Horse Scroll'}, 21708, 100000000,'Fire War Horse Scroll')
shopModule:addBuyableItem({'Blazebringer Scroll'}, 21707, 100000000,'Blazebringer Scroll')
shopModule:addBuyableItem({'Uniwheel Scroll'}, 21706, 100000000,'Uniwheel Scroll')
shopModule:addBuyableItem({'Mechanical Bird Scroll'}, 21704, 100000000,'Mechanical Bird Scroll')
shopModule:addBuyableItem({'Tauros Scroll'}, 21699, 100000000,'Tauros Scroll')
shopModule:addBuyableItem({'Entei Scroll'}, 21694, 100000000,'Entei Scroll')
shopModule:addBuyableItem({'Arcanine Scroll'}, 21717, 100000000,'Arcanine Scroll')
shopModule:addBuyableItem({'Shiny Arcanine Scroll'}, 21718, 100000000,'Shiny Arcanine Scroll')
shopModule:addBuyableItem({'Kinto Scroll'}, 21722, 100000000,'Kinto Scroll')
npcHandler:addModule(FocusModule:new())
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
what you mean? in the same file there are some xml lines, those are for the xml npc script and before that there's the lua part, that goes inside the poke.lua file or whatever you call it
 
what you mean? in the same file there are some xml lines, those are for the xml npc script and before that there's the lua part, that goes inside the poke.lua file or whatever you call it
oh right hehe
ok i tried it and the same, no error in console, it shows the item when say trade, but he doesn't give the item to you :/
 
Back
Top