• 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 7.6 - Buying without the 'buy' keyword.

Yes. Thank you very much for your response. I tried removing this and here it is what happened:

this works:
shopModule:addSellableItem({'shovel'}, 1987, 20, 'shovel')
shopModule:addBuyableItem({'shovel'}, 1987, 20, 'shovel')
this doesn't work (sellable must be upper)
shopModule:addBuyableItem({'shovel'}, 1987, 20, 'shovel')
shopModule:addSellableItem({'shovel'}, 1987, 20, 'shovel')

AND IN .XML (<parameter key="module_shop" value="1"/>) this trick doesn't work totally.


i have 300 NPC's, half with shop in module_shop and half in lua
 
this maybe help you grow an idea..

You: hand axe!
NPC: Would you like to buy an axe for 7 gold?

Reason?
Npc selling list: [axe, hand axe, barbarian axe]
When you say axe, the "list" is readed from right to left.. looking for the first match.. so it doesn't matter what you say together with axe, the first item in the list is a match to one of your words, which means it stops at that item.
Switch the list around to: [hand axe, barbarian axe, axe]
and it will turn out this:

You: hand axe!
NPC: Would you like to buy a hand axe for 15 gold?


So about buy/sell, it's still the match thing about lists..
You must put all sell stuffs, before the buy ones..
Because if you do, you must have the word "sell" in the word, to get a match on the NPC's buylist..
if you remove the sell part, it will pass the Npc buylist because there's no match at all, and continue to the npc's sell list..

Hope you understand me.. all you say/do, will have it's way looking for the first match, no matter what, it will pick the first match it find from right to left.
 
Thank you for your response. As i said before in .lua file your system WORKS:

shopModule:addSellableItem({'asd'}, 2457, 1, 'asd')
shopModule:addBuyableItem({'asd'}, 2457, 1, 'asd')


BUT in .xml file it doesn't.


Code:
    <parameter key="module_shop" value="1"/>
        <parameter key="message_greet" value="Hello |PLAYERNAME|. I buy swords, clubs, axes, helmets, boots, legs, shields and armors."/>
<parameter key="shop_buyable" value="boh,2195,2;"/>
<parameter key="shop_sellable" value="boh,2195,2;"/>
      
    </parameters>

It's strange.

edit.
and yes, i tried switching <parameter key="shop_buyable" value="boh,2195,2;"/> with this <parameter key="shop_sellable" value="boh,2195,2;"/>
 
Last edited:
Back
Top