PM
pedido

[Encerrado] Npc Que Troca Pokémon Por Outro

Por Pmcd, 08 de dez. de 2012 em Tópicos Sem Resposta

otserv
tibia
script
12
1.9k
PmcdP
08 de dezembro de 2012 às 21:01

Olá xtibianos , venho aqui novamente para fazer meu pedido de NPC.

 

Tipo do script: Npc que troca pokémon por outro

Protocolo (versão do Tibia): 8.54

Servidor utilizado: Pokémon Dash Advanced By Slicer SEM LEVEL

Detalhes adicionais :

 

Quero um Npc assim :

 

Player : Hi

Npc : Olá ! Você deseja trocar seu Bulbasaur pelo meu Chikorita ?

Player : Sim

NPC : Obrigado pela troca , cuide bem do(a) Chikorita.

 

e caso o Player não tiver o Bulbausar :

 

Player : Hi

Npc : Olá ! Você deseja trocar seu Bulbasaur pelo meu Chikorita ?

Player : Sim

NPC : Você não tem um Bulbasaur !

 

e caso o Player diga não :

 

Player : Hi

Npc : Olá ! Você deseja trocar seu Bulbasaur pelo meu Chikorita ?

Player : Não

NPC : Ok . volte quando mudar de idéia !

 

Por favor , preciso disso com urgência , obrigado adiantado para aquele que ajudar ! e um REP + !

LuckOakeL
08 de dezembro de 2012 às 21:10

Cara, de novo criando tópico de servidor derivado aqui? Dessa vez passa, na próxima é REP-.

 

Tópico movido.

PmcdP
08 de dezembro de 2012 às 21:15

Foi mal Luck :) É que se eu não postar aqui ninguém responde .-.

SlicerS
08 de dezembro de 2012 às 22:29

ta ae..

 

local keywordHandler = KeywordHandler:new()

local npcHandler = NpcHandler:new(keywordHandler)

NpcSystem.parseParameters(npcHandler)

local talkState = {}

function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end

function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end

function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end

function onThink() npcHandler:onThink() end

function creatureSayCallback(cid, type, msg)

if(not npcHandler:isFocused(cid)) then

return false

end

 

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

msg = string.lower(msg)

 

--- Atributos ---

local needPoke = "Mr. Mime" --poke q o player precisa ter...

local tradePoke = "Chansey" --poke q o player vai ganhar...

--- end ---

 

--- Functions ---

function givePoke(cid, pokemon)

if pokemon == "" then return true end

 

local gender = getRandomGenderByName(pokemon)

local btype = "normal"

local happy = 200

 

if getPlayerFreeCap(cid) >= 6 or not hasSpaceInContainer(getPlayerSlotItem(cid, 3).uid) then -

item = doCreateItemEx(11826)

else

item = addItemInFreeBag(getPlayerSlotItem(cid, 3).uid, 11826, 1)

end

 

doItemSetAttribute(item, "poke", pokemon)

doItemSetAttribute(item, "hp", 1)

doItemSetAttribute(item, "happy", happy)

doItemSetAttribute(item, "gender", gender)

doItemSetAttribute(item, "description", "Contains a "..pokemon..".")

doItemSetAttribute(item, "fakedesc", "Contains a "..pokemon..".")

 

if getPlayerFreeCap(cid) >= 6 or not hasSpaceInContainer(getPlayerSlotItem(cid, 3).uid) then

doPlayerSendMailByName(getCreatureName(cid), item, 1)

end

end

 

function havePokemon(cid, poke, excluir)

local pbs = getPokeballsInContainer(getPlayerSlotItem(cid, 3).uid)

local slot = getPlayerSlotItem(cid, 8)

if slot.itemid > 0 and isPokeball(slot.itemid) then

if getItemAttribute(slot.uid, "poke") == poke and excluir and excluir == true then

doRemoveItem(slot.uid, 1)

