• 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!

Npc to buy items using soul orbs

Then first you need to make soul orb set a value in items to amount of mony it's worth
Change xxx to how much you want it to be worth:)

<item id="2148" article="a" name="gold coin" plural="gold coins">
<attribute key="weight" value="10" />
<attribute key="worth" value="1" />
</item>

<item id="5944" article="a" name="soul orb" plural="soul orbs">
<attribute key="weight" value="20" />
<attribute key="worth" value="XXX" />

</item>
 
@Up: I think he just want a Npc that only sell stuff for soul orbs, not that the soul orbs are worth money :P

If its like I think, you should use a Npc trader like this one
data/npc/scripts/trader.lua
LUA:
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 tabla = {
      ["boots of haste"] = {10, 2195},
      ["demon helmet"] = {11, 2493},
      ["frozen starlight"] = {30, 2361},
      ["spellbook of dark mysteries"] = {20, 8918},
      ["royal crossbow"] = {20, 8851},
      ["stuffed dragon"] = {30, 5791},
      ["star tear"] = {100, 7735},
      ["jester staff"] = {100, 7958},
      ["vancini axe"] = {100, 8925},
      ["firewalker boots"] = {50, 9932},
      ["flame blade"] = {100, 8931}
      }
function creatureSayCallback(cid, type, msg)
local s = getPlayerItemCount
local msgn = "You dont have the neccesary soul orbs for this!"
if (msgcontains(msg, 'trade')) and s(cid,5944) == 0 then
  npcHandler:say('You dont have soul orbs', cid)

elseif msgcontains(msg, 'trade') and s(cid,5944) >= 1 then
      npcHandler:say('You can change your soul orbs for, {boots of haste}, {demon helmet}, {frozen starlight}, {spellbok of dark mysteries}, {royal crossbow} y {stuffed dragon} ... And with more than 30 soul orbs for, {star tear}, {jester staff}, {vancini axe}, {flame blade} y {firewalker boots}', cid)
end
for txt, v in pairs(tabla) do
      if msgcontains(msg, txt) then
        if doPlayerRemoveItem(cid,10581,v[1]) then
            doPlayerAddItem(cid,v[2],1)
            npcHandler:say("You got a ".. getItemNameById(v[2]) .."!", cid)
        else
            npcHandler:say("".. msgn .."", cid)
        end
      end
  end
return true
end
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

{30, 5791}
30 is the quantity of soul orbs
5791 is the itemID
 
Back
Top