 |
|
 |
|
Xarin
Nowy
Dołączył: 07 Lis 2006
Posty: 19
Przeczytał: 0 tematów
Ostrzeżeń: 0/10 Skąd: Poland
|
|
 |
|
 |
|
Wysłany: Śro 16:07, 08 Lis 2006 Temat postu: Więzienie czyli miejsce dla przestempcow |
|
|
Zostalem zkarcony za poprzedni temat w propozycjach artykułów ale rozumiem
wasze niezadowolenie Sam niebylem z siebie zadowolony postanowilem napisac to jeszcze raz tu ale już bez tamtych blendów.
No wienc chcialbym przedstawic "system wienzienniczy"
Poco dawac komus bana lepiej niech odsiedzi swoje w kiciu
Na poczontek BUDYNEK WIENZIENIA
Ma to byc sala z przylonczonymi 7 celami (bez przejscia do sali z celi).
Np:
Oczywiscie to wienzienie to tylko przykład można je dowolnie zmnieciac (ale trzeba pamientac 1 sala i 7 cel)
No to tyle murowania czas przejsc dalej.
RUNKA PRZENOSZONCA PRZESTĘPCE DO JEDNEJ Z CEL
Najpierw tworzymy w data/action/scripts plik o nazwie celarune.lua a w jego tresci piszemy:
Kod:
function onUse(cid, item, frompos, item2, topos)
if getPlayerAccess(cid) >=2 then
creature2pos = {x=topos.x, y=topos.y, z=topos.z, stackpos=253}
creature2 = getThingfromPos(creature2pos)
doPlayerSendTextMessage(cid,22,"Acces sprawdzony")
ileposiedziminut = item.type
if ileposiedziminut == 0 then
ileposiedziminut = 1
end
doPlayerSendTextMessage(cid,22,"Blokada O")
odktorej = os.date('%M')
doktorej = odktorej + ileposiedziminut
if doktorej >= 60 then
dogodziny = os.date('%H') + 1
dominuty = 60 - doktorej
else
dogodziny = os.date('%H')
dominuty = doktorej
end
doPlayerSendTextMessage(cid,22,"Ustalono godzine")
xxx = os.date('%d')
doPlayerSendTextMessage(cid,22,"Ustalono dzien")
if creature2.itemid > 0 then
cela1={x=161, y=220, z=8}
cela2={x=152, y=225, z=8}
cela3={x=154, y=237, z=8}
cela4={x=161, y=242, z=8}
cela5={x=170, y=236, z=8}
cela6={x=170, y=230, z=8}
cela7={x=169, y=223, z=8} doPlayerSendTextMessage(cid,22,"Wykryto obecnosc gracza")
rand = math.random(1,7)
if rand == 1 then
doTeleportThing(creature2.uid,cela1)
elseif rand == 2 then
doTeleportThing(creature2.uid,cela2)
elseif rand == 3 then
doTeleportThing(creature2.uid,cela3)
elseif rand == 4 then
doTeleportThing(creature2.uid,cela4)
elseif rand == 5 then
doTeleportThing(creature2.uid,cela5)
elseif rand == 6 then
doTeleportThing(creature2.uid,cela6)
elseif rand == 7 then
doTeleportThing(creature2.uid,cela7)
end
doPlayerSendTextMessage(cid,22,"Teleportowano")
setPlayerStorageValue(creature2.uid,328,dominuty)
setPlayerStorageValue(creature2.uid,326,dogodziny)
setPlayerStorageValue(creature2.uid,327,xxx)
doPlayerSendTextMessage(cid,22,"Kara zapisana")
doPlayerSendTextMessage(cid,22,"Poszedl siedziec na kilka minut.")
doPlayerSendTextMessage(creature2.uid,18,"Kara wynosi do 100 minut w wiezieniu, nie wiesz na ile cie GM posadzil.")
else
doPlayerSendCancel(cid,"Pudlo.")
end
else
doPlayerSendCancel(cid,"IDZ Z TYM PRZEDMIOTEM DO GM MACIEJA A DOSTANIESZ WYSOKA NAGRODE")
end
return 1
end
tutaj wpisujemy zgodnie z tym co narysowaliśmy na swojej mapie.
(karzda z cel ma jedną kratke na ktorą ma byc teleportowany player, tylko cele nie sala główna)
cela1={x=161, y=220, z=8}
cela2={x=152, y=225, z=8}
cela3={x=154, y=237, z=8}
cela4={x=161, y=242, z=8}
cela5={x=170, y=236, z=8}
cela6={x=170, y=230, z=8}
cela7={x=169, y=223, z=8}
Nastempnie dodajesz w pliku data/actions/actions.xml linijke:
Kod:
<action itemid="XXXX" script="celarune.lua" />
zastępując znaki XXXX dowolnym numerem RUNY !!!!!<czyli np 2312
Ilość minut spędzonych w więzieniu jest równa ILOŚCI POCISKÓW runy. Pociski nie ubywają podczas zużywania !!!!
To wszystko zwionzane z runkol
TERAZ NPC STRAŻNIK
w data/npc tworzysz plik o nazwie Straznik.xml a w nim piszesz to:
Kod:
<?xml version="1.0"?>
<npc name="Straznik" script="data/npc/scripts/Straznik.lua" access="3">
<look type="128" head="22" body="98" legs="132" feet="115"/>
</npc>
A w data/npc/scrips trzorzysz plik o nazwie Straznik.lua o tresci:
Kod:
focus = 0
talk_start = 0
target = 0
cname = ''
following = false
attacking = false
gopos = 0
czas = 0
godzina1 = 0
dzisiaja = 0
dzisiaj = 0
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)
cname = creatureGetName(cid)
msg = string.lower(msg)
if (msgcontains(msg, 'hi') and focus == 0) and getDistanceToCreature(cid) < 4 then
czydzisiaj = getPlayerStorageValue(cid,327)
dzisiaj = os.date('%d')
setPlayerStorageValue(cid,331,dzisiaj)
dzisiaja = getPlayerStorageValue(cid,331)
if czydzisiaj == dzisiaja then
godzina = os.date('%H')
minuta = os.date('%M')
doktorejh = getPlayerStorageValue(cid,326)
doktorejm = getPlayerStorageValue(cid,328)
setPlayerStorageValue(cid,333,godzina)
ileh = godzina - doktorejh
if ileh < 2 then
godzina1 = getPlayerStorageValue(cid,333)
if doktorejh == godzina1 then
setPlayerStorageValue(cid,332,minuta)
minuta1 = getPlayerStorageValue(cid,332)
if doktorejm > minuta1 then
selfSay('Cicho tam !! Jeszcze nie wychodzisz !!! Siedzisz jeszcze pare minut')
else
selfSay('Nastepnym razem zachowuj sie poprawnie.')
selfSay('/send ' .. cname .. ', 160 54 7')
end
else
selfSay('Cicho tam !!! Jeszcze sobie posiedzisz troszke !!!!')
end
else
selfSay('Nastepnym razem zachowuj sie poprawnie, posiedziales pare godzin i widzisz jaki jestes spokojny?')
selfSay('/send ' .. cname .. ', 160 54 7')
end
else
selfSay('Nastepnym razem zachowuj sie poprawnie to nie bedziesz siedzial calego dnia.')
selfSay('/send ' .. cname .. ', 160 54 7')
end
end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
if (os.clock() - talk_start) > 30 then
if focus > 0 then
selfSay('Macie za swoje CHAMY !!!!!')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('I nie mysl ze nie patrze !!!!')
focus = 0
end
end
if (os.clock() - gopos) > 1 then
ldx = 157
pdx = 166
pgx = 166
lgx = 157
ldy = 237
pdy = 237
lgy = 225
pgy =225
cx, cy, cz = selfGetPosition()
if cx == ldx and cy < ldy then
ny = cy + 1
nx = cx
elseif cx == pgx and cy > pgy then
ny = cy - 1
nx = cx
elseif cy == pdy and pdx < 166 then
nx = cx + 1
ny = cy
elseif cy == pgy and cx > lgx then
nx = cx - 1
ny = cy
end
gopos = os.clock()
moveToPosition(nx, ny, cz)
--summons = 30
--summons2 = 30
end
end
UWAGA!!
linijki:
ldx = 157
pdx = 166
pgx = 166
lgx = 157
ldy = 237
pdy = 237
lgy = 225
pgy =225
nalerzy sobie ustawić wedlug:
pd = prawy dolny
pg = prawy górny
ld = lewy dolny
lg = lewy górny
To jest to po czym bendzie sie poruszal npc (muszol byc wieszcholki prostokonta lub kwadratu)(to sala glowna)
Uwaga!!!
-npc musi sie znajdowac na jednym z wieszcholkow lub na trasie inaczej nici z poruszania sie
-Aby zapobiec ucieczce dokonujemy w skrypcie teleportera nastempujoncych zmian
zaraz po linijce:
Kod:
function onUse(cid, item, frompos, item2, topos)
dodajemy:
Kod:
posp = getPlayerPosition(cid)
mozna = getTilePzInfo(posp)
if mozna == 0 then
a na koncu przed slowem "end":
Kod:
else
doPlayerSendCancel(cid,"Nie w Protection zone !!!.")
end
CALOL POWIESZCHNIE WIENZIENIA POKRYWAMY PROTECTION ZONE
tO BY BYLO NA TYLE MYSLE ZE ZECHCECIE ZAMIESCIC WIENZIENIE NA SWOIM OTSIE
Aha jesli chcecie dodac npc Straznika to data/worls/npc.xml i dodajevcie linijke :
Kod:
<npc name="Straznik" x="xx" y="xx" z="x"/>
zamiast xxx wasze wspulrzędne sali w wiezienia
Post został pochwalony 0 razy
|
|