doTransformItem(getPlayerSlotItem(cid, CONST_SLOT_LEGS).uid, 2395)

return true

elseif getItemAttribute(slot.uid, "poke") == poke then

return true

end

end

for i = 1, #pbs do

if getItemAttribute(pbs, "poke") == poke and excluir and excluir == true then

doRemoveItem(pbs, 1)

return true

elseif getItemAttribute(pbs, "poke") == poke then

return true

end

end

return false

end

--- end ---

 

if (msgcontains(msg, 'change') or msgcontains(msg, 'trade')) then

if havePokemon(cid, needPoke) then

selfSay("Are you sure you want to exchange your "..needPoke.." for my "..tradePoke.."?", cid)

talkState[talkUser] = 2

else

selfSay("You don't have "..getArticle(needPoke).." "..needPoke.." with you!", cid)

talkState[talkUser] = 0

return true

end

elseif msgcontains(msg, 'yes') then

if havePokemon(cid, needPoke, true) then

selfSay("Thanks so much! I will take care of your "..needPoke.." and i hope you enjoy my "..tradePoke.."!", cid)

givePoke(cid, tradePoke, level)

talkState[talkUser] = 0

return true

else

selfSay("Are you trying to joke with me? Good bye!", cid)

talkState[talkUser] = 0

return true

end

elseif msgcontains(msg, 'no') then

selfSay("Ok then... Good bye.", cid)

talkState[talkUser] = 0

return true

end

 

return true

end

 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

PmcdP
08 de dezembro de 2012 às 22:43

Vlw Slicer , amanhã dou REP + pq hj n posso ! Mesmo assim valew mt mt mt mt mt mt mt mt mt !

Yan OliveiraY
08 de dezembro de 2012 às 22:58

Duvida Resolvida!

 

Tópico Movido.

PmcdP
08 de dezembro de 2012 às 23:41

Fiz um teste e deu um erro , o NPC retira o pokémon mais não entrega o outro. Me ajuda?

Yan OliveiraY
09 de dezembro de 2012 às 00:00

Como a Duvida não foi resolvida, estarei movendo de volta para Pedidos e Duvidas - Servidores Derivados, Mas a proxima vez crie um novo topico.

 

Editado Dezembro 9 por Yan18

GuhPkG
09 de dezembro de 2012 às 12:13

Pow, outro system que eu já pedi aqui, e o slicer já até tinha respondido...

Povo... Tenham mais imaginação, pensem em seus proprios system's, plagiadores... U.U'

SlicerS
09 de dezembro de 2012 às 13:02

/\

esse sistema eh do GBA entao vc q plagiou de la.. n vem fla isso aki blz? todos os nossos sistemas sao plagios de alguma coisa, no caso a maioria eh plagio da pxg...

GuhPkG
09 de dezembro de 2012 às 15:48

Não acho que tudo seja plagio cara, pois já vi muitos sistemas de pokemon nunca existentes nem no anime e nem nos jogos...

Mas você não entendeu oque eu quis dizer com "plagio" cara, não vou explicar porque vou acabar fazer bagunça aqui no tópico...

 

PS: Não curto PxG cara, então pode ter certeza que não copiarei nada de serverzito... U.U' kkk

 

 

#Tópico

 

Aqui está o NPC, quem fez foi o Slicer no tópico que eu havia feito, só fiz TENTAR tirar o level...

 

 

 

local keywordHandler = KeywordHandler:new()

local npcHandler = NpcHandler:new(keywordHandler)

NpcSystem.parseParameters(npcHandler)

local talkState = {}

function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end

function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end

function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end

function onThink() npcHandler:onThink() end

function creatureSayCallback(cid, type, msg)

if(not npcHandler:isFocused(cid)) then

return false

end

 

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

msg = string.lower(msg)

 

--- Atributos ---

local needPoke = "Shiny Dragonite" --poke q o player precisa ter...

