Adminjacek
Administrator
Dołączył: 28 Paź 2006 Posty: 58
Przeczytał: 0 tematów
Ostrzeżeń: 0/10
|
Wysłany: Czw 21:41, 09 Lis 2006 Temat postu: Npc sprzedający kolorowe bp |
|
|
Witam chcialbym przedstawic NPCa sprzedajacego wszystkie rodzaje backpackow oswiadczam ze to jest moj wlasny NPC. Bedzie on mial imie Verpan(mozna zmienic).
To wklejamy do data/npc/verpan.xml - trzeba bedzie stworzyc
Kod: |
<?xml version="1.0"?>
<npc name="Verpan" script="data/npc/scripts/bag.lua" access="3">
<look type="129" head="150" body="119" legs="116" feet="76"/>
</npc>
|
To wklejamy do data/npc/scripts/bag.lua - trzeba bedzie strzoyc
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('Hello ' .. creatureGetName(cid) .. '! I sell backpacks in all colors.')
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, 'backpacks') and focus == cid then
selfSay('I sell normal, yellow, gold, blue, red, purple, green and silver backpacks.')
focus = cid
talk_start = os.clock()
end
if msgcontains(msg, 'normal backpack') then
buy(cid,1988,1,25)
elseif msgcontains(msg, 'yellow backpack') then
buy(cid,1999,1,25)
elseif msgcontains(msg, 'gold backpack') then
buy(cid,2004,1,25)
elseif msgcontains(msg, 'blue backpack') then
buy(cid,2002,1,25)
elseif msgcontains(msg, 'red backpack') then
buy(cid,2000,1,25)
elseif msgcontains(msg, 'purple backpack') then
buy(cid,2001,1,25)
elseif msgcontains(msg, 'green backpack') then
buy(cid,1998,1,25)
elseif msgcontains(msg, 'silver backpack') then
buy(cid,2003,1,25)
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
|
To wszystko moze malo przydatny NPC ale urozmaica OTS ktory przez to staje sie bardziej kolorowy i nasz EQ wyglada lepiej
Post został pochwalony 0 razy
|
|