Autor Wiadomość
son_of_sillve
PostWysłany: Wto 20:36, 15 Maj 2007    Temat postu: NPC Inwazjer

hmmm... na moim ots są problemy z expieniem... bo nie zrobiłem expowisk.. więc taki oto łatwy NPC Inwazjer


na poczatek tworzymy w data\npc\ plik Inwazjer.xml
i wpisujemy

Kod:
<npc name="Inwazjer" script="data/npc/scripts/inwazje.lua" access="3" lookdir="2">
<mana now="800" max="800"/>
<health now="200" max="200"/>
<look type="129" head="0" body="94" legs="94" feet="114"/>
</npc>


i potem w data\npc\scripts tworzymy plik inwazje.lua

Kod:
if msgcontains(msg, 'minotaur') and focus == cid then
selfSay('/m minotaur')
talk_start = os.clock()
end

if msgcontains(msg, 'gs') and focus == cid then
selfSay('/m giant spider')
talk_start = os.clock()
end

if msgcontains(msg, 'elf') and focus == cid then
selfSay('/m elf')
talk_start = os.clock()
end

if msgcontains(msg, 'human') and focus == cid then
selfSay('/m human')
talk_start = os.clock()
end

if msgcontains(msg, 'dragon') and focus == cid then
selfSay('/m dragon')
talk_start = os.clock()
end

if string.find(msg, '(%a*)bye(%a*)') and focus == cid and getDistanceToCreature(cid) < 4 then
selfSay('Good bye, ' .. 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('Next Please...')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Good bye then.')
focus = 0
end
end
end


miłego expienia pozdroffiki ^^

Powered by phpBB © 2001,2002 phpBB Group