local tradePoke = "Chansey" --poke q o player vai ganhar...

--- end ---

 

--- Functions ---

function givePoke(cid, pokemon, lvl)

if pokemon == "" then return true end

 

local gender = getRandomGenderByName(pokemon)

local mypoke = getPokemonStatus(pokemon)

 

if not mypoke then return true end

 

local extrastr = 1.5

local btype = "normal"

local happy = 200

 

if getPlayerFreeCap(cid) >= 6 or not hasSpaceInContainer(getPlayerSlotItem(cid, 3).uid) then

item = doCreateItemEx(11826)

else

item = addItemInFreeBag(getPlayerSlotItem(cid, 3).uid, 11826, 1)

end

 

doItemSetAttribute(item, "poke", pokemon)

doItemSetAttribute(item, "hp", 1)

doItemSetAttribute(item, "offense", offense)

doItemSetAttribute(item, "defense", defense)

doItemSetAttribute(item, "speed", speed)

doItemSetAttribute(item, "vitality", vit)

doItemSetAttribute(item, "specialattack", spatk)

doItemSetAttribute(item, "happy", happy)

doItemSetAttribute(item, "gender", gender)

doItemSetAttribute(item, "description", "Contains a "..pokemon..".")

doItemSetAttribute(item, "fakedesc", "Contains a "..pokemon..".")

 

if getPlayerFreeCap(cid) >= 6 or not hasSpaceInContainer(getPlayerSlotItem(cid, 3).uid) then --alterado v2.6

doPlayerSendMailByName(getCreatureName(cid), item, 1)

end

end

 

function havePokemon(cid, poke, excluir)

local pbs = getPokeballsInContainer(getPlayerSlotItem(cid, 3).uid)

local slot = getPlayerSlotItem(cid, 8)

if slot.itemid > 0 and isPokeball(slot.itemid) then

if getItemAttribute(slot.uid, "poke") == poke and excluir and excluir == true then

doRemoveItem(slot.uid, 1)

doTransformItem(getPlayerSlotItem(cid, CONST_SLOT_LEGS).uid, 2395)

return true

elseif getItemAttribute(slot.uid, "poke") == poke then

return true

end

end

for i = 1, #pbs do

if getItemAttribute(pbs, "poke") == poke and excluir and excluir == true then

doRemoveItem(pbs, 1)

return true

elseif getItemAttribute(pbs, "poke") == poke then

return true

end

end

return false

end

--- end ---

 

if (msgcontains(msg, 'change') or msgcontains(msg, 'trade')) then

if havePokemon(cid, needPoke) then

selfSay("Are you sure you want to exchange your "..needPoke.." for my "..tradePoke.."?", cid)

talkState[talkUser] = 2

else

selfSay("You don't have "..getArticle(needPoke).." "..needPoke.." with you!", cid)

talkState[talkUser] = 0

return true

end

elseif msgcontains(msg, 'yes') then

if havePokemon(cid, needPoke, true) then

selfSay("Thanks so much! I will take care of your "..needPoke.." and i hope you enjoy my "..tradePoke.."!", cid)

givePoke(cid, tradePoke)

talkState[talkUser] = 0

return true

else

selfSay("Are you trying to joke with me? Good bye!", cid)

talkState[talkUser] = 0

return true

end

elseif msgcontains(msg, 'no') then

selfSay("Ok then... Good bye.", cid)

talkState[talkUser] = 0

return true

end

 

return true

end

 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

 

Editado Dezembro 9 por GuhPk

5 anos depois...
StigalS
20 de abril de 2018 às 00:49
A questão neste tópico de suporte foi encerrada por falta de respostas. Este tópico está fechado e foi movido para Suporte - Tópicos Sem Resposta.

+ Caso a dúvida não tenha sido resolvida você poderá criar outro tópico solicitando ajuda.
* Lembre-se que é permitido dar UP no tópico a cada 24 horas para assim o destacar e manter movimentado.