Autor Wiadomość
vilagie
PostWysłany: Czw 19:48, 23 Mar 2006    Temat postu: Religia na OTS

O razu mówie że założenie tego skryptu trwa około 15 minut i dla leniwych nie jest. Jak działa? Pozwala graczowi wybrać jedną z dwuch religi, przynalerznośc do jednej wyklucza przynalerzność do drugiej,
każda z religi oferuje nam inne bonusy.

do katalogu data/npc/scripts dodajemy plik lua o nazwie : "kaplan uraja"z zawartości:

Kod HTML:

-----Religia by GM Maciej----
focus = 0
talk_start = 0
target = 0
following = false
attacking = false
talk_state = 0
gstat = 0 -- guild status
grank = '' -- guild rank
gname = '' -- guild name
cname = '' -- name of player who talks to us
pname = '' -- name of some other player
maxnamelen = 30
maxranklen = 20
maxnicklen = 20
leaderlevel = 50
NONE = 0
INVITED = 1
MEMBER = 2
VICE = 3
LEADER = 4
allow_pattern = '^[a-zA-Z0-9 -]+$'

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
talkstate = 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 (msgcontains(msg, 'hi') and focus == 0) and getDistanceToCreature(cid) < 4 then
queststatus = getPlayerStorageValue(cid,1234)
religia = getPlayerStorageValue(cid,1235)
innowierca = getPlayerStorageValue(cid,1236)
if queststatus == 1 then
selfSay('PADAM NA TWARZ PRZED TWA POTEGA ' .. creatureGetName(cid) .. '!!')
focus = cid
talk_start = os.clock()
elseif religia == 1 then
selfSay('Witaj w swiatyni Uraja ' .. creatureGetName(cid) .. '! w czym moge ci pomoc? Chcesz sie dowiedziec czegos na temat "pomoc w miescie" a moze "blogoslawienstwo" ci jest potrzebne ??')
focus = cid
talk_start = os.clock()
talkstate=2
elseif religia == -1 and innowierca == -1 then

selfSay('Witaj w swiatyni Uraja ' .. creatureGetName(cid) .. '! czy chcesz wstapic w szeregi wyznawcow ?? ')
focus = cid
talkstate=1
talk_start = os.clock()

elseif religia == -1 and innowierca == 1 then
selfSay('Witaj w swiatyni Uraja ' .. creatureGetName(cid) .. '! twoim bogiem jest Moera, nie dla ciebie sa blogoslawienstwa Uraja ')
focus = cid
talkstate=9
talk_start = os.clock()
end

elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Wybacz ale moje jestejstwo pragnie byc jednoscia i nie moge przez to rozmawiac z dwojgiem')

elseif focus == cid then
talk_start = os.clock()

if msgcontains(msg, 'tak') and talkstate == 1 then
selfSay('Uraj jest bogiem wojny, bogiem gniewy i krwi. Jego wyznawcy nie boja sie umierac, ale w walce odznaczaja sie szalenczym poswieceniem. Czy jestes pewny swego wyboru?')
talkstate=3
elseif msgcontains(msg, 'tak') and talkstate == 3 then
selfSay('Wstepujesz w szeregi wyznawcow niesmiertelnego Uraja. Przysiegnij ze nigdy nie ulekniesz sie w walce i nigdy twoj miecz nie zadrzy przed ciosem. Powiedz "przysiegam"')
talkstate=4
elseif msgcontains(msg, 'przysiegam') and talkstate == 4 then
selfSay('Przylaczyles sie do naszej wspanialej religi. Niektorzy kupcy sa naszymi wyznawcami, beda mieli dla ciebie male upusty')
setPlayerStorageValue(cid,1235,1)
talkstate=2
elseif msgcontains(msg, 'pomoc w miescie') and talkstate == 2 then
selfSay('Dark rodo ma teraz dla ciebie tansze SD i gfb, Mozliwe ze uda nam sie przeciagnac Freda do naszej religi. Rzeznik juz jest z nami.')

