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

Avesta 7.6 | 100x charges runes variable

Maximiko

New Member
Joined
Aug 2, 2007
Messages
9
Reaction score
0
Hi again, i'm looking for a way for npc runes to sell the number of charges the player wants (from 1x to 100x).
Something like this:
Code:
    elseif msgcontains(msg, 'great fireball') or msgcontains(msg, 'gfb') and ShopModule:getCount(msg) <= 100 then
        charges = ShopModule:getCount(msg)
        price = 90*charges
        selfSay('Do you want a great fireball rune with '..charges..' charges for '..price..' gold coins?')
        talk_state = 1
        itemid = 2304
But it does not work, I use OTServ_SVN 0.6.3 by Notthingster, thanks a lot.
 
Last edited:
Solution
I don't know how to do this script fully, because this need arrays, and Im not good with it.
But here is my idea:
Code:
if msgcontains(msg, '1') and msgcontains(msg, 'gfb') then
    talkstate = 1
    npcHandler:say("Do you wand to buy a great firball rune with "..charges.." charges for 30gp?")
elseif talk_state == 1 and msgcontains(msg, 'yes') then
    doPlayerAddItem(cid,2304,1)
    doPlayerRemoveMoney(cid,30)
end
If someone know how to make one array for this part: if msgcontains(msg, '1') and one variable to mutiply the charge cost.
Maybe Im wrong, newb scripter hajaja
I don't know how to do this script fully, because this need arrays, and Im not good with it.
But here is my idea:
Code:
if msgcontains(msg, '1') and msgcontains(msg, 'gfb') then
    talkstate = 1
    npcHandler:say("Do you wand to buy a great firball rune with "..charges.." charges for 30gp?")
elseif talk_state == 1 and msgcontains(msg, 'yes') then
    doPlayerAddItem(cid,2304,1)
    doPlayerRemoveMoney(cid,30)
end
If someone know how to make one array for this part: if msgcontains(msg, '1') and one variable to mutiply the charge cost.
Maybe Im wrong, newb scripter hajaja
 
Solution
if (msgcontains(msg, 'intense healing') or msgcontains(msg, 'ih')) and ShopModule:getCount(msg) <= 100 then
charges = ShopModule:getCount(msg)
price = 95*charges
itemid = 2265
selfSay('Do you want an intense healing rune with '..charges..' charges for '..price..' gold coins?')
talk_state = 1

So it works, a question @massuco Would you know to add some kind of remove frag to this server?
 
Good afternoon friend, could you help me, I can not solve it I am using otx v 2.1 lua 5.1 tibia 7.6

XML:
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 shopModule = ShopModule:new()
npcHandler:addModule(shopModule)

shopModule:addBuyableItem({'light wand', 'lightwand'},         2163, 500,         'magic light wand')
shopModule:addBuyableItem({'mana fluid', 'manafluid'},         2006, 55,     7,     'mana fluid')
shopModule:addBuyableItem({'life fluid', 'lifefluid'},         2006, 50,     10,    'life fluid')
shopModule:addBuyableItem({'blank'},                 2260, 10,         'blank rune')
shopModule:addBuyableItem({'mana rune', 'mr'}, 2267, 1750, 10, 'ultimate mana rune')


shopModule:addBuyableItem({'wand of inferno', 'inferno'},                 2187, 15000,     'wand of inferno')
shopModule:addBuyableItem({'wand of plague', 'plague'},                 2188, 5000,     'wand of plague')
shopModule:addBuyableItem({'wand of cosmic energy', 'cosmic energy'},             2189, 10000,    'wand of cosmic energy')
shopModule:addBuyableItem({'wand of vortex', 'vortex'},                 2190, 500,     'wand of vortex')
shopModule:addBuyableItem({'wand of dragonbreath', 'dragonbreath'},             2191, 1000,     'wand of dragonbreath')

shopModule:addBuyableItem({'quagmire rod', 'quagmire'},                 2181, 10000,     'quagmire rod')
shopModule:addBuyableItem({'snakebite rod', 'snakebite'},                 2182, 500,     'snakebite rod')
shopModule:addBuyableItem({'tempest rod', 'tempest'},                     2183, 15000,     'tempest rod')
shopModule:addBuyableItem({'volcanic rod', 'volcanic'},                 2185, 5000,     'volcanic rod')
shopModule:addBuyableItem({'moonlight rod', 'moonlight'},                 2186, 1000,       'moonlight rod')

function creatureSayCallback(cid, type, msg)
    if(npcHandler.focus ~= cid) then
        return FALSE
    end
if (msgcontains(msg, 'intense healing') or msgcontains(msg, 'ih')) and ShopModule:getCount(msg) <= 100 then
charges = ShopModule:getCount(msg)
price = 95*charges
itemid = 2265
selfSay('Do you want an intense healing rune with '..charges..' charges for '..price..' gold coins?')
talk_state = 1
    elseif msgcontains(msg, 'yes') and talk_state == 1 then
        if doPlayerRemoveMoney(cid, price) == TRUE then
            doPlayerGiveItem(cid, itemid, 1, charges)
            selfSay("You have bought this rune.")
            talk_state = 0
        else
            selfSay("You don't have enough money.")
            talk_state = 0
        end
    elseif msgcontains(msg, 'no') and talk_state == 1 then
        selfSay("Then not.")
        talk_state = 0
    end
    return TRUE
end

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