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

BUG ON NPC

Igor Milagres

Member
Joined
May 12, 2018
Messages
63
Reaction score
16
good night, I would like help, I would like to put the npc xodet script (rune vendor) to sell bps of manafluids, but I can only put it to sell bp of blank runes, follow the script.lua, thanks since now who can help -me.


SCRIPT:

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

-- OTServ event handling functions start
function onCreatureAppear(cid) npcHandler:eek:nCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:eek:nCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:eek:nCreatureSay(cid, type, msg) end
function onThink() npcHandler:eek:nThink() end
-- OTServ event handling functions end

function creatureSayCallback(cid, type, msg)
if not npcHandler:isFocused(cid) then
return false
end


if msgcontains(msg, 'bp of lf') or msgcontains(msg, 'bp of life fluid') or msgcontains(msg, 'bp lf') then
npcHandler:say('Do you want to buy a backpack of life fluid for 1200 gold coins?')
talk_state = 5

elseif msgcontains(msg, 'yes') and talk_state == 5 then
if getPlayerMoney(cid) >= 1200 then
red_bp = doPlayerAddItem(cid, 2000, 1)
doAddContainerItem(red_bp, 2006, 10)
doAddContainerItem(red_bp, 2006, 10)
doAddContainerItem(red_bp, 2006, 10)
doAddContainerItem(red_bp, 2006, 10)
doAddContainerItem(red_bp, 2006, 10)
doAddContainerItem(red_bp, 2006, 10)
doAddContainerItem(red_bp, 2006, 10)
doAddContainerItem(red_bp, 2006, 10)
doAddContainerItem(red_bp, 2006, 10)
doAddContainerItem(red_bp, 2006, 10)
doAddContainerItem(red_bp, 2006, 10)
doAddContainerItem(red_bp, 2006, 10)
doAddContainerItem(red_bp, 2006, 10)
doAddContainerItem(red_bp, 2006, 10)
doAddContainerItem(red_bp, 2006, 10)
doAddContainerItem(red_bp, 2006, 10)
doAddContainerItem(red_bp, 2006, 10)
doAddContainerItem(red_bp, 2006, 10)
doAddContainerItem(red_bp, 2006, 10)
doAddContainerItem(red_bp, 2006, 10)
doPlayerRemoveMoney(cid, 1200)
npcHandler:say('Thank you for buying.')
talk_state = 0
else
npcHandler:say('You don\'t have enough money.')
talk_state = 0
end
end


if msgcontains(msg, 'bp of br') or msgcontains(msg, 'bp of blankrune') or msgcontains(msg, 'bp br') then
npcHandler:say('Do you want to buy a backpack of blank runes for 200 gold coins?')
talk_state = 6

elseif msgcontains(msg, 'yes') and talk_state == 6 then
if getPlayerMoney(cid) >= 200 then
grey_bp = doPlayerAddItem(cid, 2003, 1)
doAddContainerItem(grey_bp, 2260)
doAddContainerItem(grey_bp, 2260)
doAddContainerItem(grey_bp, 2260)
doAddContainerItem(grey_bp, 2260)
doAddContainerItem(grey_bp, 2260)
doAddContainerItem(grey_bp, 2260)
doAddContainerItem(grey_bp, 2260)
doAddContainerItem(grey_bp, 2260)
doAddContainerItem(grey_bp, 2260)
doAddContainerItem(grey_bp, 2260)
doAddContainerItem(grey_bp, 2260)
doAddContainerItem(grey_bp, 2260)
doAddContainerItem(grey_bp, 2260)
doAddContainerItem(grey_bp, 2260)
doAddContainerItem(grey_bp, 2260)
doAddContainerItem(grey_bp, 2260)
doAddContainerItem(grey_bp, 2260)
doAddContainerItem(grey_bp, 2260)
doAddContainerItem(grey_bp, 2260)
doAddContainerItem(grey_bp, 2260)
doPlayerRemoveMoney(cid, 200)
npcHandler:say('Thank you for buying.')
talk_state = 0
else
npcHandler:say('You don\'t have enough money.')
talk_state = 0
end
end


if msgcontains(msg, 'bp of mf') or msgcontains(msg, 'bp of manafluid') or msgcontains(msg, 'bp mf') then
npcHandler:say('Do you want to buy a backpack of manafluid for 2000 gold coins?')
talk_state = 6

