Hello there!
Im using this code for my server, but is there any possible way you can change so you can buy more than 1 backpack at the time, instead of bp mfs you can say 2 bp mfs?
Using OTX based TFS eninge. Most of simple scripts works as on TFS.
Im using this code for my server, but is there any possible way you can change so you can buy more than 1 backpack at the time, instead of bp mfs you can say 2 bp mfs?
Using OTX based TFS eninge. Most of simple scripts works as on TFS.
Code:
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 blanks') or msgcontains(msg, 'bp of blanks') or msgcontains(msg, 'bp blank') then
npcHandler:say('Do you want to buy a backpack of blank runes for 200 gold coins?')
talk_state = 1
elseif msgcontains(msg, 'yes') and talk_state == 1 then
if getPlayerMoney(cid) >= 200 then
blue_bp = doPlayerAddItem(cid, 1999, 1)
doAddContainerItem(blue_bp, 2260, 1)
doAddContainerItem(blue_bp, 2260, 1)
doAddContainerItem(blue_bp, 2260, 1)
doAddContainerItem(blue_bp, 2260, 1)
doAddContainerItem(blue_bp, 2260, 1)
doAddContainerItem(blue_bp, 2260, 1)
doAddContainerItem(blue_bp, 2260, 1)
doAddContainerItem(blue_bp, 2260, 1)
doAddContainerItem(blue_bp, 2260, 1)
doAddContainerItem(blue_bp, 2260, 1)
doAddContainerItem(blue_bp, 2260, 1)
doAddContainerItem(blue_bp, 2260, 1)
doAddContainerItem(blue_bp, 2260, 1)
doAddContainerItem(blue_bp, 2260, 1)
doAddContainerItem(blue_bp, 2260, 1)
doAddContainerItem(blue_bp, 2260, 1)
doAddContainerItem(blue_bp, 2260, 1)
doAddContainerItem(blue_bp, 2260, 1)
doAddContainerItem(blue_bp, 2260, 1)
doAddContainerItem(blue_bp, 2260, 1)
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 mf') or msgcontains(msg, 'bp manafluid') or msgcontains(msg, 'bp mana fluid') then
npcHandler:say('Do you want to buy a backpack of mana fluids 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
local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)
-- Empty Vial
shopModule:addSellableItem({'empty', 'vial'}, 2006, 5, 'vial')
-- Spell Book
shopModule:addBuyableItem({'spellbook'}, 2175, 150, 'spellbook')
-- Fluids
shopModule:addBuyableItem({'life fluid','lifefluid'}, 2006, 60,10,'life fluid')
shopModule:addBuyableItem({'mana fluid','manafluid'},2006,55,7,'mana fluid')
-- Runas
--shopModule:addBuyableItem({'intense healing rune', 'ih'}, 2265, 95, 1, 'intense healing rune')
--shopModule:addBuyableItem({'ultimate healing rune', 'uh'}, 2273, 125, 1, 'ultimate healing rune')
--shopModule:addBuyableItem({'magic wall rune'}, 2293, 200, 3, 'magic wall rune')
--shopModule:addBuyableItem({'destroy field rune'}, 2261, 45, 3, 'destroy field rune')
--shopModule:addBuyableItem({'light magic missile rune'}, 2287, 40, 10, 'light magic missile rune')
--shopModule:addBuyableItem({'heavy magic missile rune', 'hmm'}, 2311, 50, 5, 'heavy magic missile rune')
--shopModule:addBuyableItem({'great fireball rune', 'gfb'}, 2304, 100, 4, 'great fireball rune')
--shopModule:addBuyableItem({'explosion rune', 'explosion'}, 2313, 150, 3, 'explosion rune')
--shopModule:addBuyableItem({'sudden death rune', 'sd'}, 2268, 225, 1, 'sudden death rune')
--shopModule:addBuyableItem({'death arrow rune'}, 2263, 300, 3, 'death arrow rune')
--shopModule:addBuyableItem({'animate dead rune'}, 2316, 375, 1, 'animate dead rune')
--shopModule:addBuyableItem({'convince creature rune'}, 2290, 80, 1, 'convince creature rune')
--shopModule:addBuyableItem({'chameleon rune'}, 2291, 210, 1, 'chameleon rune')
--shopModule:addBuyableItem({'desintegrate'}, 2310, 80, 3, 'desintegreate rune')
--shopModule:addBuyableItem({'blank', 'rune'},2260, 10,'blank rune')
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Last edited: