WaldirJunior 4 Postado Dezembro 23, 2010 Share Postado Dezembro 23, 2010 (editado) Meu primeiro post aqui no XTibia. :smile_positivo: Pokemon Online Server 8.54 Estava pensando como fazer o Player logo que criar o char possa escolher a cidade a onde morar, ai lembrei dos tempos que jogava Tibia , que tinha que falar com o Oracle para escolher a vocação e a city. Resolvi colocar no meu P.O Server e deu certo. Vamos logo com o script: Va na pasta data\npc . criei um documento XML (Professora Oak) <?xml version="1.0" encoding="UTF-8"?> <npc name="Professora Oak" floorchange="0" walkinterval="0" script="data/npc/scripts/oracle.lua"> <health now="150" max="150"/> <look type="251" head="114" body="119" legs="114" feet="114" corpse="2212"/> </npc> depois va em data\npc\scripts e criei um arquivo lua (oracle) -- area editavel Oracle = { Cities = { -- {id, 'nome', x, y, z, 'premium/free'} {1, 'cerulean',1060,903, 7, 'free'}, {2,'saffron',1032,1058,7,'free'}, {3,'celadon',862,1035,6,'premium'} }, Vocations = { -- {[id] = 'nome'} [1] = 'treinador', [2] = 'viajante', [3] = 'vagabundo', [4] = 'vendedor' }, frases = { noLevel = 'CRIANÇA! Volte quando você estiver crescida!', hi = 'Você está preparado para encarar o seu destino?', askVoc = 'Que vocação você deseja', confirmVoc = 'TEM CERTEZA? PRESENTE decisão é irreversível.', askCity = 'Você quer viver em:', final = 'Boa sorte em sua VIAGEM!', bye = 'Volte quando você se sente preparado' }, talkStorage = 7897, choos = {}, citiesLiberadas = {} } -- fim da area editavel local function getVocations() local ret = "" for id,it in pairs(Oracle.Vocations) do if((id ~= #Oracle.Vocations - 1) and (id ~= #Oracle.Vocations)) then ret = ret.. it ..", " end if(id == #Oracle.Vocations) then ret = ret.. it .."?" elseif(id == #Oracle.Vocations - 1) then ret = ret.. it .." or " end end return ret end --[[> npc por Evesys/Eventide <------------------------------------- \m/ <[------]> \m/ -------------------------------------------> <----> CONSERVE OS CREDITOS <----> <--> 100% por Eventide e Drifitooh <----><]]-- local focuses = {} local function isFocused(cid) for i, v in pairs(focuses) do if(v == cid) then return true end end return false end local function addFocus(cid) if(not isFocused(cid)) then table.insert(focuses, cid) end end local function removeFocus(cid) for i, v in pairs(focuses) do if(v == cid) then table.remove(focuses, i) break end end end local function lookAtFocus() for i, v in pairs(focuses) do if(isPlayer(v) == TRUE) then doNpcSetCreatureFocus(v) return end end doNpcSetCreatureFocus(0) end function onCreatureAppear(cid) end function onCreatureDisappear(cid) if(isFocused(cid)) then selfSay(Oracle.frases.bye, cid) removeFocus(cid) end end function onCreatureSay(cid, type, msg) talkstate = getPlayerStorageValue(cid, Oracle.talkStorage) if((msg == "hi") and not (isFocused(cid))) then addFocus(cid) if(getPlayerLevel(cid) > 7) then selfSay(Oracle.frases.hi, cid) else selfSay(Oracle.frases.nolevel, cid) end setPlayerStorageValue(cid, Oracle.talkStorage, 1) end talkstate = getPlayerStorageValue(cid, Oracle.talkStorage) if((talkstate == 1) and (msg == "yes") and (isFocused(cid))) then selfSay(" ".. Oracle.frases.askVoc .." ".. getVocations(), cid) setPlayerStorageValue(cid, Oracle.talkStorage, 2) end talkstate = getPlayerStorageValue(cid, Oracle.talkStorage) if((talkstate == 2) and (isFocused(cid))) then for it = 1, #Oracle.Vocations do if(msg == Oracle.Vocations[it]) then selfSay(Oracle.frases.confirmVoc, cid) Oracle.choos.voc = it setPlayerStorageValue(cid, Oracle.talkStorage, 3) break end end end talkstate = getPlayerStorageValue(cid, Oracle.talkStorage) if((talkstate == 3) and (isFocused(cid)) and (msg == "yes")) then for _,it in pairs(Oracle.Cities) do if((isPremium(cid)) and (it[6] == "premium")) then table.insert(Oracle.citiesLiberadas, it) elseif(it[6] == "free") then table.insert(Oracle.citiesLiberadas, it) end end ret = "" for id,it in pairs(Oracle.citiesLiberadas) do if((id ~= #Oracle.citiesLiberadas - 1) and (id ~= #Oracle.citiesLiberadas)) then ret = ret.. it[2] ..", " elseif(id == #Oracle.citiesLiberadas) then ret = ret.. it[2] .."?" elseif(id == #Oracle.citiesLiberadas - 1) then ret = ret.. it[2] .." or " end end selfSay(" ".. Oracle.frases.askCity .. ret .." ", cid) setPlayerStorageValue(cid, Oracle.talkStorage, 4) end talkstate = getPlayerStorageValue(cid, Oracle.talkStorage) if((talkstate == 4) and (isFocused(cid)))then for id,it in pairs(Oracle.citiesLiberadas) do if(msg == it[2]) then Oracle.choos.city = it break end end selfSay("VOCÊ ESCOLHEU SER ".. Oracle.Vocations[Oracle.choos.voc] ..", E MORAR EM ".. Oracle.choos.city[2] ..". Esta correto?", cid) setPlayerStorageValue(cid, Oracle.talkStorage, 5) end talkstate = getPlayerStorageValue(cid, Oracle.talkStorage) if((talkstate == 5) and (isFocused(cid)) and (msg == "yes")) then selfSay(Oracle.frases.final, cid) local goto = {x = Oracle.choos.city[3], y = Oracle.choos.city[4], z = Oracle.choos.city[5]} doTeleportThing(cid, goto) doPlayerSetTown(cid, Oracle.choos.city[1]) doPlayerSetVocation(cid, Oracle.choos.voc) setPlayerStorageValue(cid, Oracle.talkStorage, -1) choos.city = 0 choos.voc = 0 removeFocus(cid) end talkstate = getPlayerStorageValue(cid, Oracle.talkStorage) if((isFocused(cid)) and (msg == "bye") or not(isFocused(cid)) and (talkstate ~= -1) and (msg == bye)) then selfSay(Oracle.frases.bye, cid) setPlayerStorageValue(cid, Oracle.talkStorage, -1) Oracle.choos.city = 0 Oracle.choos.voc = 0 removeFocus(cid) end end function onPlayerCloseChannel(cid) if(isFocused(cid)) then selfSay(frases.bye, cid) setPlayerStorageValue(cid, Oracle.talkStorage, -1) removeFocus(cid) end end function onThink() for i, focus in pairs(focuses) do if(isCreature(focus) == FALSE) then removeFocus(focus) else local distance = getDistanceTo(focus) or -1 if((distance > 4) or (distance == -1)) then selfSay(Oracle.frases.bye, cid) removeFocus(focus) end end end lookAtFocus() end Para mudar ou add mais city , so mudar essa parte { -- {id, 'nome', x, y, z, 'premium/free'} {1, 'cerulean',1060,903, 7, 'free'}, {2,'saffron',1032,1058,7,'free'}, {3,'celadon',862,1035,6,'premium'} Ele não vai fazer isso para os players que tiverem menos que level 7!Para mudar isso , so modificar: if(getPlayerLevel(cid) > 7) then Editado Dezembro 26, 2010 por Jafsdaffff Link para o comentário Compartilhar em outros sites More sharing options...
AlphaLove 39 Postado Dezembro 23, 2010 Share Postado Dezembro 23, 2010 Vllw Por disponibiliza o COnteudo aii man, Boa Idéia ;D Galera sempre Inovando com seus Scripts de PO ^^ Link para o comentário Compartilhar em outros sites More sharing options...
Dudu08267 7 Postado Dezembro 24, 2010 Share Postado Dezembro 24, 2010 Otimo script REP++ seria uma boa colocar assim que capturasse 1 pokemon ele pudesse escolher uma cidadeno pokemon adventures o cara captura um poke com a ball 100% e teleportado pro laboratorio do professor Link para o comentário Compartilhar em outros sites More sharing options...
WaldirJunior 4 Postado Dezembro 25, 2010 Autor Share Postado Dezembro 25, 2010 Estou tentando fazer o P.O Server , ser mais parecido com o Pokemon de GBA. Link para o comentário Compartilhar em outros sites More sharing options...
777777 9 Postado Dezembro 25, 2010 Share Postado Dezembro 25, 2010 Manow, Este npc não funciona... 20:49 Testando [1]: hi 20:49 Professora Oak: 20:49 Testando [1]: bye 20:49 Professora Oak: Volte quando você se sente preparado ela não fala nada, quando você diz hi para ela, ai você pode dizer o que for, que ela não reponde, só responderá o seu bye... Link para o comentário Compartilhar em outros sites More sharing options...
WaldirJunior 4 Postado Dezembro 26, 2010 Autor Share Postado Dezembro 26, 2010 (editado) Estranho , acho que vc copio alguma coisa errada. tente falar hi ,depois yes se o seu server começar menos que level 7 , acho que esse é o problema! Edite essa parte if(getPlayerLevel(cid) > 7) then Editado Dezembro 26, 2010 por Jafsdaffff Link para o comentário Compartilhar em outros sites More sharing options...
777777 9 Postado Dezembro 26, 2010 Share Postado Dezembro 26, 2010 Valeu, Realmente funcionou! rep+ Link para o comentário Compartilhar em outros sites More sharing options...
WaldirJunior 4 Postado Dezembro 29, 2010 Autor Share Postado Dezembro 29, 2010 Valeu é o meu primeiro post , se acho que ficou legal! Link para o comentário Compartilhar em outros sites More sharing options...
Drifitooh 0 Postado Dezembro 29, 2010 Share Postado Dezembro 29, 2010 Funciono direitinho aqui! REP+ Link para o comentário Compartilhar em outros sites More sharing options...
Whing 0 Postado Dezembro 31, 2010 Share Postado Dezembro 31, 2010 Muito show valeu . O :XTibia_smile: Agradece Link para o comentário Compartilhar em outros sites More sharing options...
mario21 1 Postado Janeiro 11, 2012 Share Postado Janeiro 11, 2012 mais na onde e velho nao achai isso pode me ajudar Link para o comentário Compartilhar em outros sites More sharing options...
Posts Recomendados