Yasny |
Gadula |
|
|
Dołączył: 10 Gru 2005 |
Posty: 56 |
Przeczytał: 0 tematów
Ostrzeżeń: 2/20
|
Skąd: Płock |
|
|
|
|
|
|
Nie zrobiłem Księdza, ale macie Zakonnice xD
Robimy plik Zakonnica(data\npc):
<?xml version="1.0"?>
<npc name="Zakonnica" script="data/npc/scripts/zakonnica.lua" access="3" lookdir="1">
<health now="1000" max="1000"/>
<look type="140" head="114" body="0" legs="114" feet="114" corpse="3128"/>
</npc>
Robimy plik zakonnica.lua(data\npc\scripts):
-- the id of the creature we are attacking, following, etc.
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('Yo, yo ' .. creatureGetName(cid) .. '! Moge cie wuleczyc za free, tylko powiedz "ulecz".')
focus = cid
talk_start = os.clock()
end
if string.find(msg, '(%a*)hi(%a*)') and (focus ~= cid) and getDistanceToCreature(cid) < 3 then
selfSay('Zaraz, ' .. creatureGetName(cid) .. '!.')
end
if msgcontains(msg, 'ulecz') and focus == cid then
selfSay('exura sio "creatureGetName(cid)')
talk_start = os.clock()
end
if string.find(msg, '(%a*)bye(%a*)') and focus == cid and getDistanceToCreature(cid) < 3 then
selfSay('Nara i nie zapomnij sie pomodlic, ' .. 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('Kto jeszcze?')
end
focus = 0
end
end
No i to było by na tyle... xD |
|