#1 2007-03-05 16:01:58

MrGi

Zielony

Zarejestrowany: 2007-03-05
Posty: 26
Punktów :   

NPC Sellujący wszystkie kolory BP i Bagów

Mam nadzieje ze Devil to wykorzysta :P
...wiem że może nie jest to nic trudnego ale może komuś się przyda :D


w data\npc tworzymy plik Bp Seller.xml i wklejamy do niego to:
<?xml version="1.0"?>
<npc name="Bp Seller" script="data/npc/scripts/bp seller.lua" access="3">
<look type="133" head="0" body="81" legs="114" feet="0"/>
</npc>

następnie w data\npc\scripts tworzymy bp seller.lua 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('hi.')
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) < 4 then
selfSay('Siemka ' .. creatureGetName(cid) .. '! Sellne ci backpacki i bagi wszystkich kolorow tylko po 35 i 20 gp!.. Powiedz backpack albo bag a powiem ci co i jak')
focus = cid
talk_start = os.clock()
end

if string.find(msg, '(%a*)hi(%a*)') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('No kurwa, ' .. creatureGetName(cid) .. '! Poczekaj,widzisz ze opylam??.')
end
if msgcontains(msg, 'backpack') and focus == cid then
selfSay('Moge ci sprzedac kolory:zielony,zolty,czerwony,fioletowy,niebieski, szary,zloty,jungle i zwykle.Powiedz np.niebieski bp aby go kupic^^')
end
if msgcontains(msg, 'bag') and focus == cid then
selfSay('Moge ci sprzedac kolory:zielony,zolty,czerwony,fioletowy,niebieski, szary,zloty,jungle i zwykle.Powiedz np.zielony bag aby go kupic:]')
end

if msgcontains(msg, 'zwykly bag') and focus == cid then
buy(cid,1987,1,20)
talk_start = os.clock()
end
if msgcontains(msg, 'zielony bag') and focus == cid then
buy(cid,1991,1,20)
talk_start = os.clock()
end
if msgcontains(msg, 'zolty bag') and focus == cid then
buy(cid,1992,1,20)
talk_start = os.clock()
end
if msgcontains(msg, 'czerwony bag') and focus == cid then
buy(cid,1993,1,20)
talk_start = os.clock()
end
if msgcontains(msg, 'fioletowy bag') and focus == cid then
buy(cid,1994,1,20)
talk_start = os.clock()
end
if msgcontains(msg, 'niebieski bag') and focus == cid then
buy(cid,1995,1,20)
talk_start = os.clock()
end
if msgcontains(msg, 'szary bag') and focus == cid then
buy(cid,1996,1,20)
talk_start = os.clock()
end
if msgcontains(msg, 'zloty bag') and focus == cid then
buy(cid,1997,1,20)
talk_start = os.clock()
end
if msgcontains(msg, 'jungle bag') and focus == cid then
buy(cid,3939,1,20)
talk_start = os.clock()
end
if msgcontains(msg, 'zwykly bp') and focus == cid then
buy(cid,1988,1,35)
talk_start = os.clock()
end
if msgcontains(msg, 'zielony bp') and focus == cid then
buy(cid,1998,1,35)
talk_start = os.clock()
end
if msgcontains(msg, 'zolty bp') and focus == cid then
buy(cid,1999,1,35)
talk_start = os.clock()
end
if msgcontains(msg, 'czerwony bp') and focus == cid then
buy(cid,2000,1,35)
talk_start = os.clock()
end
if msgcontains(msg, 'fioletowy bp') and focus == cid then
buy(cid,2001,1,35)
talk_start = os.clock()
end
if msgcontains(msg, 'niebieski bp') and focus == cid then
buy(cid,2002,1,35)
talk_start = os.clock()
end
if msgcontains(msg, 'szary bp') and focus == cid then
buy(cid,2003,1,35)
talk_start = os.clock()
end

if msgcontains(msg, 'zloty bp') and focus == cid then
buy(cid,2004,1,35)
talk_start = os.clock()
end
if msgcontains(msg, 'jungle bp') and focus == cid then
buy(cid,3940,1,35)
talk_start = os.clock()
end



if string.find(msg, '(%a*)bye(%a*)') and focus == cid and getDistanceToCreature(cid) < 4 then
selfSay('Nie to nie zegnaj, ' .. creatureGetName(cid) .. '!')
focus = 0
talk_start = 0
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) > 5 then
selfSay('Cya.')
focus = 0
end
end
end
na końcu w data\world w pliku npc.xml dodajemy taka linijkę
<npc name="Bp Seller" x="121" y="54" z="7" dir="1"/>

litery X Y Z oznaczają położenie NPC a mapie ;] można to zawsze zmienić.

Offline

 

#2 2007-03-08 19:41:44

Devil

Administrator

Zarejestrowany: 2006-12-22
Posty: 152
Punktów :   
WWW

Re: NPC Sellujący wszystkie kolory BP i Bagów

wykorzystam

Offline

 

#3 2007-03-09 14:56:31

Monia

Moderator

Zarejestrowany: 2007-01-13
Posty: 128
Punktów :   

Re: NPC Sellujący wszystkie kolory BP i Bagów

no bedzie lepiej trzymac manarunki


"Jestem Więc pisze nie ma mnie to nie pisze"
Name :Monia               Level:505             Prof:Master Sorcerer

Offline

 

#4 2007-03-10 11:10:09

Devil

Administrator

Zarejestrowany: 2006-12-22
Posty: 152
Punktów :   
WWW

Re: NPC Sellujący wszystkie kolory BP i Bagów

@up
Heh ;]
PS.gratz 100 posta ;]

Offline

 

#5 2007-03-12 12:38:05

Fox

Moderator

Zarejestrowany: 2007-02-18
Posty: 216
Punktów :   

Re: NPC Sellujący wszystkie kolory BP i Bagów

Hehe ^^ Devil to gdzie ten Npc?

Offline

 

#6 2007-03-15 20:06:54

Monia

Moderator

Zarejestrowany: 2007-01-13
Posty: 128
Punktów :   

Re: NPC Sellujący wszystkie kolory BP i Bagów

chyba go jeszcze nie zrobil


"Jestem Więc pisze nie ma mnie to nie pisze"
Name :Monia               Level:505             Prof:Master Sorcerer

Offline

 

#7 2007-03-15 20:07:25

Monia

Moderator

Zarejestrowany: 2007-01-13
Posty: 128
Punktów :   

Re: NPC Sellujący wszystkie kolory BP i Bagów

dzieki


"Jestem Więc pisze nie ma mnie to nie pisze"
Name :Monia               Level:505             Prof:Master Sorcerer

Offline

 

#8 2007-03-15 21:02:01

Fox

Moderator

Zarejestrowany: 2007-02-18
Posty: 216
Punktów :   

Re: NPC Sellujący wszystkie kolory BP i Bagów

EEe? Monia nie rozpędziłas sie z postami? I za co dziekujesz?

Offline

 

#9 2007-03-16 13:55:46

Pikachu

Zielony

Zarejestrowany: 2007-03-13
Posty: 44
Punktów :   

Re: NPC Sellujący wszystkie kolory BP i Bagów

Hmm... Devil powiedział, że wykorzysta, ale jakoś nie widze tego npc'ta A szkoda...

Offline

 

Stopka forum

RSS
Powered by PunBB
© Copyright 2002–2008 PunBB
Polityka cookies - Wersja Lo-Fi


Darmowe Forum | Ciekawe Fora | Darmowe Fora