Koybi
Senior User
- Joined
- Aug 7, 2008
- Messages
- 742
- Reaction score
- 43
Witam. Mam tu dla was NPC , kt?ry sprzedaje BP Potion's pod Tibia 8.1. Skrypt nie m?j odrazu m?wi? , udost?pniam go , ?eby mogli?cie z niego skorzysta?!
w data/npc tworzysz plik o nazwie Vortah.xml i dodajesz :
Teraz do data/npc/scripts dodajesz potions.lua i wklejasz to :
w data/npc tworzysz plik o nazwie Vortah.xml i dodajesz :
Code:
<?xml version="1.0"?>
<npc name="Vortah" script="data/npc/scripts/potions.lua" access="5" lookdir="1">
<health now="1000" max="1000"/>
<look type="133" head="0" body="86" legs="0" feet="38" addons="1"/>
</npc>
Teraz do data/npc/scripts dodajesz potions.lua i wklejasz to :
Code:
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)
local msg = string.lower(msg)
if msgcontains(msg, 'hi') and focus == 0 and getDistanceToCreature(cid) < 4 then
selfSay('Witaj ' .. creatureGetName(cid) .. '! Sprzedaje wszystkie rodzaje potionow. Sprzedam ci "bp mana potions" , "bp great health potions" etc, a takze zwykle "backpack"s Dla poznania cen powiedz "offer"!')
focus = cid
talk_start = os.clock()
elseif msgcontains(msg, 'hi') and focus ~= cid and getDistanceToCreature(cid) < 4 then
selfSay('Przepraszam, ' .. creatureGetName(cid) .. '! Wlasnie rozmawiamy.')
elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'offer') then
selfSay('Sprzedaje bhp i bmp za 2k, bshp i bsmp za 5k, bghp i bgmp za 10k.')
elseif msgcontains(msg, 'bp health potions') or msgcontains(msg, 'bhp') then
buyContainer(cid,2000,7618,1,2000)
elseif msgcontains(msg, 'bp mana potions') or msgcontains(msg, 'bmp') then
buyContainer(cid,2002,7620,1,2000)
elseif msgcontains(msg, 'bp great health potions') or msgcontains(msg, 'bghp') then
buyContainer(cid,2000,7591,1,10000)
elseif msgcontains(msg, 'bp great mana potions') or msgcontains(msg, 'bgmp') then
buyContainer(cid,2002,7590,1,10000)
elseif msgcontains(msg, 'bp strong health potions') or msgcontains(msg, 'bshp') then
buyContainer(cid,2000,7588,1,5000)
elseif msgcontains(msg, 'bp strong mana potions') or msgcontains(msg, 'bsmp') then
buyContainer(cid,2002,7589,1,5000)
elseif msgcontains(msg, 'backpack') or msgcontains(msg, 'bp') then
buy(cid,1988,getCount(msg),10)
elseif string.find(msg, '(%a*)bye(%a*)') and getDistanceToCreature(cid) < 4 then
selfSay('Zegnaj, ' .. 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('Nastepny!')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 4 then
selfSay('Nie wypij wszystkiego odrazu!')
focus = 0
end
end
end