Forum OTS4U.fora.pl Strona Główna OTS4U.fora.pl
Forum o OTS
 
 FAQFAQ   SzukajSzukaj   UżytkownicyUżytkownicy   GrupyGrupy     GalerieGalerie   RejestracjaRejestracja 
 ProfilProfil   Zaloguj się, by sprawdzić wiadomościZaloguj się, by sprawdzić wiadomości   ZalogujZaloguj 

NPC Temple by KILLAVUS

 
Napisz nowy temat   Odpowiedz do tematu    Forum OTS4U.fora.pl Strona Główna -> Skrypty .lua i .xml
Zobacz poprzedni temat :: Zobacz następny temat  
Autor Wiadomość
Warth
Gaduła+



Dołączył: 07 Lip 2006
Posty: 103
Przeczytał: 0 tematów

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

PostWysłany: Sob 9:17, 08 Lip 2006    Temat postu: NPC Temple by KILLAVUS

Od razu mówie ze to nie jest mój NPC Smile
Ale przyd sie ludziom posiadajacym rozbudowana mapqe gdzie maja kilka miast :]

Otoz NPC zmienia mijesce naszego zmieszkania Very Happy

tworzymy plik city.lua z zawartoscia

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('Welcome ' .. creatureGetName(cid) .. '! Do you want to be citizen of The this city?')
          selfLook(cid)
         focus = cid
         talk_start = os.clock()
     end

    if string.find(msg, '(%a*)hi(%a*)') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
         selfSay('Sorry, ' .. creatureGetName(cid) .. '! I am talking now.')
     end

   
    if msgcontains(msg, 'yes') and focus == cid then
            selfSay('Now you are the citizen of this city, ' .. creatureGetName(cid) .. ' gratulations!')
            selfSay('/send ' .. creatureGetName(cid) .. ', 160 54 7')
            setPlayerMasterPos(cid,160,54,7)
            focus = 0
            talk_start = 0
        end

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


    end


Kod:
selfSay('/send ' .. creatureGetName(cid) .. ', 160 54 7')

Wy wpiszcie tu TEMPLE tego miasta do ktorego mze zaczac przynalezec Very Happy

A w data/npc
Cito.xml

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

<npc name="Cito" script="data/npc/scripts/city.lua" access="3" monster="1" speed="50" level="100" maglevel="100" exp="0" pushable="0" lookdir="0">
   <mana now="100" max="100"/>
   <health now="100" max="100"/>
   <look type="57" head="78" body="61" legs="52" feet="114" corpse="2276"/>
   <attack type="melee" damage="10"/>       
</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 OTS4U.fora.pl Strona Główna -> Skrypty .lua i .xml Wszystkie czasy w strefie EET (Europa)
Strona 1 z 1

Skocz do:  

Nie możesz pisać nowych tematów
Nie 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 phpBB Group

Chronicles phpBB2 theme by Jakob Persson (http://www.eddingschronicles.com). Stone textures by Patty Herford.
Regulamin