Witamy Na OTS Fans, Przeczytaj Regulamin lub Zarejestruj się.
Założyciel
Autorem Jest Steel
Oryginalny Temat
Witam serdecznie
Stworzylem dla Was pewien skrypcik
Opis
Skrypt ma za zadanie "Wydobywac miecz ze skaly" po wykonaniu okreslonej misji. Dziala on na zasadzie losowania, w ktorym bierze gracz podczas uzycia skryptu.
Skryptu mozna uzyc raz na restart serwera
Wystawiam Wam zarowno skrypt, jak i NPC. Skrypt zostal wymyslony i stworzony przeze mnie, natomiast dziekuje rowniez Baabuskowi za podawane pomysly na rozwiazanie ewentualnych problemow
Instalacja
Zacznijmy od skryptu na samo wyciaganie miecza ze skaly
Najpierw przygotujmy sobie przestrzen na mapie, gdzie taki skrypt umiescic
U mnie wyglada to tak:
<<SCREEN>>
Nastepnie, wejdz w actions/actions.xml i wklejcie:
<action uniqueid="5755" script="miecz_w_skale.lua" />
Po wykonaniu tej czynnosci wejdzcie do katalogu actions/scripts i stworzcie plik o nazwie miecz w skale z rozszerzeniem *LUA po czym wklej do niego ten oto skrypt:
--[[ [url]www.press-play.pl[/url] Skrypt wykonany przez Steel Pomoc: Baabuseek ]] function onUse(cid, item, frompos, item2, topos) quest = getPlayerStorageValue(cid,7544) if quest <= 1 then doPlayerSendTextMessage(cid,22,"Ani drgnie...") end pos = {x=374, y=438, z=7, stackpos=1} -- WAZNE! POZYCJA MIECZA <zmien na wlasna> los = math.random(1, 100) quest = getPlayerStorageValue(cid,7544) npos = getThingfromPos(pos) doRemoveItem(npos.uid,1) if quest == 2 then if item.uid == 5755 and item.itemid == 1945 and los == 1 then doCreateItem(2160,1,cid) doPlayerSendTextMessage(cid,22,"Wydobyles miecz!") doSendMagicEffect(pos,3) doTransformItem(item.uid,item.itemid+1) doRemoveItem(npos.uid,1) elseif item.itemid == 1945 and los >= 2 then doPlayerSendTextMessage(cid,22,"Nie udalo Ci sie wydobyc miecza") doTransformItem(item.uid,item.itemid+1) end if item.itemid == 1946 then doPlayerSendTextMessage(cid,22,"Musisz poczekac, zanim mechanizm znow zacznie dzialac") end end return 1 end
NIE ZAPOMNIJ O ZMIANIE WSPOLRZEDNYCH NA SWOJE!
Nastepnie otworz katalog data/npc/ i stworz plik o nazwie mnich w rozszerzeniu *XML
Wklej do niego to:
<?xml version="1.0"?> <npc name="Mnich" script="data/npc/scripts/mnich.lua" access="3"> <look type="57" head="20" body="30" legs="40" feet="50"/> </npc>
Nastepnie wejdz w data/npc/script, stworz plik o nazwie mnich o rozszerzeniu *LUA
Wklej do niego to:
--[[ [url]www.press-play.pl[/url] Skrypt wykonany przez Steel Pomoc: Baabuseek ]] 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('Bywaj.') 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*)witaj(%a*)')) and (focus == 0)) and getDistanceToCreature(cid) < 4 then talkstatus = getPlayerStorageValue(cid,7544) if talkstatus <= 1 then selfSay('Oh, witaj wedrowcze. Co Cie tutaj sprowadza? \n\n 1. Powiedz mi prosze mnichu cos wiecej o tym miejscu \n 2. Interesuje mnie miecz w kamieniu, ktory widzialem po drodze') setPlayerStorageValue(cid,7544,-1) focus = cid talk_start = os.clock() elseif talkstatus >= 2 then selfSay('Nie mam teraz czasu') focus = 0 talk_start = 0 end end if string.find(msg, '(%a*)witaj(%a*)') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then selfSay('Porozmawiany za chwile...') end if msgcontains(msg, '1') and focus == cid then talk_start = os.clock() talkstatus = getPlayerStorageValue(cid,7544) if talkstatus == -1 then selfSay('Znajdujemy sie w Glamorgan. Jest to nie wielka wioska posiadajaca bardzo piekna historie. Wiecej mozesz sie dowiedziec z tutjeszych ksiag.') elseif talkstatus == 0 then selfSay('Dobrze, w takim wypadku zezwole Ci na probe wydobycia miecza... Ale najpierw musisz mi zaplacic jedna krysztalowa monete \n\n 1. Prosze, oto moneta \n 2. Dobrze, wroce pozniej') setPlayerStorageValue(cid,7544,1) elseif talkstatus == 1 and doPlayerRemoveItem(cid,2160) then selfSay('Swietnie, w takim wypadku idz i sproboj swoich sil. Moze bedziesz pierwszym, ktoremu uda sie wyciagnac legendarny miecz...') setPlayerStorageValue(cid,7544,2) end end if msgcontains(msg, '2') and focus == cid then talk_start = os.clock() talkstatus = getPlayerStorageValue(cid,7544) if talkstatus == -1 then selfSay('Ah, ten miecz... Jeszcze nikt go nie wydobyl z kamienia... Chcesz sprobowac?\n\n 1. Tak \n 2. Nie ') setPlayerStorageValue(cid,7544,0) elseif talkstatus == 0 then selfSay('Dobrze, w takim wypadku wroc kiedy zrozumiesz, ze tracisz swoja zyciowa szanse...') elseif talkstatus == 1 then selfSay('Czy masz dla mnie krysztalowa monete? \n\n 1. Tak \n 2. Nie ') elseif talkstatus == 2 then selfSay('Wykonales juz zadanie') end end if string.find(msg, '(%a*)bywaj(%a*)') and focus == cid and getDistanceToCreature(cid) < 4 then selfSay('Bywaj, ' .. 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('Odejdz wedrowcze') end focus = 0 end if focus ~= 0 then if getDistanceToCreature(focus) > 5 then selfSay('Bywaj') focus = 0 end end end
Brawo, jezeli zastosowales sie do wskazowek, wszystko powinno dzialac bez zadnych problemow.
Dodaj teraz NPC na mape w miejscu nieopodal skryptu wydobywania miecza ze skaly i wszystko bedzie wygladac jak nalezy.
Zabraniam kopiowania skryptow z usunietym komentarzem na inne fora, ktore widniejai na ich poczatku
Offline