elseif msgcontains(msg, 'yes') and talk_state == 6 then
if getPlayerMoney(cid) >= 2000 then
purple_bp = doPlayerAddItem(cid, 2001, 1)
doAddContainerItem(purple_bp, 2006, 7)
doAddContainerItem(purple_bp, 2006, 7)
doAddContainerItem(purple_bp, 2006, 7)
doAddContainerItem(purple_bp, 2006, 7)
doAddContainerItem(purple_bp, 2006, 7)
doAddContainerItem(purple_bp, 2006, 7)
doAddContainerItem(purple_bp, 2006, 7)
doAddContainerItem(purple_bp, 2006, 7)
doAddContainerItem(purple_bp, 2006, 7)
doAddContainerItem(purple_bp, 2006, 7)
doAddContainerItem(purple_bp, 2006, 7)
doAddContainerItem(purple_bp, 2006, 7)
doAddContainerItem(purple_bp, 2006, 7)
doAddContainerItem(purple_bp, 2006, 7)
doAddContainerItem(purple_bp, 2006, 7)
doAddContainerItem(purple_bp, 2006, 7)
doAddContainerItem(purple_bp, 2006, 7)
doAddContainerItem(purple_bp, 2006, 7)
doAddContainerItem(purple_bp, 2006, 7)
doAddContainerItem(purple_bp, 2006, 7)
doPlayerRemoveMoney(cid, 2000)
npcHandler:say('Thank you for buying.')
talk_state = 0
else
npcHandler:say('You don\'t have enough money.')
talk_state = 0
end
end

return TRUE
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
good night, I would like help, I would like to put the npc xodet script (rune vendor) to sell bps of manafluids, but I can only put it to sell bp of blank runes, follow the script.lua, thanks since now who can help -me.


SCRIPT:

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

-- OTServ event handling functions start
function onCreatureAppear(cid) npcHandler:eek:nCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:eek:nCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:eek:nCreatureSay(cid, type, msg) end
function onThink() npcHandler:eek:nThink() end
-- OTServ event handling functions end

function creatureSayCallback(cid, type, msg)
if not npcHandler:isFocused(cid) then
return false
end


if msgcontains(msg, 'bp of lf') or msgcontains(msg, 'bp of life fluid') or msgcontains(msg, 'bp lf') then
npcHandler:say('Do you want to buy a backpack of life fluid for 1200 gold coins?')
talk_state = 5

elseif msgcontains(msg, 'yes') and talk_state == 5 then
if getPlayerMoney(cid) >= 1200 then
red_bp = doPlayerAddItem(cid, 2000, 1)
doAddContainerItem(red_bp, 2006, 10)
doAddContainerItem(red_bp, 2006, 10)
doAddContainerItem(red_bp, 2006, 10)
doAddContainerItem(red_bp, 2006, 10)
doAddContainerItem(red_bp, 2006, 10)
doAddContainerItem(red_bp, 2006, 10)
doAddContainerItem(red_bp, 2006, 10)
doAddContainerItem(red_bp, 2006, 10)
doAddContainerItem(red_bp, 2006, 10)
doAddContainerItem(red_bp, 2006, 10)
doAddContainerItem(red_bp, 2006, 10)
doAddContainerItem(red_bp, 2006, 10)
doAddContainerItem(red_bp, 2006, 10)
doAddContainerItem(red_bp, 2006, 10)
doAddContainerItem(red_bp, 2006, 10)
doAddContainerItem(red_bp, 2006, 10)
doAddContainerItem(red_bp, 2006, 10)
doAddContainerItem(red_bp, 2006, 10)
doAddContainerItem(red_bp, 2006, 10)
doAddContainerItem(red_bp, 2006, 10)
doPlayerRemoveMoney(cid, 1200)
npcHandler:say('Thank you for buying.')
talk_state = 0
else
npcHandler:say('You don\'t have enough money.')
talk_state = 0
end
end


if msgcontains(msg, 'bp of br') or msgcontains(msg, 'bp of blankrune') or msgcontains(msg, 'bp br') then
npcHandler:say('Do you want to buy a backpack of blank runes for 200 gold coins?')
talk_state = 6

