Ir para conteúdo

Featured Replies

Postado
9 minutos atrás, jenison06 disse:

nussa mosquei no Npc agora nao passa da parte

20:15 Billy Fantasy: Sorry, but I have nothing to talk to you.

 

 


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
	local questSt = 7750
	local checkQuest = getPlayerStorageValue(cid,questSt)
	local playerPos = getCreaturePosition(cid)
	local playerLevel = getPlayerLevel(cid)
	local questLevel = 10
	local tab = {
		[1] = {fName = "Thor Costume", fId = 17487, pName = "Addon Electabuzz"},
	}

	if(msgcontains(msg, 'Fantasy')) then
		if checkQuest < 1 then -- Quer saber mais
			selfSay('Sorry, but I have nothing to talk to you.', cid)
		elseif checkQuest >= 1 and checkQuest <= 3 then -- Quer saber mais mas já fez a Parte 1.
			selfSay('Oh! How is my husband? Is he fine? There are two years since I last seen him! By the way, are you here to give me {something}?', cid)
			talkState[talkUser] = 1
		else  -- Quer saber mais mas já fez a Parte Final.
			selfSay('How are you doing with your addon pokémon?', cid)
		end
		
	elseif(msgcontains(msg, 'Something') and talkState[talkUser] == 1) then -- Tem algo pra dar
		talkState[talkUser] = 2
		selfSay('Yes, as I expected. Let me check one thing.', cid)
		selfSay('As I see, Billy Fantasy has given you the '..tab[checkQuest].fName..'. After many years of study and dedication, I discovered a new method to crafit fantasy pokemon. Do you want me to transform your '..tab[checkQuest].fName..' into '..tab[checkQuest].pName..'? Just say {yes} or {no}.', cid)
	
	elseif talkState[talkUser] == 2 then
		if msgcontains(msg, 'Yes') then -- Quer transformar o fossil
			if getPlayerItemCount(cid, tab[checkQuest].fId) >= 1 then
				if getItemAttribute(getPlayerSlotItem(cid, CONST_SLOT_FEET).uid, name) then
					selfSay('Sorry, your pokemon not have nickname', cid)
					talkState[talkUser] = 0
				end	
				selfSay('Fine then! There it is, your '..tab[checkQuest].fName..' has been transformed into '..tab[checkQuest].pName..'! Congratulations!', cid)
				if #getPlayerPokeballs(cid) >= 6 then
					local newpokeball = doCreatePokeball(tab[checkQuest].pName, 2469)
					doPlayerSendMailByName(getCreatureName(cid), newpokeball)
					doPlayerSendTextMessage(cid, 27, "You are holding six pokémons, your ("..tab[checkQuest].pName..") will be teleported to the Pokemon Center!")
				else
					local newpokeball = doCreatePokeball(tab[checkQuest].pName, 2470)
					doPlayerAddItemEx(cid, newpokeball)
				end
					
				doPlayerRemoveItem(cid, tab[checkQuest].fId, 1)
				doSendMagicEffect(playerPos, 162)
				doSendMagicEffect(playerPos, 28)
				addEvent(doSendMagicEffect, 600, playerPos, 29)
				addEvent(doSendMagicEffect, 1200, playerPos, 28)
				setPlayerStorageValue(cid, questSt, 4)
			else
				selfSay("Sorry, but you have no "..tab[checkQuest].fName.." with you.",cid)
			end
			talkState[talkUser] = 0
			
		elseif msgcontains(msg, 'No') then -- Nao quer transformar o fossil
			selfSay('Right then. Then come back when you want it!', cid)
			talkState[talkUser] = 1
		end
	end
	return true
end

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

 

vc testou com a quantidade de item certo, certeza?

  • Respostas 7
  • Visualizações 791
  • Created
  • Última resposta

Top Posters In This Topic

Postado
  • Autor

achei o problema e que precisa de 2 script pra dar certo.. deu certo porem nao pede nick 

