Ir para conteúdo

Featured Replies

Postado

Script!

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 = msg:lower()

local reward_starter = {
{2160, 5},
{12344, 10},
{12345, 10},
{12346, 10},
{12347, 10},
{12348, 15},
{12349, 15},
{2394, 50}
}

local places = {
["pallet"] = 1,  
["viridian"] = 2,  
["pewter"] = 3, 
["cerulean"] = 4,
["saffron"] = 5,
["celadon"] = 6, 
["lavender"] = 7,
["vermilion"] = 8, 
["fuchsia"] = 9,                    
["cinnabar"] = 10,
}
local Choose = {"bulbasaur", "charmander", "squirtle", "chikorita", "cyndaquil", "totodile", "treecko", "mudkip", "torchic"}

local sto_Oak = 748513
local sto_city = 13611
       
        if msgcontains(string.lower(msg), 'cidade') or msgcontains(string.lower(msg), 'help') then
           if getPlayerStorageValue(cid, sto_city) == 1 then
              selfSay("Please choose now your new pokemon!", cid)
              doPlayerSendCancel(cid, "#cnp#")
              talkState[talkUser] = 0
              return true
           elseif getPlayerStorageValue(cid, sto_city) == 2 then
              selfSay("Voce ja escolheu seu pokemon!", cid)
              return true
           elseif getPlayerStorageValue(cid, sto_Oak) < 1 then
              selfSay("Go talk with the Delia first!", cid)
              return true
           else
              selfSay("You can choose your beginner town between: {Saffron, Cerulean, Lavender, Fuchsia, Celadon, Viridian, Vermilion, Pewter or Cinnabar}.", cid) 
              talkState[talkUser] = 2
              return true
           end
        elseif places[msg] and talkState[talkUser] == 2 then
           city = msg
           selfSay("Are you sure which you want to begin in {".. doCorrectString(msg) .."}?", cid) 
           talkState[talkUser] = 3
           return true
       elseif msgcontains(msg, "yes") or msgcontains(msg, "sim") and talkState[talkUser] == 3 then   
           selfSay("OK then... Now your beginner town is ".. doCorrectString(city)..".", cid)
		   selfSay("Ok, talk {Choose poke or escolhe poke} and complete this mission!", cid)
           doPlayerSetTown(cid, places[city])
		   talkState[talkUser] = 4
		   -- alterado a baixo \/
		elseif msgcontains(msg, "choose poke") or msgcontains(msg, "escolhe poke") and talkState[talkUser] == 4 then
        selfSay("pronto para {iniciar}?", cid)	
        talkState[talkUser] = 5	
		elseif msgcontains(msg, "iniciar") or msgcontains(msg, "antigo") and talkState[talkUser] == 5 then   
		selfSay("Ok, escolha seu pokemon, Pokes Kanto! {Charmander, Bulbasaur, Squirtle}, Pokes Johto! {Chikorita, Cyndaquil, Totodile} ou Hooen {Treecko, Mudkip, Torchic} qual voce prefere?", cid)
		talkState[talkUser] = 6
		elseif isInArray(Choose, msg) and talkState[talkUser] == 6 then
		addPokeToPlayer(cid, msg, 0, -1, 'normal', true)
		doSendMagicEffect(getThingPos(cid), 21)
		selfSay("Ok, good luck on your journey.", cid)
        for i = 1, #reward_starter do
        doPlayerAddItem(cid, reward_starter[i][1], reward_starter[i][2])
        end
        setPlayerStorageValue(cid, sto_city, 2)
		doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), false)
		talkState[talkUser] = 0
		elseif msgcontains(msg, "new") or msgcontains(msg, "novo") and talkState[talkUser] == 4 then  -- botei talkState 4 reve pra min ce ta certo
		      setPlayerStorageValue(cid, sto_city, 1)
              selfSay("Please choose now your new pokemon!", cid)
              doPlayerSendCancel(cid, "#cnp#")
           talkState[talkUser] = 0
           return true
        elseif msgcontains(msg, "no") or msgcontains(msg, "No") and talkState[talkUser] == 3 then  
           selfSay("Ok then... say again what city you want to begin!", cid)
           talkState[talkUser] = 0
           return true 
        end