elseif msgcontains(msg, 'yes') and talk_state == 6 then
if getPlayerMoney(cid) >= 200 then
grey_bp = doPlayerAddItem(cid, 2003, 1)
doAddContainerItem(grey_bp, 2260)
doAddContainerItem(grey_bp, 2260)
doAddContainerItem(grey_bp, 2260)
doAddContainerItem(grey_bp, 2260)
doAddContainerItem(grey_bp, 2260)
doAddContainerItem(grey_bp, 2260)
doAddContainerItem(grey_bp, 2260)
doAddContainerItem(grey_bp, 2260)
doAddContainerItem(grey_bp, 2260)
doAddContainerItem(grey_bp, 2260)
doAddContainerItem(grey_bp, 2260)
doAddContainerItem(grey_bp, 2260)
doAddContainerItem(grey_bp, 2260)
doAddContainerItem(grey_bp, 2260)
doAddContainerItem(grey_bp, 2260)
doAddContainerItem(grey_bp, 2260)
doAddContainerItem(grey_bp, 2260)
doAddContainerItem(grey_bp, 2260)
doAddContainerItem(grey_bp, 2260)
doAddContainerItem(grey_bp, 2260)
doPlayerRemoveMoney(cid, 200)
npcHandler:say('Thank you for buying.')
talk_state = 0
else
npcHandler:say('You don\'t have enough money.')
talk_state = 0
end
end


if msgcontains(msg, 'bp of mf') or msgcontains(msg, 'bp of manafluid') or msgcontains(msg, 'bp mf') then
npcHandler:say('Do you want to buy a backpack of manafluid for 2000 gold coins?')
talk_state = 6

elseif msgcontains(msg, 'yes') and talk_state == 6 then
if getPlayerMoney(cid) >= 2000 then
purple_bp = doPlayerAddItem(cid, 2001, 1)
doAddContainerItem(purple_bp, 2006, 7)
doAddContainerItem(purple_bp, 2006, 7)
doAddContainerItem(purple_bp, 2006, 7)
doAddContainerItem(purple_bp, 2006, 7)
doAddContainerItem(purple_bp, 2006, 7)
doAddContainerItem(purple_bp, 2006, 7)
doAddContainerItem(purple_bp, 2006, 7)
doAddContainerItem(purple_bp, 2006, 7)
doAddContainerItem(purple_bp, 2006, 7)
doAddContainerItem(purple_bp, 2006, 7)
doAddContainerItem(purple_bp, 2006, 7)
doAddContainerItem(purple_bp, 2006, 7)
doAddContainerItem(purple_bp, 2006, 7)
doAddContainerItem(purple_bp, 2006, 7)
doAddContainerItem(purple_bp, 2006, 7)
doAddContainerItem(purple_bp, 2006, 7)
doAddContainerItem(purple_bp, 2006, 7)
doAddContainerItem(purple_bp, 2006, 7)
doAddContainerItem(purple_bp, 2006, 7)
doAddContainerItem(purple_bp, 2006, 7)
doPlayerRemoveMoney(cid, 2000)
npcHandler:say('Thank you for buying.')
talk_state = 0
else
npcHandler:say('You don\'t have enough money.')
talk_state = 0
end
end

return TRUE
end

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

TFS Version?

ID: 2006 is not stackable in TFS 1.0

Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

-- OTServ event handling functions start
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
-- OTServ event handling functions end

