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) npcHandlernCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandlernCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandlernCreatureSay(cid, type, msg) end
function onThink() npcHandlernThink() 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())
SCRIPT:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
-- OTServ event handling functions start
function onCreatureAppear(cid) npcHandlernCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandlernCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandlernCreatureSay(cid, type, msg) end
function onThink() npcHandlernThink() 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())