return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())         

galera preciso que OAK não deixe os player pegar novamente os pokes iniciais!
você consegue voltar e ficar pegando quantas vezes quiser se você pular a frase no lugar de cidade escrever Iniciar ele te coloca na lista de seleção de poke

 

Editado por Xz Death Xz
Reformulando (veja o histórico de edições)

Postado
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,msg = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid,msg:lower()
	
	local reward_starter = {
		{2160, 5},
		{12344, 10},
		{12345, 10},
		{12346, 10},
		{12347, 10},
		{12348, 15},
		{12349, 15},
		{2394, 50}
	}
	
	local places = {
		["pallet"] = 1, 
		["viridian"] = 2, 
		["pewter"] = 3, 
		["cerulean"] = 4,
		["saffron"] = 5,
		["celadon"] = 6, 
		["lavender"] = 7,
		["vermilion"] = 8, 
		["fuchsia"] = 9, 
		["cinnabar"] = 10,
	}
	local Choose = {"bulbasaur", "charmander", "squirtle", "chikorita", "cyndaquil", "totodile", "treecko", "mudkip", "torchic"}
	
	local sto_Oak = 748513
	local sto_city = 13611
	
	if msgcontains(string.lower(msg), 'cidade') or msgcontains(string.lower(msg), 'help') then
		if getPlayerStorageValue(cid, sto_city) > 0 then
			selfSay("Voce ja escolheu seu pokemon!", cid)
			return true
		elseif getPlayerStorageValue(cid, sto_Oak) < 1 then
			selfSay("Go talk with the Delia first!", cid)
			return true
		else
			selfSay("You can choose your beginner town between: {Saffron, Cerulean, Lavender, Fuchsia, Celadon, Viridian, Vermilion, Pewter or Cinnabar}.", cid) 
			talkState[talkUser] = 2
			return true
		end
	elseif places[msg] and talkState[talkUser] == 2 then
		city = msg
		selfSay("Are you sure which you want to begin in {".. doCorrectString(msg) .."}?", cid) 
		talkState[talkUser] = 3
		return true
	elseif msgcontains(msg, "yes") or msgcontains(msg, "sim") and talkState[talkUser] == 3 then 
		selfSay("OK then... Now your beginner town is ".. doCorrectString(city)..".", cid)
		selfSay("Ok, talk {Choose poke or escolhe poke} and complete this mission!", cid)
		doPlayerSetTown(cid, places[city])
		talkState[talkUser] = 4
		-- alterado a baixo \/
	elseif msgcontains(msg, "choose poke") or msgcontains(msg, "escolhe poke") and talkState[talkUser] == 4 then
		selfSay("pronto para {iniciar}?", cid)	
		talkState[talkUser] = 5	
	elseif msgcontains(msg, "iniciar") or msgcontains(msg, "antigo") and talkState[talkUser] == 5 then
			selfSay("Ok, escolha seu pokemon, Pokes Kanto! {Charmander, Bulbasaur, Squirtle}, Pokes Johto! {Chikorita, Cyndaquil, Totodile} ou Hooen {Treecko, Mudkip, Torchic} qual voce prefere?", cid)
			talkState[talkUser] = 6
		elseif isInArray(Choose, msg) and talkState[talkUser] == 6 then
		if getPlayerStorageValue(cid, sto_city) == 1 then
			addPokeToPlayer(cid, msg, 0, -1, 'normal', true)
			doSendMagicEffect(getThingPos(cid), 21)
			selfSay("Ok, good luck on your journey.", cid)
			for i = 1, #reward_starter do
				doPlayerAddItem(cid, reward_starter[i][1], reward_starter[i][2])
			end
			setPlayerStorageValue(cid, sto_city, 1)
			doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), false)
			talkState[talkUser] = 0
		else
			selfSay("Voce ja escolheu seu pokemon!", cid)
			talkState[talkUser] = 0
		end
	elseif msgcontains(msg, "no") or msgcontains(msg, "No") and talkState[talkUser] > 0 then 
		selfSay("Ok then... say again what city you want to begin!", cid)
		talkState[talkUser] = 0
		return true 
	end
	return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo