• 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's problem

Faraonekkk

New Member
Joined
Feb 15, 2010
Messages
686
Reaction score
4
the problem is
me: hi
npc: hiho
me: sell mace
npc: error in console
data/npc/scripts/lib/npcsystem/modules.lua attempt to call global 'GetItemPlural' <a nil value>

my ItemPlural in modules.lua


if(parameters.eventType == SHOPMODULE_SELL_ITEM) then
local msg = module.npcHandler:getMessage(MESSAGE_SELL)
msg = module.npcHandler:parseMessage(msg, parseInfo)
if(module.amount>1) then
module.npcHandler:say(' Do you want to sell ' .. module.amount .. ' ' .. GetItemPlural(getItemIdByName(tmpName)) .. ' for ' .. parameters.cost*module.amount .. ' gold coins?')
elseif tmpName:sub(1,1):upper() == "e" or tmpName:sub(1,1):lower() == "y" or tmpName:sub(1,1):lower() == "u" or tmpName:sub(1,1):lower() == "i" or tmpName:sub(1,1):lower() == "o" or tmpName:sub(1,1):lower() == "a" then
module.npcHandler:say(' Do you want to sell an ' .. tmpName .. ' for ' .. parameters.cost*module.amount .. ' gold coins?')
elseif GetItemPlural(getItemIdByName(tmpName)) == tmpName then
module.npcHandler:say(' Do you want to sell ' .. tmpName .. ' for ' .. parameters.cost*module.amount .. ' gold coins? ')
else
module.npcHandler:say(' Do you want to sell a ' .. tmpName .. ' for ' .. parameters.cost*module.amount .. ' gold coins?')
end
elseif(parameters.eventType == SHOPMODULE_BUY_ITEM) then
local msg = module.npcHandler:getMessage(MESSAGE_BUY)
msg = module.npcHandler:parseMessage(msg, parseInfo)
if(module.amount>1) then
module.npcHandler:say(' Do you want to buy ' .. module.amount .. ' ' .. GetItemPlural(getItemIdByName(tmpName)) .. ' for ' .. parameters.cost*module.amount .. ' gold coins?')
elseif tmpName:sub(1,1):upper() == "e" or tmpName:sub(1,1):lower() == "y" or tmpName:sub(1,1):lower() == "u" or tmpName:sub(1,1):lower() == "i" or tmpName:sub(1,1):lower() == "o" or tmpName:sub(1,1):lower() == "a" then
module.npcHandler:say(' Do you want to buy an ' .. tmpName .. ' for ' .. parameters.cost*module.amount .. ' gold coins?')
elseif GetItemPlural(getItemIdByName(tmpName)) == tmpName then
module.npcHandler:say(' Do you want to buy ' .. GetItemPlural(getItemIdByName(tmpName)) .. ' for ' .. parameters.cost*module.amount .. ' gold coins? ')
else
module.npcHandler:say(' Do you want to buy a ' .. tmpName .. ' for ' .. parameters.cost*module.amount .. ' gold coins?')

If i put in GetItemPlural GetCount or GetItemName everything is okay but its not reading "Sellable shop" ;/

its making me crazy i am tired of this.
 
Last edited:
i see more now
i puted into my npc functions

function getItemPluralNameById(itemid)
return GetItemDescriptions(itemid).plural
end

but i have error in console with this line:

return GetItemDescriptions(itemid).plural
attempt to call global 'GetItemDescriptions' <a nil value>

also checked sources there is something like "GetItemDescriptions" function
 
compiled function
getItemDescriptionsById
, also added it to npc functions and its workin BUT i can only buy items its not getting if i write SELL. ;/

sellable items is in XML and buyable in script .lua (NOTE: engine is for 7.6- version )

atm for sure i need compile to check sell from xml any idea?
 
Last edited:
Back
Top