Forum o ots

Załorzyciel Mateusz Kornet (KiKi)

Forum Forum o ots Strona Główna -> CVS, Kody -> NPC Andy
Napisz nowy temat  Odpowiedz do tematu Zobacz poprzedni temat :: Zobacz następny temat 
NPC Andy
PostWysłany: Sob 22:27, 18 Mar 2006
KiKi
Administrator

 
Dołączył: 18 Mar 2006
Posty: 70
Przeczytał: 0 tematów

Ostrzeżeń: 0/3
Skąd: Bydgoszcz





Siemax all nudzilo mi sie wiec szperalem na form tibi org i znalazlem szmiesznego npc
ktory opowiada kawaly:p
W C:\YurOTS_093\data\npc tworzymy plik XML o nazwie koniuch (mozecie wlasna nazwe;P)
i zmieniamy jego zawartosc na:

<?xml version="1.0"?>
<npc name="Koniuch" script="data/npc/scripts/kawal.lua" access="3">
<look type="128" head="78" body="71" legs="82" feet="114"/>
</npc>

A nastepnie towrzymy plik kawal.lua (C:\YurOTS_093\data\npc\scripts) o tersci:

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*)')
or string.find(msg, '(%a*)siema(%a*)')
or string.find(msg, '(%a*)czesc(%a*)')
or string.find(msg, '(%a*)cze(%a*)')
or string.find(msg, '(%a*)yo(%a*)')
or string.find(msg, '(%a*)witaj(%a*)'))
and (focus == 0)) and getDistanceToCreature(cid) < 4 then

rsay = math.random(1,4)
if rsay == 1 then says = 'Waazzuup'
elseif rsay == 2 then says = 'Siema'
elseif rsay == 3 then says = 'Czesc'
elseif rsay == 4 then says = 'Witaj'
end


selfSay(says .. ' ' .. creatureGetName(cid) .. '! Chcesz zebym opowiedzial kawal?')
focus = cid
talk_start = os.clock()
end

if (string.find(msg, '(%a*)hi(%a*)')
or string.find(msg, '(%a*)siema(%a*)')
or string.find(msg, '(%a*)czesc(%a*)')
or string.find(msg, '(%a*)yo(%a*)')
or string.find(msg, '(%a*)cze(%a*)')
or string.find(msg, '(%a*)witaj(%a*)')) and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Spadaj do kolejki ' .. creatureGetName(cid) .. '!')
end

if msgcontains(msg, 'tak') and focus == cid then

rsay = math.random(1,14)
if rsay == 1 then
selfSay('Co maja wspólnego UFO i inteligentna blondynka? \n - Ciagle o nich slyszysz, ale nigdy nie widziales.')
elseif rsay == 2 then
selfSay('- Co to jest: czerwone, grube i jak wchodzi to sprawia przyjemnosc? \n - Swiety Mikolaj.')
elseif rsay == 3 then
selfSay('A wiesz, co to jest: lata po pokoju i robi yzb, yzb, yzb... \n - Mucha na wstecznym biegu.')
elseif rsay == 4 then
selfSay('- Sasiedzie! Dokupilem sobie 10 hektarów pola! \n - Wiem. Panski kon powiesil sie za stodola.')
elseif rsay == 5 then
selfSay('Czym róznia sie od siebie dlugopis, trumna i prezerwatywa? \n Wkladem.')
elseif rsay == 6 then
selfSay('Jak sie nazywa po japonsku sekretarka? \n Nagasuka.')
elseif rsay == 7 then
selfSay('Jak sie nazywa po japonsku kibel? \n Nasikojtu.')
elseif rsay == 8 then
selfSay('Jak sie nazywaja po czesku golebie? \n Srajdachówki.')
elseif rsay == 9 then
selfSay('Jak sie nazywa po francusku kibel? \n Lejnamur.')
elseif rsay == 10 then
selfSay('Jak sie nazywa po chinsku pilkarz? \n Kiwajakotako.')
elseif rsay == 11 then
selfSay('Co robi dyrektor z bezpartyjna sekretarka? \n Wciaga ja na czlonka.')
elseif rsay == 12 then
selfSay('Kto byl pierwszym lotnikiem? \n Adam, bo przelecial Ewe.')
elseif rsay == 13 then
selfSay('Co to jest: idzie to spiewa, stoi to smierdzi? \n Pielgrzymka do Czestochowy.')
elseif rsay == 14 then
selfSay('Dlaczego Swiety Mikolaj nie moze miec dzieci? \n Bo ma krzywa laske, wór na plecach i spuszcza sie przez komin.')
end

selfSay('hahaha jeszcze jeden?')
talk_start = os.clock()
end


if (string.find(msg, '(%a*)bye(%a*)') or string.find(msg, '(%a*)nara(%a*)') or string.find(msg, '(%a*)nie(%a*)') or string.find(msg, '(%a*)narazie(%a*)')) and focus == cid and getDistanceToCreature(cid) < 4 then

rsay = math.random(1,4)
if rsay == 1 then says = 'Nara'
elseif rsay == 2 then says = 'Narazie'
elseif rsay == 3 then says = '3maj sie'
elseif rsay == 4 then says = 'CYA'
end

selfSay(says .. ' ' .. creatureGetName(cid) .. '!')
focus = 0
talk_start = 0
end
end

-- script by ostry

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('Nara!')
focus = 0
end
end
if focus == 0 then
cx, cy, cz = selfGetPosition()
randmove = math.random(1,10)
if randmove == 1 then
nx = cx + 1
end
if randmove == 2 then
nx = cx - 1
end
if randmove == 3 then
ny = cy + 1
end
if randmove == 4 then
ny = cy - 1
end
if randmove >= 5 then
nx = cx
ny = cy
end
moveToPosition(nx, ny, cz)
end
end

i na koniec w C:\YurOTS_093\data\world otwieramy za pomoca notanika plik XML Npc
i doklejmy tam taka linijke:

<npc name="Koniuch" x="" y="" z=""/>

Oczywiscie podajecie swoje wspolrzedne x,y i z

Uwaga:Npc chodzi , a takze zamiast tamtych kawalow co sa napisane mozecie je zmienic
na wlasne;p

Mysle,ze przyda wam sie to chodzby dla jaj:P
Pozdro;p


Post został pochwalony 0 razy
Zobacz profil autora
PostWysłany: Czw 21:23, 08 Lut 2007
Hogen
Gość

 





BEZ sensu!!! Wogóle nie działa
lexaxdq
PostWysłany: Czw 22:10, 22 Lut 2007
dtvvdir
Gość

 





Hello cool site, thanks !!! 1172174793
NPC Andy
Forum Forum o ots Strona Główna -> CVS, Kody
Możesz pisać nowe tematy
Możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Wszystkie czasy w strefie EET (Europa)  
Strona 1 z 1  

  
  
 Napisz nowy temat  Odpowiedz do tematu  


fora.pl - załóż własne forum dyskusyjne za darmo
Powered by phpBB © 2001-2003 phpBB Group
Theme created by Vjacheslav Trushkin
Regulamin