elseif msgcontains(msg, 'blogoslawienstwo') and talkstate == 2 then
selfSay('Narazie Uraj obdarzyl mnie tylko moca leczenia, powiedz czy potrzebne ci "uleczenie" ?')
elseif msgcontains(msg, 'uleczenie') and talkstate == 2 then
selfSay('uhy')

elseif string.find(msg, '(%a*)bye(%a*)') and getDistanceToCreature(cid) < 4 then
selfSay('Idz w pokoju bracie , ' .. creatureGetName(cid) .. '!')
focus = 0
talk_start = 0
end
end
end


function onCreatureChangeOutfit(creature)

end


function onThink()
if (os.clock() - talk_start) > 30 then
if focus > 0 then
selfSay('Uraj nie jest cierpliwym bogiem... odejdz teraz.')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Odejdz w pokoju')
focus = 0
end
end
endoraz drugi o nazwie: kaplan Moery.lua

Kod HTML:

-----Religia by GM Maciej----
focus = 0
talk_start = 0
target = 0
following = false
attacking = false
talk_state = 0
gstat = 0 -- guild status
grank = '' -- guild rank
gname = '' -- guild name
cname = '' -- name of player who talks to us
pname = '' -- name of some other player
maxnamelen = 30
maxranklen = 20
maxnicklen = 20
leaderlevel = 50
NONE = 0
INVITED = 1
MEMBER = 2
VICE = 3
LEADER = 4
allow_pattern = '^[a-zA-Z0-9 -]+$'
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
talkstate = 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 (msgcontains(msg, 'hi') and focus == 0) and getDistanceToCreature(cid) < 4 then
queststatus = getPlayerStorageValue(cid,1234)
religia = getPlayerStorageValue(cid,1236)
innowierca = getPlayerStorageValue(cid,1235)
if queststatus == 1 then
selfSay('PADAM NA TWARZ PRZED TWA POTEGA ' .. creatureGetName(cid) .. '!!')
focus = cid
talk_start = os.clock()
elseif religia == 1 then
selfSay('Witaj w swiatyni Moery ' .. creatureGetName(cid) .. '! co cie tu sprowadza ?Pragniesz dowiedziec sie o "pomoc w miescie" a moze "blogoslawienstwo" Moery to to czego pragnie twoja dusza ??')
focus = cid
talk_start = os.clock()
talkstate=2
elseif religia == -1 and innowierca == -1 then

selfSay('Witaj w swiatyni Moery ' .. creatureGetName(cid) .. '! czy chcesz wstapic w szeregi jej wyznawcow ?? ')
focus = cid
talkstate=1
talk_start = os.clock()

elseif religia == -1 and innowierca == 1 then
selfSay('Witaj w swiatyni Moery ' .. creatureGetName(cid) .. '! twoim bogiem jest Uraj, idz do jego swiatyni po blogoslawienstwa ')
focus = cid
talkstate=9
talk_start = os.clock()
end

elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Dwoje uszu jeden rozmowca przyjacielu... poczekaj na swa kolej.')

elseif focus == cid then
talk_start = os.clock()

if msgcontains(msg, 'tak') and talkstate == 1 then
selfSay('Moera jest boginia natury, jej domena to ochrona i leczenie, czy chcesz przylaczyc sie do nieskonczonej krucjaty przeciwko zlu?')
talkstate=3
elseif msgcontains(msg, 'tak') and talkstate == 3 then
selfSay(' Pragniesz wstapic w szeregi wyznawcow Moery... Bedzie to od ciebie wymagalo wielu ofiar... bedziesz szezyl dobro i niszczyl zlo. Powiedz "przysiegam"')
talkstate=4
elseif msgcontains(msg, 'przysiegam') and talkstate == 4 then
selfSay('Przylaczyles sie do naszej wspanialej religi. W miescie jest kilku naszych wyznawcow beda zobowiazani ci pomagac.')
setPlayerStorageValue(cid,1236,1)
talkstate=2
elseif msgcontains(msg, 'pomoc w miescie') and talkstate == 2 then
selfSay('Dark rodo ma teraz dla ciebie tansze UH, Edgar sprzeda ci manaruny po cenie hurtowej, Sabuhad - dimadal moze da ci wiecej za skarby ktore do niego przyniesiesz...')

