Alfons II
Stały Gość
Dołączył: 17 Lis 2005
Posty: 59
Przeczytał: 0 tematów
Ostrzeżeń: 1/10
Skąd: KRAKÓW !!!
|
[NPC] Tali, Sprzedaje Ozdoby Do Domków
Witajcie znowu
Przedstawiam wam NPC który sprzedaje np. Talony, Różne diamenty :], min. Teddy Beara
A więc zaczynajmy :]
Robimy plik Tali.xml w data/npc i wklejamy to:
¤Code By Ryder¤
<npc name="Tali" script="data/npc/scripts/tali.lua" access="3" lookdir="1">
<health now="1000" max="1000"/>
<look type="63" head="20" body="30" legs="40" feet="50" corpse="4095"/>
</npc>
Następnie robimy Tali.lua w data/npc/scripts i wklejamy to:
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 ((string.find(msg, '(%a*)hi(%a*)')) and (focus == 0)) and getDistanceToCreature(cid) < 3 then
selfSay('Whats Good, ' .. creatureGetName(cid) .. '! Choose a category for your choices: gems, big gems, spellwands, and misc. Everyone is 100k')
focus = cid
talk_start = os.clock()
elseif string.find(msg, '(%a*)hi(%a*)') and (focus ~= cid) and getDistanceToCreature(cid) < 3 then
selfSay('Omfg, ' .. creatureGetName(cid) .. '! Wait a fucking minute.')
elseif msgcontains(msg, 'talons') and focus == cid then
buy(cid,2972,50,100000)
talk_start = os.clock()
elseif msgcontains(msg, 'small sapphires') and focus == cid then
buy(cid,2967,50,100000)
talk_start = os.clock()
elseif msgcontains(msg, 'small rubies') and focus == cid then
buy(cid,2968,50,100000)
talk_start = os.clock()
elseif msgcontains(msg, 'small emeralds') and focus == cid then
buy(cid,2970,50,100000)
talk_start = os.clock()
elseif msgcontains(msg, 'white pearls') and focus == cid then
buy(cid,2964,50,100000)
talk_start = os.clock()
elseif msgcontains(msg, 'black pearls') and focus == cid then
buy(cid,2965,50,100000)
talk_start = os.clock()
elseif msgcontains(msg, 'small diamonds') and focus == cid then
buy(cid,2966,50,100000)
talk_start = os.clock()
elseif msgcontains(msg, 'small amethysts') and focus == cid then
buy(cid,2971,50,100000)
talk_start = os.clock()
elseif msgcontains(msg, 'gems') then
selfSay('I sell small sapphires, rubies, emeralds, diamonds, amethysts, white pearls and black pearls.')
elseif msgcontains(msg, 'violet gem') and focus == cid then
buy(cid,2974,1,100000)
talk_start = os.clock()
elseif msgcontains(msg, 'yellow gem') and focus == cid then
buy(cid,2975,1,100000)
talk_start = os.clock()
elseif msgcontains(msg, 'blue gem') and focus == cid then
buy(cid,2979,1,100000)
talk_start = os.clock()
elseif msgcontains(msg, 'red gem') and focus == cid then
buy(cid,2977,1,100000)
talk_start = os.clock()
elseif msgcontains(msg, 'big gems') then
selfSay('I sell blue gem, red gem, violet gem, yellow gem')
elseif msgcontains(msg, 'red spellwand') and focus == cid then
buy(cid,3013,1,100000)
talk_start = os.clock()
elseif msgcontains(msg, 'blue spellwand') and focus == cid then
buy(cid,3012,1,100000)
talk_start = os.clock()
elseif msgcontains(msg, 'yellow spellwand') and focus == cid then
buy(cid,3011,1,100000)
talk_start = os.clock()
elseif msgcontains(msg, 'green spellwand') and focus == cid then
buy(cid,3010,1,100000)
talk_start = os.clock()
elseif msgcontains(msg, 'spellwands') then
selfSay('I sell blue spellwand, red spellwand, green spellwand, yellow spellwand.')
elseif msgcontains(msg, 'blood herb') and focus == cid then
buy(cid,3669,1,100000)
talk_start = os.clock()
elseif msgcontains(msg, 'coconut') and focus == cid then
buy(cid,3527,25,100000)
talk_start = os.clock()
elseif msgcontains(msg, 'snowball') and focus == cid then
buy(cid,2930,25,100000)
talk_start = os.clock()
elseif msgcontains(msg, 'teddy bear') and focus == cid then
buy(cid,2931,1,100000)
talk_start = os.clock()
elseif msgcontains(msg, 'misc') then
selfSay('I sell blood herbs, coconut, snowball, and teddy bear')
elseif string.find(msg, '(%a*)bye(%a*)') and focus == cid and getDistanceToCreature(cid) < 3 then
selfSay('Good bye, ' .. creatureGetName(cid) .. '!')
focus = 0
talk_start = 0
end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
if (os.clock() - talk_start) > 10 then
if focus > 0 then
selfSay('Next Please...')
end
focus = 0
end
end
Teraz otwieramy data/world/npc i wklejamy to i zmieniamy pozycje:
<npc name="Tali" x="[Tutaj pozycje X]" y="[Tutaj pozycje Y]" z="[Tutaj pozycje Z]"/>
Post został pochwalony 0 razy
|