Nutaharion
New Member
Goto 3th replay to help in this subject 
Last edited:
<?xml version="1.0"?>
<npc name="Heroid" walkinterval="3000" floorchange="0">
<health now="100" max="100"/>
<look type="128" head="79" body="0" legs="40" feet="94" addons="1"/>
<interaction range="4" idletime="30" idleinterval="3000" defaultpublic="0">
<!--This will include the bankman interaction, in this way several npc can use the same interaction-->
<include file="npcrook.xml"/>
<interact keywords="hi" focus="1">
<!--These are the alternative keywords-->
<keywords>hello</keywords>
<response text="Hi |NAME|. I have some types of food for sale. Say {trade} if you are interested."/>
</interact>
<interact keywords="bye" focus="0">
<!--These are the alternative keywords-->
<keywords>farewell</keywords>
<response text="Good bye |NAME|, and please visit me again later!"/>
</interact>
<interact event="onPlayerLeave" focus="0">
<response text="People are so rude!"/>
</interact>
<interact keywords="trade">
<list>food</list>
<response>
<action name="script">
<![CDATA[
openShopWindow(cid, itemlist, -1, -1)
]]>
</action>
</response>
</interact>
<interact event="onPlayerShopBuy">
<response>
<action name="price" value="|BUYPRICE|"/>
<action name="script">
<![CDATA[
if(getPlayerMoney(cid) >= _state.amount * _state.price) then
local count
for count=0, _state.amount-1 do
local result = doPlayerAddItem(cid, _state.itemid, _state.subtype, 0)
if(result == -1) then
if(count == 0) then
selfSay("You need more free slots in your backpack to buy it!", cid)
return
else
selfSay("I've sold some for you, but it seems you can't carry more than this. I won't take more money than necessary.", cid)
doPlayerRemoveMoney(cid, count * _state.price)
return
end
end
end
selfSay("Here you are.", cid)
doPlayerRemoveMoney(cid, _state.price * _state.amount)
else
selfSay("Sorry, you do not have enough gold.", cid)
end
]]>
</action>
</response>
</interact>
<interact event="onPlayerShopSell">
<response>
<action name="price" value="|SELLPRICE|"/>
<action name="script">
<![CDATA[
if(doPlayerRemoveItem(cid, _state.itemid, _state.amount, _state.subtype) == TRUE) then
doPlayerAddMoney(cid, _state.price * _state.amount)
selfSay("Thanks for this item.", cid)
else
selfSay("Sorry, you do not have one.", cid)
end
]]>
</action>
</response>
</interact>
</interaction>
</npc>
<?xml version="1.0"?>
<interaction>
<itemlist listid="equipment">
<item keywords="pick" id="2553" buyprice="50" name="pick"/>
<item keywords="shovel" id="2554" buyprice="20" name="shovel"/>
<item keywords="rope" id="2120" buyprice="20" sellprice="8" name="rope"/>
<item keywords="backpack" id="1988" buyprice="20" name="backpack"/>
<item keywords="bag" id="1987" buyprice="8" name="bag"/>
</itemlist>
<itemlist listid="food">
<item keywords="blueberry" id="2677" sellprice="1" name="blueberry" pname="blueberries"/>
<item keywords="bread" id="2689" buyprice="4" sellprice="1" name="bread"/>
<item keywords="carrot" id="2684" sellprice="1" name="carrot" pname="carrots"/>
<item keywords="cheese" id="2696" buyprice="5" sellprice="2" name="cheese" pname="cheeses"/>
<item keywords="cherry" id="2679" sellprice="1" name="cherry" pname="cherries"/>
<item keywords="egg" id="2695" buyprice="2" name="egg" pname="eggs"/>
<item keywords="fish" id="2667" buyprice="6" name="fish"/>
<item keywords="roll" id="2690" buyprice="2" name="roll" pname="rolls"/>
</itemlist>
</interaction>
openShopWindow(cid, itemlist, -1, -1)
change to
openShopWindow(cid, itemlist, -1, 1)
Copy script from another seller if it's continious you must repair or fix sources.