elseif msgcontains(msg, 'blogoslawienstwo') and talkstate == 2 then
selfSay('Narazie Moera obdarzyla mnie tylko moca leczenia, powiedz czy potrzebne ci "uleczenie" ?')
elseif msgcontains(msg, 'uleczenie') and talkstate == 2 then
selfSay('uhy')

elseif string.find(msg, '(%a*)bye(%a*)') and getDistanceToCreature(cid) < 4 then
selfSay('Idz w pokoju bracie , ' .. creatureGetName(cid) .. '!')
focus = 0
talk_start = 0
end
end
end


function onCreatureChangeOutfit(creature)

end


function onThink()
if (os.clock() - talk_start) > 30 then
if focus > 0 then
selfSay('Moera jest cierpliwa, ale nie naduzywaj boskiej cierpliwosci przyjacielu... teraz odejdz')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Odejdz w pokoju')
focus = 0
end
end
enddo katalogu data/npc wklejamy takie dwa skrypty:
arcyuraja.xml :

Kod HTML:
<?xml version="1.0"?>
<npc name="Arcykaplan Uraja" script="data/npc/scripts/kaplan uraja.lua" access="3">
<look type="130" head="114" body="94" legs="114" feet="114"/>
</npc>arcymoery.xml :

Kod HTML:
<?xml version="1.0"?>
<npc name="Arcykaplan Moery" script="data/npc/scripts/kaplan Moery.lua" access="3">
<look type="130" head="0" body="86" legs="0" feet="0"/>
</npc>do data/world/npc.xml dodajemy dwie linijki :

Cytuj:
<npc name="arcymoery" x="wspolrzednaX" y="wspolrzednaY" z="wspolrzednaZ" dir="0"/>
<npc name="arcyuraja" x="wspolrzednaX" y="wspolrzednaY" z="wspolrzednaZ" dir="0"/>

teraz zamieniamy w data/npc/scripts/food.lua zawartość pliku na:

Kod HTML:
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 (msgcontains(msg, 'hi') and focus == 0) and getDistanceToCreature(cid) < 4 then
queststatus = getPlayerStorageValue(cid,1234)
if queststatus == 1 then
selfSay('CZCIGODNY... w czym ja, twoj unizony sluga moge ci pomoc ??')
focus = cid
talk_start = os.clock()
else

selfSay('He.. zarznalem dorodnego prosiaka, chcesz obakac??Sprzedaje , meat, carrots, apples, brown breads, brown mushrooms and eggs (wszystko po 5gps a dla wyznawcow Uraja po 2 gp).')
focus = cid
talk_start = os.clock()
end

elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Czekaj, gadam.')

elseif focus == cid then
talk_start = os.clock()
religia = getPlayerStorageValue(cid,1235)
if msgcontains(msg, 'brown bread') then
if religia == 1 then
buy(cid,2691,1,2)
else
buy(cid,2691,1,5)
end
elseif msgcontains(msg, 'ham') then
if religia == 1 then
buy(cid,2671,1,2)
else
buy(cid,2671,1,5)
end
elseif msgcontains(msg, 'carrot') then
if religia == 1 then
buy(cid,2684,1,2)
else
buy(cid,2684,1,5)
end
elseif msgcontains(msg, 'meat') then
if religia == 1 then
buy(cid,2666,1,2)
else
buy(cid,2666,1,5)
end
elseif msgcontains(msg, 'apple') then
if religia == 1 then
buy(cid,2674,1,2)
else
buy(cid,2674,1,5)
end
elseif msgcontains(msg, 'brown mushroom') then
if religia == 1 then
buy(cid,2789,1,2)
else
buy(cid,2789,1,5)
end
elseif msgcontains(msg, 'egg') then
if religia == 1 then
buy(cid,2695,1,2)
else
buy(cid,2695,1,5)
end

elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
selfSay('Wpadnij jak bede mial cos ekstra pod lada, ' .. creatureGetName(cid) .. '!')
focus = 0
talk_start = 0
end
end
end


function onCreatureChangeOutfit(creature)

end


