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 Ksiądz

 
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: Nie 10:46, 13 Maj 2007    Temat postu: NPC Ksiądz

Zauważyłem kilka miesięcy temu, że są częste śluby na RC. Postanowiłem sprawić, by żaden gracz nie musiał się uczyć jakiś głupich regułek... po prostu NPC ;]

w data/npc robimy plik Ksiadz.xml i wklejamy:

Kod:
<?xml version="1.0"?>
<npc name="Ksiadz" script="data/npc/scripts/slub.lua" access="3" lookdir="2">
    <mana now="800" max="800"/>
    <health now="200" max="200"/>
    <look type="57" head="20" body="30" legs="40" feet="50"/>
</npc>


następnie w data/npc/scripts robimy plik o nazwie slub.lua (bez polskich liter !!)
i wklejamy:

Kod:
focus1 = 0
focus2 = 0
talk_start = 0
target = 0
following = false
attacking = false
talkstate = 0
moved=0
function onThingMove(creature, thing, oldpos, oldstackpos)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(id, stackpos)
if id == focus1 or id == focus1 then
ceremonyend('Z Panem Bogiem !')
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 ceremonyend(msg)
focus1 = 0
focus2 = 0
talk_start = 0
talkstate = 0
selfSay(msg)
end
function onCreatureSay(cid, type, msg)
msg = string.lower(msg)
if talkstate == 1 then
if cid == focus2 then
if msgcontains(msg, 'tak') then
talkstate=2
selfSay('' .. creatureGetName(focus1) .. ' Powinienem rozpoczac ceremonie?')
else
ceremonyend('Wroccie kiedy bedziecie gotowi..')
end
end
end
if talkstate == 2 then
if cid == focus1 then
if msgcontains(msg, 'tak') then
talkstate=3
else
ceremonyend('Wroccie kiedy bedziecie gotowi.')
end
end
end
if talkstate == 9 then
if cid == focus1 then
if string.find(msg, '(%a*)tak(%a*)') then
talkstate=10
else
ceremonyend('Wroccie kiedy bedziecie gotowi.')
end
end
end
if talkstate == 11 then
if cid == focus2 then
if string.find(msg, '(%a*)tak(%a*)') then
talkstate=12
else
ceremonyend('Wroccie kiedy bedziecie gotowi.')
end
end
end
if msgcontains(msg, 'hi') and focus1 > 0 and focus2 == 0 and not(cid==focus1) and isPromoted(cid) and getDistanceToCreature(cid) < 4 then
if getPlayerStorageValue(cid,2001) == -1 then
selfSay('Witam, ' .. creatureGetName(cid) .. '! Jestem ksiedzem z Wieliszewa. Powinienem zaczac ceremonie?')
focus2 = cid
talk_start = os.clock()
talkstate=1
else
selfSay('Jestes po ceremonii slubu!')
end
end
if msgcontains(msg, 'hi') and focus1 == 0 and isPromoted(cid) and getDistanceToCreature(cid) < 4 then
if getPlayerStorageValue(cid,2001) == -1 then
selfSay('Witam, ' .. creatureGetName(cid) .. '! Jestem ksiedzem z Wieliszewa. Moge udzielic slubu Tobie i Twojej wybrance lub wybrankowi.')
focus1 = cid
talk_start = os.clock()
else
selfSay('Jestes juz po slubie.')
end
end
if msgcontains(msg, 'wieliszew') and (focus1 == cid or focus2 == cid) then
selfSay('Wieliszew to mala miejscowosc, w ktorej wyroslem na to, czym jestem.')
talk_start = os.clock()
end
if string.find(msg, '(%a*)bye(%a*)') and (focus1 == cid or focus2 == cid) and getDistanceToCreature(cid) < 6 then
ceremonyend('Z Panem Bogiem ! ' .. creatureGetName(cid) .. '!')
end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
if talkstate==3 and (os.clock() - talk_start) > 10 then
selfSay('Polozcie tu swoje obraczki na znak swojej wiary.');
talk_start = os.clock()
talkstate=4
end
if talkstate==4 and (os.clock() - talk_start) > 6 then
selfSay('Stoicie tu teraz razem, poniewaz udzielacie sie w przybyciu swojej przyszlosci..');
talk_start = os.clock()
talkstate=5
end
if talkstate==5 and (os.clock() - talk_start) > 6 then
selfSay('Przeszlosc jest przeszloscia. Zarodki jednak kwitna, z troska i zaufaniem....');
talk_start = os.clock()
talkstate=6
end
if talkstate==6 and (os.clock() - talk_start) > 8 then
selfSay('Uczciwosc i zyczliwosc, sa owocami milosci.');
talk_start = os.clock()
talkstate=7
end
if talkstate==7 and (os.clock() - talk_start) > 6 then
selfSay('Zatem niech Pan Bog blogoslawi ten dzien i zawsze wzbogacac bedzie Wasza milosc... bez konca.');
talk_start = os.clock()
talkstate=8
end
if talkstate==8 and (os.clock() - talk_start) > 6 then
selfSay(creatureGetName(focus1) .. ' Czy Ty obiecujesz ' .. creatureGetName(focus2) .. ' w obecnosci wyslannika Bozego ... w dobrej... i zlej doli... w bogactwie... czy biedzie... w chorobie i zdrowiu... MILOSC... WIERNOSC... I UCZCIWOSC MALZENSKA?');
talk_start = os.clock()
talkstate=9
end
if talkstate==10 and (os.clock() - talk_start) > 6 then
selfSay(creatureGetName(focus2) .. ' Czy Ty obiecujesz ' .. creatureGetName(focus1) .. ' w obecnosci wyslannika Bozego... w dobrej... i zlej doli... w bogactwie... czy biedzie... w chorobie i zdrowiu... MILOSC... WIERNOSC... I UCZCIWOSC MALZENSKA?');
talk_start = os.clock()
talkstate=11
end
if talkstate==12 and (os.clock() - talk_start) > 6 then
setPlayerStorageValue(focus2,2001,1)
setPlayerStorageValue(focus1,2001,1)
ceremonyend('Oglaszam was MEZEM i ZONA ! Zalozcie obraczki.. Niech Pan ma was w swojej opiece.');
talk_start = os.clock()
end
if (os.clock() - talk_start) > 100 then
if focus1 > 0 or focus2 > 0 then
ceremonyend('Z Panem Bogiem !')
end
end
--if moved==0 then
--x, y, z = selfGetPosition()
--moveToPosition(x+1, y, z)
--moved=1
--end
end


i w data/world/npc.xml doraiamy linijkę gdzie oczywiście trzeba podać współrzędne, gdzie NPC ma ciągle stać ;]

Kod:
<npc name="Ksiadz" x="153" y="44" z="7" dir="1"/>


Aby ożenić się/wyjść za mąż trza dwóch ludzi (NPC toleruje nie wiem czemu gejów i lesbijki Smile) i oby dwóch, niekoniecznie naraz muszą powiedzieć 'hi'... resztę się domyślicie z dialogów Ksiedza

to by było na tyle... życzę wszystkiego dobrego na nowej drodze życia ;D


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