Forum OTS Red Castle
Forum Red Castle
 
 FAQFAQ   SzukajSzukaj   UżytkownicyUżytkownicy   GrupyGrupy  GalerieGalerie   RejestracjaRejestracja 
 ProfilProfil   Zaloguj się, by sprawdzić wiadomościZaloguj się, by sprawdzić wiadomości   ZalogujZaloguj 

NPC Summoner

 
Napisz nowy temat   Odpowiedz do tematu    Forum OTS Red Castle Strona Główna -> Skrypty itp.
Zobacz poprzedni temat :: Zobacz następny temat  
Autor Wiadomość
son_of_sillve
Miotacz Postów



Dołączył: 09 Kwi 2007
Posty: 167
Przeczytał: 0 tematów

Ostrzeżeń: 0/5
Skąd: Z Nienacka

PostWysłany: Śro 19:31, 16 Maj 2007    Temat postu: NPC Summoner

na moim np ots są problemy z expieniem więc mamy tu NPCa od potworków piszesz hi>dragon i mamy draga do killnięcia ;P

wchodzimy w data/npc/scripts i robimy plik summonss.lua

Kod:
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) < 4 then
selfSay('Hello ' .. creatureGetName(cid) .. '! I summon all kinds of creatures.')
focus = cid
talk_start = os.clock()
end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

if msgcontains(msg, 'yeti') and focus == cid then
selfSay('/m yeti')
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


następnie robimy w data/npc plik Summoner.xml i ładujemy tam:

Kod:
<?xml version="1.0"?>

<npc name="Summoner" script="data/npc/scripts/summon.lua" access="1" lookdir="3">
   <mana now="800" max="800"/>
   <health now="200" max="200"/>
   <look type="134" head="2" body="95" legs="60" feet="132"/>
</npc>


Post został pochwalony 0 razy
Powrót do góry
Zobacz profil autora
Wyświetl posty z ostatnich:   
Napisz nowy temat   Odpowiedz do tematu    Forum OTS Red Castle Strona Główna -> Skrypty itp. Wszystkie czasy w strefie EET (Europa)
Strona 1 z 1

 
Skocz do:  
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


fora.pl - załóż własne forum dyskusyjne za darmo
Powered by phpBB © 2001, 2002 phpBB Group
Regulamin