function creatureSayCallback(cid, type, msg)
    if not npcHandler:isFocused(cid) then
        return false
    end

    if msgcontains(msg, 'bp of lf') or msgcontains(msg, 'bp of life fluid') or msgcontains(msg, 'bp lf') then
        npcHandler:say('Do you want to buy a backpack of life fluid for 1200 gold coins?', cid)
        talk_state = 5

    elseif msgcontains(msg, 'yes') and talk_state == 5 then
        if getPlayerMoney(cid) >= 1200 then
            local red_bp = doPlayerAddItem(cid, 2000, 1)
            doAddContainerItem(red_bp, 2006, 10)
            doAddContainerItem(red_bp, 2006, 10)
            doAddContainerItem(red_bp, 2006, 10)
            doAddContainerItem(red_bp, 2006, 10)
            doAddContainerItem(red_bp, 2006, 10)
            doAddContainerItem(red_bp, 2006, 10)
            doAddContainerItem(red_bp, 2006, 10)
            doAddContainerItem(red_bp, 2006, 10)
            doAddContainerItem(red_bp, 2006, 10)
            doAddContainerItem(red_bp, 2006, 10)
            doAddContainerItem(red_bp, 2006, 10)
            doAddContainerItem(red_bp, 2006, 10)
            doAddContainerItem(red_bp, 2006, 10)
            doAddContainerItem(red_bp, 2006, 10)
            doAddContainerItem(red_bp, 2006, 10)
            doAddContainerItem(red_bp, 2006, 10)
            doAddContainerItem(red_bp, 2006, 10)
            doAddContainerItem(red_bp, 2006, 10)
            doAddContainerItem(red_bp, 2006, 10)
            doAddContainerItem(red_bp, 2006, 10)
            doPlayerRemoveMoney(cid, 1200)
            npcHandler:say('Thank you for buying.', cid)
            talk_state = 0
        else
            npcHandler:say('You don\'t have enough money.', cid)
            talk_state = 0
        end
    end


    if msgcontains(msg, 'bp of br') or msgcontains(msg, 'bp of blankrune') or msgcontains(msg, 'bp br') then
        npcHandler:say('Do you want to buy a backpack of blank runes for 200 gold coins?', cid)
        talk_state = 6

    elseif msgcontains(msg, 'yes') and talk_state == 6 then
        if getPlayerMoney(cid) >= 200 then
            local grey_bp = doPlayerAddItem(cid, 2003, 1)
            doAddContainerItem(grey_bp, 2260)
            doAddContainerItem(grey_bp, 2260)
            doAddContainerItem(grey_bp, 2260)
            doAddContainerItem(grey_bp, 2260)
            doAddContainerItem(grey_bp, 2260)
            doAddContainerItem(grey_bp, 2260)
            doAddContainerItem(grey_bp, 2260)
            doAddContainerItem(grey_bp, 2260)
            doAddContainerItem(grey_bp, 2260)
            doAddContainerItem(grey_bp, 2260)
            doAddContainerItem(grey_bp, 2260)
            doAddContainerItem(grey_bp, 2260)
            doAddContainerItem(grey_bp, 2260)
            doAddContainerItem(grey_bp, 2260)
            doAddContainerItem(grey_bp, 2260)
            doAddContainerItem(grey_bp, 2260)
            doAddContainerItem(grey_bp, 2260)
            doAddContainerItem(grey_bp, 2260)
            doAddContainerItem(grey_bp, 2260)
            doAddContainerItem(grey_bp, 2260)
            doPlayerRemoveMoney(cid, 200)
            npcHandler:say('Thank you for buying.', cid)
            talk_state = 0
        else
            npcHandler:say('You don\'t have enough money.', cid)
            talk_state = 0
        end
    end


    if msgcontains(msg, 'bp of mf') or msgcontains(msg, 'bp of manafluid') or msgcontains(msg, 'bp mf') then
        npcHandler:say('Do you want to buy a backpack of manafluid for 2000 gold coins?', cid)
        talk_state = 7

    elseif msgcontains(msg, 'yes') and talk_state == 7 then
        if getPlayerMoney(cid) >= 2000 then
            local purple_bp = doPlayerAddItem(cid, 2001, 1)
            doAddContainerItem(purple_bp, 2006, 7)
            doAddContainerItem(purple_bp, 2006, 7)
            doAddContainerItem(purple_bp, 2006, 7)
            doAddContainerItem(purple_bp, 2006, 7)
            doAddContainerItem(purple_bp, 2006, 7)
            doAddContainerItem(purple_bp, 2006, 7)
            doAddContainerItem(purple_bp, 2006, 7)
            doAddContainerItem(purple_bp, 2006, 7)
            doAddContainerItem(purple_bp, 2006, 7)
            doAddContainerItem(purple_bp, 2006, 7)
            doAddContainerItem(purple_bp, 2006, 7)
            doAddContainerItem(purple_bp, 2006, 7)
            doAddContainerItem(purple_bp, 2006, 7)
            doAddContainerItem(purple_bp, 2006, 7)
            doAddContainerItem(purple_bp, 2006, 7)
            doAddContainerItem(purple_bp, 2006, 7)
            doAddContainerItem(purple_bp, 2006, 7)
            doAddContainerItem(purple_bp, 2006, 7)
            doAddContainerItem(purple_bp, 2006, 7)
            doAddContainerItem(purple_bp, 2006, 7)
            doPlayerRemoveMoney(cid, 2000)
            npcHandler:say('Thank you for buying.', cid)
            talk_state = 0
        else
            npcHandler:say('You don\'t have enough money.', cid)
            talk_state = 0
        end
    end

    return TRUE
end

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