
Nie tylko o Tibii i OTS...

Witam.Mam skrypt Malaka
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
local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)
shopModule:addBuyableItem({'light wand', 'lightwand'}, 2163, 500, 'magic light wand')
shopModule:addBuyableItem({'manapotion', 'manapotion'}, 7620, 100, 'mana potion')
shopModule:addBuyableItem({'healthpotion', 'healthpotion'}, 7618, 100, 'health potion')
shopModule:addBuyableItem({'strong mana potion', 'strong mana potion'}, 7589, 300, 'strong mana potion')
shopModule:addBuyableItem({'strong health potion', 'strong health potion'}, 7588, 300, 'strong health potion')
shopModule:addBuyableItem({'great mana potion', 'great mana potion'}, 7590, 500, 'great mana potion')
shopModule:addBuyableItem({'great health potion', 'great health potion'}, 7591, 500, 'great health potion')
shopModule:addBuyableItem({'heavy magic missile', 'hmm'}, 2311, 3000, 100, 'heavy magic missile rune')
shopModule:addBuyableItem({'great fireball', 'gfb'}, 2304, 1500, 100, 'great fireball rune')
shopModule:addBuyableItem({'explo', 'xpl'}, 2313, 2500, 100, 'explosion rune')
shopModule:addBuyableItem({'ultimate healing', 'uh'}, 2273, 4000, 100, 'ultimate healing rune')
shopModule:addBuyableItem({'sudden death', 'sd'}, 2268, 5000, 100, 'sudden death rune')
shopModule:addBuyableItem({'blank', 'rume'}, 2260, 1, 'blank rume')
shopModule:addBuyableItem({'manarune', 'mr'}, 2270, 10000, 100, 'manarune 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, 'explosion rune')
shopModule:addBuyableItem({'wand of vortex', 'vortex'}, 2190, 500, 'wand of cosmic energy')
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, 3000, 'volcanic rod')
shopModule:addBuyableItem({'moonlight rod', 'moonlight'}, 2186, 500, 'moonlight rod')
npcHandler:addModule(FocusModule:new())
Na skrypt tego typu
local focus = 0
local talk_start = 0
local target = 0
local following = false
local attacking = false
function onThingMove(creature, thing, oldpos, oldstackpos)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Good bye then.')
focus = 0
talk_start = 0
end
end
function onCreatureTurn(creature)
end
function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end
function onCreatureSay(cid, type, msg)
msg = string.lower(msg)
if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then
selfSay('Yo, ' .. creatureGetName(cid) .. '! Sprzedaje rope (50gp), backpacks (10gp), manafluids (100gp), bp manafluids (20k), aol (1cc).')
focus = cid
talk_start = os.clock()
elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Przepraszam, ' .. creatureGetName(cid) .. '! Rozmiawiam z toba juz minute.')
elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'shovel') then
buy(cid,2554,getCount(msg),25)
elseif msgcontains(msg, 'backpack') or msgcontains(msg, 'bp') then
buy(cid,1988,getCount(msg),10)
elseif msgcontains(msg, 'bp manafluids') then
buyContainer(cid, 2001, 2006, 7, 2000)
elseif msgcontains(msg, 'manafluid') or msgcontains(msg, 'mana fluid') then
buyFluidContainer(cid,2006,getCount(msg),100,7)
elseif msgcontains(msg, 'lifefluid') or msgcontains(msg, 'life fluid') then
buyFluidContainer(cid,2006,getCount(msg),60,10)
elseif msgcontains(msg, 'fishing rod') then
buy(cid,2580,getCount(msg),100)
elseif msgcontains(msg, 'torch') then
buy(cid,2050,getCount(msg),5)
elseif msgcontains(msg, 'rope') then
buy(cid,2120,getCount(msg),50)
elseif msgcontains(msg, 'aol') then
buy(cid,2173,getCount(msg),10000)
elseif msgcontains(msg, 'vial') or msgcontains(msg, 'flask') then
sell(cid,2006,getCount(msg),10)
elseif msgcontains(msg, 'obsidian knife') or msgcontains(msg, 'knife') then
sell(cid,5908,getCount(msg),10000)
elseif msgcontains(msg, 'blessed wooden stake') or msgcontains(msg, 'blessed wooden stake') then
sell(cid,5942,getCount(msg),10000)
elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
selfSay('Do zobaczenia, ' .. creatureGetName(cid) .. '!')
focus = 0
talk_start = 0
end
end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
if (os.clock() - talk_start) > 30 then
if focus > 0 then
selfSay('Nastepna osoba ...')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Do nastepnego razu')
focus = 0
end
end
end
Chciałbym aby Malaka sprzedawał Bp Manarune, i wszystkie runy mają mieć po 100 ładunku .
Pozdrawiam MrowaQ
Offline