Ir para conteúdo

[Pedido]Estilo Rookgard...


7401131

Posts Recomendados

Tipo do script:Npc, creture..

Protocolo (versão do Tibia):8.6

Servidor utilizado:TFS

Nível de experiência:Medio

Adicionais/Informações:E queria tpw assim, o player no site escolhece para nascer sem vocaça(none), la ele comessaria lvl 1, ai ele teria que uar ate lvl 8, e chegasse num npc que daria a vocaçao (knight, druid, sorc, pala) so se ele tivesse lvl 8, e que o npc teleportasse ele para a city que ele desejasse.

Editado por 7401131
Link para o comentário
Compartilhar em outros sites

Retirado Do Post:

[Npc] The Oracle

 

Nome do NPC: The Oracle

Protocolo: 8.2+

Servidor testado: TFS 0.3.3 (modificado por mim, mas isso não importa nesse caso)

Autor: Evesys

Descrição:

NPC oraculo igual o de rook, que muda vocação/town ID e teleporta o personagem, alem disso apresenta uma feature ainda não completa, que permite que o personagem recomesse a converça de onde parou caso o servidor caia ou o char seja kikado.

 

na pasta data/npc crie um arquivo chamado oracle.xml, e coloque isso dentro dele:

<?xml version="1.0" encoding="UTF-8"?>

<npc name="The Oracle" floorchange="0" walkinterval="0" script="data/npc/scripts/oracle.lua">

<health now="150" max="150"/>

<look typeex="1448"/>

</npc>

 

na pasta data/npc/scripts/, crie um arquivo chamado oracle.lua, e coloque isso dentro dele:

 

 

-- area editavel

Oracle = {

Cities = { -- {id, 'nome', x, y, z, 'premium/free'}

{1, 'inittria', 5033, 5122, 7, 'free'},

{2,'excazian',5300,5268,7,'free'},

{3,'frizzo',5676,4883,7,'premium'}

},

Vocations = { -- {[id] = 'nome'}

[1] = 'sorcerer',

[2] = 'druid',

[3] = 'paladin',

[4] = 'knight'

},

frases = {

noLevel = 'CHILDREN! COME BACK WHEN YOU\'VE GROWN UP!',

hi = 'HELLO, CHILDREN. ARE YOU PREPARED TO FACE YOUR DESTINY?',

askVoc = 'WHAT VOCATION YOU WANT TO BE? ',

confirmVoc = 'ARE YOU SURE? THIS DECISION IS IRREVERSIBLE.',

askCity = 'DO YOU WANT TO LIVE IN ',

final = 'GOOD LUCK IN YOUR JOURNEY!',

bye = 'COME BACK WHEN YOU FEEL PREPARED'

},

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, use e abuse deste NPC, mas não de seu dono! <-->->

 

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("DO YOU CHOOSED TO BE A ".. Oracle.Vocations[Oracle.choos.voc] ..", AND TO BORN IN ".. Oracle.choos.city[2] ..". IT'S CORRECT?", 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

 

 

siga os comentários para editar.

 

espero ter ajudado, flws!

 

Creditos no inicio do topico!!

Gostou rep++

Editado por 582240
Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...