function onThink()
if (os.clock() - talk_start) > 30 then
if focus > 0 then
selfSay('Eeee dawac szybko kto dalej ??')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Yyyy poszedl, a nie sprobowal baleronu')
focus = 0
end
end
end
w data/npc/scripts/runes.lua znajdujemy linijke:

Cytuj:
elseif focus == cid then
talk_start = os.clock()

(bedzie ona zaraz po linijce opisującej co ma NPC zrobić jeśli ktoś powi hi a NPC już z kimś rozmawia.
i po niej wklejamy tekst:

Kod HTML:
Uraj = getPlayerStorageValue(cid,1235)
Moera = getPlayerStorageValue(cid,1236)
if Moera == 1 then
cena1=2
cena10=20
cena100=200
else
cena1=10
cena10=100
cena100=1000
endoczywiście ceny dowolne
oraz zamieniamy:

Kod HTML:
elseif msgcontains(msg, '100 gfb') then
buy(cid,2304,100,2000)
elseif msgcontains(msg, '10 gfb') then
buy(cid,2304,10,200)
elseif msgcontains(msg, 'gfb') then
buy(cid,2304,3,60)na :

Kod HTML:
elseif msgcontains(msg, '100 gfb') then
if Uraj == 1 then
buy(cid,2304,100,400)

else
buy(cid,2304,100,900)
end
elseif msgcontains(msg, '10 gfb') then
if Uraj == 1 then
buy(cid,2304,10,40)
else
buy(cid,2304,10,90)
end
elseif msgcontains(msg, 'gfb') then
if Uraj == 1 then
buy(cid,2304,1,4)
else
buy(cid,2304,1,9)
endlinijke:

Kod HTML:
buy(cid,2313,3,60)

elseif msgcontains(msg, '100 sd') then
buy(cid,2268,100,9000)
elseif msgcontains(msg, '10 sd') then
buy(cid,2268,10,900)
elseif msgcontains(msg, 'sd') then
buy(cid,2268,1,90)na:

Kod HTML:
elseif msgcontains(msg, '100 sd') then
if Uraj == 1 then
buy(cid,2268,100,1500)
else
buy(cid,2268,100,4000)

end
elseif msgcontains(msg, '10 sd') then
if Uraj == 1 then
buy(cid,2268,10,150)
else
buy(cid,2268,10,400)
end
elseif msgcontains(msg, 'sd') then
if Uraj == 1 then
buy(cid,2268,1,15)
else
buy(cid,2268,1,40)
endlinijke:

Kod HTML:
elseif msgcontains(msg, '100 uh') then
buy(cid,2273,100,4000)
elseif msgcontains(msg, '10 uh') then
buy(cid,2273,10,400)
elseif msgcontains(msg, 'uh') then
buy(cid,2273,1,40)na:

Kod HTML:
elseif msgcontains(msg, '100 uh') then
buy(cid,2273,100,cena100)

elseif msgcontains(msg, '10 uh') then
buy(cid,2273,10,cena10)
elseif msgcontains(msg, 'uh') then
buy(cid,2273,1,cena1)domyślnie na moim serverze wyznawcy moery mają więcej kasy na skupie kryształków i tańsze mana runki. Ale to łatwo skopiować samemu. Działa na YurOTS_094c i jest sprzężone z "respekt dla GMa".
@@
Sprawdziłem i chyba wszystko jest, jeśli coś wam nie działa radze jeszcze raz dokładnie sprawdzić czy wszystko poprawnie zrobiliście. To po pierwsze a po 2:
modyfikacje wprowadzone do food.lua i runes.lua nie powodują żadnych błędów same z siebie, nawet jeśli nie ma wogule kapłanów wgranych. Jeśli ktoś ma wątpliwości to zapraszam na earth server : ip: 85.14.102.35 tu można sobie to obejrzeć
@@
Ludzie opanujta się jestem wierzącym i (praktykującym - aż wstyd żę trzxeba to dzisiaj dodawać) i jakoś nie mam oporów przed pisaniem takich skryptów.. jeśli ktoś ma jakieś problemy z odróżnieniem tego świata od wyimaginowanego świata Tibi to niech mio napisze, znam kilku dobrych specjalistów od takich problemów

Powered by phpBB © 2001,2002 phpBB Group