 |
|
 |
|
Xarin
Nowy
Dołączył: 07 Lis 2006
Posty: 19
Przeczytał: 0 tematów
Ostrzeżeń: 0/10 Skąd: Poland
|
|
 |
|
 |
|
Wysłany: Śro 16:47, 08 Lis 2006 Temat postu: Barman npc |
|
|
hehe mam fajny skrypt na barmana najpierw w data\npc\ tworzymy plik Barman.xml i wklejamy w nim to
kod:
<?xml version="1.0"?>
<npc name="Barman" script="data/npc/scripts/alkoholen.lua" access="3">
<look type="128" head="39" body="40" legs="67" feet="76"/>
</npc>
pozniej w data\npc\scripts tworzymy plik alkoholen.lua i wklejamy w nim to
kod:
focus = 0
talk_start = 0
target = 0
following = false
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('Witaj w mojej karczmie, sprzedaje tu piwo i wino')
focus = cid
talk_start = os.clock()
elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Czekaj, kazdy sie napije !!.')
elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'piwo') then
selfSay('Moge ci nalac takie piwa: tibijskie, grzane, chlodzone, palone, mocne, light po 10 gp za flaszke!')
elseif msgcontains(msg, 'tibijskie') then
buy(cid,2006,3,10)
elseif msgcontains(msg, 'grzane') then
buy(cid,2006,3,10)
elseif msgcontains(msg, 'chlodzone') then
buy(cid,2006,3,10)
elseif msgcontains(msg, 'palone') then
buy(cid,2006,3,10)
elseif msgcontains(msg, 'mocne') then
buy(cid,2006,3,10)
elseif msgcontains(msg, 'light') then
buy(cid,2006,3,10)
elseif msgcontains(msg, 'wino') then
selfSay('moge ci sprzedac butelke z takimi winami: "komandos" -10gp, "wino marki wino" - 9gp "Vermuth" -20gp "spocony cyklop" -15gp "elficki trunek" -100gp "goblinskie wymiociny" -5gp "trup" -15gp')
elseif msgcontains(msg, 'komandos') then
buy(cid,2006,15,9)
elseif msgcontains(msg, 'wino marki wino') then
buy(cid,2006,15,9)
elseif msgcontains(msg, 'vermuth') then
buy(cid,2006,15,20)
elseif msgcontains(msg, 'spocony cyklop') then
buy(cid,2006,15,15)
elseif msgcontains(msg, 'elficki trunek') then
buy(cid,2006,15,100)
elseif msgcontains(msg, 'goblinskie wymiociny') then
buy(cid,2006,15,5)
elseif msgcontains(msg, 'trup') then
buy(cid,2006,15,15)
elseif string.find(msg, '(%a*)bye(%a*)') 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('Boze tak wczesnie a ten juz nawalony, kto chce piwa?')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Dobrze ze chociarz zaplacil')
focus = 0
end
end
end
mysle ze skrypt bedzie przydatny narazie
Post został pochwalony 0 razy
|
|