abaixo vou postar os arquivos .

 

o que vc fez esse que esta certo

Spoiler



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
	local questSt = 7750
	local checkQuest = getPlayerStorageValue(cid,questSt)
	local playerPos = getCreaturePosition(cid)
	local playerLevel = getPlayerLevel(cid)
	local questLevel = 10
	local tab = {
		[1] = {fName = "Thor Costume", fId = 17487, pName = "Addon Electabuzz"},
		[2] = {fName = "Helix Fossil", fId = 8777, pName = "Omanyte"},
		[3] = {fName = "Ancient Fossil", fId = 8775, pName = "Aerodactyl"},
	}

	if(msgcontains(msg, 'Cristin')) then
		if checkQuest < 1 then -- Quer saber mais
			selfSay('Sorry, but I have nothing to talk to you.', cid)
		elseif checkQuest >= 1 and checkQuest <= 3 then -- Quer saber mais mas já fez a Parte 1.
			selfSay('Oh! How is my husband? Is he fine? There are two years since I last seen him! By the way, are you here to give me {Costume}?', cid)
			talkState[talkUser] = 1
		else  -- Quer saber mais mas já fez a Parte Final.
			selfSay('How are you doing with your addon pokémon?', cid)
		end
		
	elseif(msgcontains(msg, 'costume') and talkState[talkUser] == 1) then -- Tem algo pra dar
		talkState[talkUser] = 2
		selfSay('Yes, as I expected. Let me check one thing.', cid)
		selfSay('As I see, Billy Fantasy has given you the '..tab[checkQuest].fName..'. After many years of study and dedication, I discovered a new method to crafit fantasy pokemon. Do you want me to fantasy your '..tab[checkQuest].fName..' into '..tab[checkQuest].pName..'? Just say {yes} or {no}.', cid)
	
	elseif talkState[talkUser] == 2 then
		if msgcontains(msg, 'Yes') then -- Quer transformar o fossil
			if getPlayerItemCount(cid, tab[checkQuest].fId) >= 1 then
				if getItemAttribute(getPlayerSlotItem(cid, CONST_SLOT_FEET).uid, name) then
					selfSay('Sorry, your pokemon not have nickname', cid)
					talkState[talkUser] = 0
				end	
				selfSay('Fine then! There it is, your '..tab[checkQuest].fName..' has been transformed into '..tab[checkQuest].pName..'! Congratulations!', cid)
				if #getPlayerPokeballs(cid) >= 6 then
					local newpokeball = doCreatePokeball(tab[checkQuest].pName, 2469)
					doPlayerSendMailByName(getCreatureName(cid), newpokeball)
					doPlayerSendTextMessage(cid, 27, "You are holding six pokémons, your ("..tab[checkQuest].pName..") will be teleported to the Pokemon Center!")
				else
					local newpokeball = doCreatePokeball(tab[checkQuest].pName, 2470)
					doPlayerAddItemEx(cid, newpokeball)
				end
					
				doPlayerRemoveItem(cid, tab[checkQuest].fId, 1)
				doSendMagicEffect(playerPos, 162)
				doSendMagicEffect(playerPos, 28)
				addEvent(doSendMagicEffect, 600, playerPos, 29)
				addEvent(doSendMagicEffect, 1200, playerPos, 28)
				setPlayerStorageValue(cid, questSt, 4)
			else
				selfSay("Sorry, but you have no "..tab[checkQuest].fName.." with you.",cid)
			end
			talkState[talkUser] = 0
			
		elseif msgcontains(msg, 'No') then -- Nao quer transformar o fossil
			selfSay('Right then. Then come back when you want it!', cid)
			talkState[talkUser] = 1
		end
	end
	return true
end

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

 

e a parte que liga nesse script

