Defozo |
Wysłany: Pon 14:19, 15 Sty 2007 Temat postu: [7.6][npc] Trochę npc-ów... |
|
Sklepikarz
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('Czesc ' .. creatureGetName(cid) .. '! Sprzedam ci blank rune (10gps), SD (200gps), Golden Backpack (35gps), football (30gps), spears (10gps), 100 throwing star (400gps) silver amulet (65gps) i 50 throwing star boots of haste (10k) ring of healing (350gps) timering (700gps) swordring (650gps) lifering (700gps) (Wszystko oprocz throwing star 1 sztuka).')
focus = cid
talk_start = os.clock()
elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Sorry, ' .. creatureGetName(cid) .. '! I talk to you in a minute.')
elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'blank rune') then
buy(cid,2260,1,10)
elseif msgcontains(msg, 'sd') then
buy(cid,2268,1,200)
elseif msgcontains(msg, 'backpack') then
buy(cid,2004,1,35)
elseif msgcontains(msg, 'football') then
buy(cid,2109,1,30)
elseif msgcontains(msg, 'spears') then
buy(cid,2389,1,10)
elseif msgcontains(msg, '100 throwing star') then
buy(cid,2399,100,400)
elseif msgcontains(msg, 'silver amulet') then
buy(cid,2170,1,65)
elseif msgcontains(msg, '50 throwing star') then
buy(cid,2399,50,400)
elseif msgcontains(msg, 'boots of haste') then
buy(cid,2195,1,10000)
elseif msgcontains(msg, 'ring of healing') then
buy(cid,2214,1,350)
elseif msgcontains(msg, 'timering') then
buy(cid,2206,1,700)
elseif msgcontains(msg, 'swordring') then
buy(cid,2207,1,650)
elseif msgcontains(msg, 'lifering') then
buy(cid,2205,1,650)
elseif msgcontains(msg, 'bye') and focus == cid and getDistanceToCreature(cid) < 4 then
selfSay('Good bye, ' .. 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('Next please...')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Good bye then.')
focus = 0
end
end
end |
Sklepikarz.xml
Kod: | <?xml version="1.0"?>
<npc name="Sklepikarz :)" script="data/npc/scripts/scriptek.lua" access="3">
<look type="129" head="76" body="114" legs="124" feet="86"/>
</npc> |
Morderca Train
Kod: | --------By Defozo--------
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('/m monk')
focus = cid
talk_start = os.clock()
elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Sorry, ' .. creatureGetName(cid) .. '! I talk to you in a minute.')
elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'uh') then
buy(cid,2273,1,100)
elseif msgcontains(msg, 'bye') and focus == cid and getDistanceToCreature(cid) < 4 then
selfSay('Good bye, ' .. 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('Next please...')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Good bye then.')
focus = 0
end
end
end |
Morderca Train.xml
Kod: | <?xml version="1.0"?>
<npc name="Morderca Train" script="data/npc/scripts/morderca train.lua" access="3">
<look type="57" head="20" body="30" legs="40" feet="50"/>
</npc> |
Nie ma tematu do zamieszczania npc-ów, spellów itd. A więc na forum będzie chyba trochę większy spam?
Pozdro... |
|