Spoiler



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
	local questSt = 7750
	local checkQuest = getPlayerStorageValue(cid,questSt)
	local playerPos = getCreaturePosition(cid)
	local playerLevel = getPlayerLevel(cid)
	local questLevel = 10
	
	if(msgcontains(msg, 'fantasy')) then
		if checkQuest < 1 then -- Quer saber mais
			talkState[talkUser] = 1
			selfSay('I believe there are some pokémons that age more than ten thousand years, and they are really rare. By the way, they are fossilized and I think there is a way to bring them back to life. Many people do not trust it, but I tell you, I think it is really possible. If you are interested to help me to prove that is possible, you will need a {Costume} to start.', cid)
		elseif checkQuest >= 1 and checkQuest <= 3 then -- Quer saber mais mas já fez a Parte 1.
			selfSay('My wife Trisha might help you, but there years passed since we last met. You must find her somewhere very far from here, maybe to south-east.', cid)
		else  -- Quer saber mais mas já fez a Parte Final.
			selfSay('Wow! You brought a fossil back to life! I knew it was possible, I knew it! My wife is brilliant, what you think? :P', cid)
		end
	
	elseif(msgcontains(msg, 'Costume') and talkState[talkUser] == 1) then -- Perguntou sobre os fóssies
		talkState[talkUser] = 2
		selfSay('So you really want to see a fantasy creature, huh? Fine then. There are three type of fantasy that I have discovered in my researches: {Thor Costume}, {Helix Fossil} and {Ancient Fossil}. Which one you are decided to get?', cid)
	elseif talkState[talkUser] == 2 then
		if msgcontains(msg, 'Thor Costume') then -- Saber mais sobre Thor Costume
			selfSay('The Thor Costume... I believe this artifact generates a rock/water type pokémon. It seems like a cockroach. Would you like to continue with the {Thor Costume}?', cid)
			talkState[talkUser] = 3
		elseif msgcontains(msg, 'Helix Fossil') then -- Saber mais sobre Helix Fossil
			selfSay('Yes, the Helix Fossil... I believe this artifact generates a water/rock type pokémon. It seems like a helix. Would you like to continue with the {fossil type H}?', cid)
			talkState[talkUser] = 4
		elseif msgcontains(msg, 'Ancient Fossil') then -- Saber mais sobre Ancient Fossil
			selfSay('Oh, the Ancient Fossil... I believe this artifact generates a rock/flying type pokémon. It seems like a feather of a giant bird. Would you like to continue with the {fossil type A}?', cid)
			talkState[talkUser] = 5
		end
		
	elseif(msgcontains(msg, 'Thor Costume') and talkState[talkUser] == 3) then -- Listagem Thor Costume
		if playerLevel >= questLevel then -- Se for level 100+
			selfSay('Right! To give it to you, I need: 10 Electric Tails + 1 Thunder Stones + 1 Thor Costume + 10 wool of yellow sheep. Do you have it?', cid)
			talkState[talkUser] = 6
		else -- Se for level 100-
			selfSay('Your level is too low. You are not expert enough to help me. Just come back here when you are level 100 or higher.', cid)
			talkState[talkUser] = 0
		end
		
	elseif(msgcontains(msg, 'Fossil Type H') and talkState[talkUser] == 4) then -- Listagem Helix Fossil
		if playerLevel >= questLevel then -- Se for level 100+
			selfSay('Right! To give it to you, I need: 10 Electric Tails + 1 Thunder Stones + 1 Thor Costume + 10 Wood ball. Do you have it?', cid)
			talkState[talkUser] = 7
		else -- Se for level 100-
			selfSay('Your level is too low. You are not expert enough to help me. Just come back here when you are level 100 or higher.', cid)
			talkState[talkUser] = 0
		end
		
	elseif(msgcontains(msg, 'Fossil Type A') and talkState[talkUser] == 5) then -- Listagem Ancient Fossil
		if playerLevel >= questLevel then -- Se for level 100+
			selfSay('Right! To give it to you, I need: 75 Moon Stones + 1 Aerodactyl Doll + 2000 Stone Orbs. Do you have it?', cid)
			talkState[talkUser] = 8
		else -- Se for level 100-
			selfSay('Your level is too low. You are not expert enough to help me. Just come back here when you are level 100 or higher.', cid)
			talkState[talkUser] = 0
		end
		
	elseif(msgcontains(msg, 'Yes') and talkState[talkUser] == 6) then -- Confirmou Thor Costume
		if (getPlayerItemCount(cid, 2381) >= 10 and getPlayerItemCount(cid, 2108) >= 1 and getPlayerItemCount(cid, 17487) >= 1 and getPlayerItemCount(cid, 9135) >= 10) then
			selfSay('Very well! You proved me your are a very determined person. Here is your Thor Costume. Now find my wife Trisha somewhere far away from here. This place might be to south-east.', cid)
			doPlayerAddItem(cid, 17487, 1)
			doPlayerRemoveItem(cid, 2381, 10)
			doPlayerRemoveItem(cid, 2108, 1)
			doPlayerRemoveItem(cid, 17487, 1)
			doPlayerRemoveItem(cid, 9135, 10)
			setPlayerStorageValue(cid, 7750, 1)
			doSendMagicEffect(playerPos, 162)
			talkState[talkUser] = 0
		else
			selfSay('Sorry, just ask for your {fossil} when you are with all the items I asked you.', cid)
			talkState[talkUser] = 1
		end
	elseif(msgcontains(msg, 'Yes') and talkState[talkUser] == 7) then -- Confirmou Helix Fossil
		if (getPlayerItemCount(cid, 2087) >= 20 and getPlayerItemCount(cid, 2091) >= 15 and getPlayerItemCount(cid, 6120) >= 1 and getPlayerItemCount(cid, 2419) >= 750 and getPlayerItemCount(cid, 2445) >= 500) then
			selfSay('Very well! You proved me your are a very determined person. Here is your Helix Fossil. Now find my wife Trisha somewhere far away from here. This place might be to south-east.', cid)
			doPlayerAddItem(cid, 8777, 1)
			doPlayerRemoveItem(cid, 2087, 20)
			doPlayerRemoveItem(cid, 2091, 15)
			doPlayerRemoveItem(cid, 6120, 1)
			doPlayerRemoveItem(cid, 2419, 750)
			doPlayerRemoveItem(cid, 2445, 500)
			setPlayerStorageValue(cid, 7750, 2)
			doSendMagicEffect(playerPos, 162)
			talkState[talkUser] = 0
		else
			selfSay('Sorry, just ask for your {fossil} when you are with all the items I asked you.', cid)
			talkState[talkUser] = 1
		end
	elseif(msgcontains(msg, 'Yes') and talkState[talkUser] == 8) then -- Confirmou Ancient Fossil
		if (getPlayerItemCount(cid, 2091) >= 1 and getPlayerItemCount(cid, 9149) >= 1 and getPlayerItemCount(cid, 2445) >= 100) then
			selfSay('Very well! You proved me your are a very determined person. Here is your Ancient Fossil. Now find my wife Trisha somewhere far away from here. This place might be to south-east.', cid)
			doPlayerAddItem(cid, 8775, 1)
			doPlayerRemoveItem(cid, 2091, 75)
			doPlayerRemoveItem(cid, 9149, 1)
			doPlayerRemoveItem(cid, 2445, 2000)
			setPlayerStorageValue(cid, 7750, 3)
			doSendMagicEffect(playerPos, 162)
			talkState[talkUser] = 0
		else
			selfSay('Sorry, just ask for your {fossil} when you are with all the items I asked you.', cid)
			talkState[talkUser] = 1
		end
	end
	return true
end

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

 

 

outra pergunta tem como por para remover o pokemon exemplo: alem dos itens remover tambem o Electabuzz 

 

Editado por jenison06 (veja o histórico de edições)

  • 3 weeks later...

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.6k

Informação Importante

Confirmação de Termo