Jump to content

Scripting Troca de item por pokemon + set nick


Recommended Posts

.Qual servidor ou website você utiliza como base? 

pokestorm

Qual o motivo deste tópico? 

Ajuda com Adaptação

 

Salve Galera queria saber se é possivel fazer com que o npc troca o item pelo pokemon como abaixo e apenas aceitar a troca se setar o Nick no pokemon

 

Você tem o código disponível? Se tiver publique-o aqui: 

Abaixo Npc que troca Item por poke

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 = 6650
	local checkQuest = getPlayerStorageValue(cid,questSt)
	local playerPos = getCreaturePosition(cid)
	local playerLevel = getPlayerLevel(cid)
	local questLevel = 100
	local tab = {
		[1] = {fName = "Dome Fossil", fId = 8776, pName = "Kabuto"},
		[2] = {fName = "Helix Fossil", fId = 8777, pName = "Omanyte"},
		[3] = {fName = "Ancient Fossil", fId = 8775, pName = "Aerodactyl"},
	}

	if(msgcontains(msg, 'Harry')) 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 ancient 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, Harry has given you the '..tab[checkQuest].fName..'. After many years of study and dedication, I discovered a method to bring fossils back to life. 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
				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())   

 

Npc Nick que uso na Base

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

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
local talkState = {}

function creatureSayCallback(cid, _type, msg)
	if(not npcHandler:isFocused(cid)) then
        return false
    end
	
	local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
	
	NickQuestStorage = 8850
	NickQuestBookId = 1955
	NickQuestGameBoyId = 2630
	local questStatus = getPlayerStorageValue(cid, NickQuestStorage)
	local playerLevel = getPlayerLevel(cid)

	
	if msgcontains(msg, "nicknames") then
		if isPremium(cid) then
			if playerLevel >=50 then
				if questStatus == -1 then
					selfSay("Before I give nicknames to your pokemons, can you do some favours to me?", cid)
					selfSay("I need a book that I lent to Albert, because it contains so much information that I use in my job. Last time I visited Albert he was living in a little house, in the east of Viridian.", cid)
					setPlayerStorageValue(cid, NickQuestStorage, 0)
				elseif questStatus == 0 then
					selfSay("I need a book that I lent to Albert, because it contains so much information that I use in my job. Last time I visited Albert he was living in a little house, in the east of Viridian.", cid)
				elseif questStatus == 1 then
					if doPlayerRemoveItem(cid, NickQuestBookId, 1) then
						setPlayerStorageValue(cid, NickQuestStorage, 2)
						selfSay("Thank you! I was really missing this book. Now just one more favour, can you get my Game Boy, which is with Ralf? I left with him to fix it, his workshop is in Celadon.", cid)
					else
						selfSay("I need a book that I lent to Albert, because it contains so much information that I use in my job. Last time I visited Albert he was living in a little house, in the east of Viridian.", cid)
					end
				elseif questStatus == 2 then
					selfSay("Can you get my Game Boy, which is with Ralf? I left with him to fix it, his workshop is in Celadon.", cid)
				elseif questStatus == 3 then
					if doPlayerRemoveItem(cid, NickQuestGameBoyId, 1) then
						setPlayerStorageValue(cid, NickQuestStorage, 4)
						selfSay("Thank you VERY MUCH! Now my son won't cry no more and I can do my job tranquil. Do you want me to give {nicknames} to your pokemons?", cid)
					else
						selfSay("Can you get my Game Boy, which is with Ralf? I left with him to fix it, his workshop is in Celadon.", cid)
					end
				elseif questStatus >= 4 then
					selfSay("Oh, ok. Would you like to {give} or {remove} a nickname?", cid)
					talkState[talkUser] = 1
				end
			else
				selfSay("Sorry, come back when you are level 50 or higher.", cid)
			end
		else
			selfSay("Hey, I'm so sorry, but you must be premium account to give nicknames to your pokemons", cid)
		end
		
	elseif talkState[talkUser] == 1 then
		if msgcontains(msg, "give") then
			selfSay("Oh, ok. Which nickname would you like to give to the pokemon in the slot?", cid)
			talkState[talkUser] = 2
		elseif msgcontains(msg, "remove") then
			selfSay("Oh, ok. You want to remove the nickname to the pokemon in the slot for 5K?", cid)
			talkState[talkUser] = 3
		end
		
	elseif talkState[talkUser] == 2 then
		local msg = msg:trim()
		if msg:len() < 4 then
			selfSay("This nickname is too short.", cid)
		elseif msg:len() > 15 then
			selfSay("This nickname is too long.", cid)
		elseif not isValidName(msg) then
			selfSay("This name contains invalid symbols.", cid)
		elseif getMonsterPokedex(msg, false) then
			selfSay("You can't use other's pokemon name.", cid)
		else
			selfSay("Would you like to give the nickname \""..msg.."\" to the pokemon in the slot for 10K?", cid)
			talkState[talkUser] = msg
		end
		
	elseif talkState[talkUser] == 3 then
		if msgcontains(msg, "yes") then
			local pokeball = getPlayerSlotItem(cid, CONST_SLOT_FEET)
			if isPokeballOut(pokeball.itemid) then
				selfSay("Call your pokemon back before changing his nickname.", cid)
			elseif isPokeballIn(pokeball.itemid) then
				if doPlayerRemoveMoney(cid, 500000) then
					local pokeballInfo = getPokeballInfo(pokeball.uid)
					setPokeballDescription(pokeball.uid, pokeballInfo.name, false, pokeballInfo.health, pokeballInfo.healthmax)
					selfSay("Now your pokemon not have a nickname!", cid)
				else
					selfSay("Sorry, you don't have 5K.", cid)
				end
			else
				selfSay("There's no pokeball in the slot!", cid)
			end
		else
			selfSay("Ok then.", cid)
		end
		talkState[talkUser] = 0
		
	elseif type(talkState[talkUser]) == "string" then
		if msgcontains(msg, "yes") then
			local pokeball = getPlayerSlotItem(cid, CONST_SLOT_FEET)
			if isPokeballOut(pokeball.itemid) then
				selfSay("Call your pokemon back before changing his nickname.", cid)
			elseif isPokeballIn(pokeball.itemid) then
				if doPlayerRemoveMoney(cid, 1000000) then
					local pokeballInfo = getPokeballInfo(pokeball.uid)
					setPokeballDescription(pokeball.uid, pokeballInfo.name, talkState[talkUser], pokeballInfo.health, pokeballInfo.healthmax)
					selfSay("Now your pokemon have a new nickname! Enjoy it :)", cid)
				else
					selfSay("Sorry, you don't have 10K.", cid)
				end
			else
				selfSay("There's no pokeball in the slot!", cid)
			end
		elseif msgcontains(msg, "no") then
			selfSay("Why not? This nickname was so good!", cid)
		end
		talkState[talkUser] = 0
		
	else
		talkState[talkUser] = 0
	end
	
	return true
end

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

 

w31Cm4K.png

 

PokeWorks-Pokemon Rpg Online

venha Fazer parte dessa Incrivel Aventura

Criar Conta

____________##___________

Object Builder 0.5.441 

Link to post
Share on other sites

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 = 6650
	local checkQuest = getPlayerStorageValue(cid,questSt)
	local playerPos = getCreaturePosition(cid)
	local playerLevel = getPlayerLevel(cid)
	local questLevel = 100
	local tab = {
		[1] = {fName = "Dome Fossil", fId = 8776, pName = "Kabuto"},
		[2] = {fName = "Helix Fossil", fId = 8777, pName = "Omanyte"},
		[3] = {fName = "Ancient Fossil", fId = 8775, pName = "Aerodactyl"},
	}

	if(msgcontains(msg, 'Harry')) 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 ancient 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, Harry has given you the '..tab[checkQuest].fName..'. After many years of study and dedication, I discovered a method to bring fossils back to life. 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())   

 

1.png.f984e18270f1fce843e0c76d0a3a5aa0.png

 

 

Link to post
Share on other sites

deu este erro

 I/O warning : failed to load external entity "data/npc/Billy Fantasy.xml"
[Warning - Npc::loadFromXml] Cannot load npc file (data/npc/Billy Fantasy.xml).
Info: failed to load external entity "data/npc/Billy Fantasy.xml"

 

w31Cm4K.png

 

PokeWorks-Pokemon Rpg Online

venha Fazer parte dessa Incrivel Aventura

Criar Conta

____________##___________

Object Builder 0.5.441 

Link to post
Share on other sites

16 horas atrás, jenison06 disse:

deu este erro

 I/O warning : failed to load external entity "data/npc/Billy Fantasy.xml"
[Warning - Npc::loadFromXml] Cannot load npc file (data/npc/Billy Fantasy.xml).
Info: failed to load external entity "data/npc/Billy Fantasy.xml"

 

não é erro no script, é erro no xml

1.png.f984e18270f1fce843e0c76d0a3a5aa0.png

 

 

Link to post
Share on other sites

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())

 

w31Cm4K.png

 

PokeWorks-Pokemon Rpg Online

venha Fazer parte dessa Incrivel Aventura

Criar Conta

____________##___________

Object Builder 0.5.441 

Link to post
Share on other sites

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?

1.png.f984e18270f1fce843e0c76d0a3a5aa0.png

 

 

Link to post
Share on other sites

Posted (edited)

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 

 

Edited by jenison06 (see edit history)

w31Cm4K.png

 

PokeWorks-Pokemon Rpg Online

venha Fazer parte dessa Incrivel Aventura

Criar Conta

____________##___________

Object Builder 0.5.441 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Similar Content

    • By Bruce Pereira
      Eu quero colocar uma storage nesse jutsu de dash, para poder criar outros jutsus, eu criei 3 dashs em meu servidor mas ta bugando. exemplo: uso o dash 1 aparece o efeito do dash 2, uso dash 2 e aparece o efeito do dash 3, eu tentei colocar uma storage mas não consegui.
       
      script sem edição minha \/
       
       
    • By stauro
      Alguém poderia me ajudar a colocar bonus exp no meu cast system?
       
       
       
       
       
       
       
       function onSay(cid, words, param, channel) local tmp = param:explode(" ") if not(tmp[1]) then return doPlayerSendCancel(cid, "Parameters needed") end if tmp[1] == "on" then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cast has started.") doPlayerSetCastState(cid, true) doPlayerSave(cid) elseif getPlayerCast(cid).status == false then return doPlayerSendCancel(cid, "Your cast has to be running for this action.") elseif tmp[1] == "off" then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cast has ended.") doPlayerSetCastState(cid, false) doPlayerSave(cid) elseif isInArray({"pass", "password", "p"}, tmp[1]) then if not(tmp[2]) then return doPlayerSendCancel(cid, "You need to set a password") end if tmp[2]:len() > 10 then return doPlayerSendCancel(cid, "The password is too long. (Max.: 10 letters)") end if tmp[2] == "off" then doPlayerSetCastPassword(cid, "") doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cast password has been removed.") else doPlayerSetCastPassword(cid, tmp[2]) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cast password was set to: " .. tmp[2]) end elseif isInArray({"desc", "description", "d"}, tmp[1]) then local d = param:gsub(tmp[1]..(tmp[2] and " " or ""), "") if not(d) or d:len() == 0 then return doPlayerSendCancel(cid, "You need to specify a description.") end if d:len() > 50 then return doPlayerSendCancel(cid, "The description is too long. (Max.: 50 letters)") end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cast description was set to: ") doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, d) doPlayerSetCastDescription(cid, d) elseif tmp[1] == "ban" then if not(tmp[2]) then return doPlayerSendCancel(cid, "Specify a spectator that you want to ban.") end if doPlayerAddCastBan(cid, tmp[2]) then doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Spectator '" .. tmp[2] .. "' has been banned.") else doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Spectator '" .. tmp[2] .. "' could not be banned.") end elseif tmp[1] == "unban" then if not(tmp[2]) then return doPlayerSendCancel(cid, "Specify the person you want to unban.") end if doPlayerRemoveCastBan(cid, tmp[2]) then doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Spectator '" .. tmp[2] .. "' has been unbanned.") else doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Spectator '" .. tmp[2] .. "' could not be unbanned.") end elseif param == "bans" then local t = getCastBans(cid) local text = "Cast Bans:\n\n" for k, v in pairs(t) do text = text .. "*" .. v.name .. "\n" end if text == "Cast Bans:\n\n" then text = text .. "No bans." end doShowTextDialog(cid, 5958, text) elseif tmp[1] == "mute" then if not(tmp[2]) then return doPlayerSendCancel(cid, "Specify a spectator that you want to mute.") end if doPlayerAddCastMute(cid, tmp[2]) then doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Spectator '" .. tmp[2] .. "' has been muted.") else doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Spectator '" .. tmp[2] .. "' could not be muted.") end elseif tmp[1] == "unmute" then if not(tmp[2]) then return doPlayerSendCancel(cid, "Specify the person you want to unmute.") end if doPlayerRemoveCastMute(cid, tmp[2]) then doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Spectator '" .. tmp[2] .. "' has been unmuted.") else doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Spectator '" .. tmp[2] .. "' could not be unmuted.") end elseif param == "mutes" then local t = getCastMutes(cid) local text = "Cast Mutes:\n\n" for k, v in pairs(t) do text = text .. "*" .. v.name .. "\n" end if text == "Cast Bans:\n\n" then text = text .. "No mutes." end doShowTextDialog(cid, 5958, text) elseif param == "viewers" then local t = getCastViewers(cid) local text, count = "Cast Viewers:\n#Viewers: |COUNT|\n\n", 0 for _,v in pairs(t) do count = count + 1 text = text .. "*" .. v.name .."\n" end if text == "Cast Viewers:\n#Viewers: |COUNT|\n\n" then text = "Cast Viewers:\n\nNo viewers." end text = text:gsub("|COUNT|", count) doShowTextDialog(cid, 5958, text) elseif param == "status" then local t, c = getCastViewers(cid), getPlayerCast(cid) local count = 0 for _,v in pairs(t) do count = count + 1 end doShowTextDialog(cid, 5958, "Cast Status:\n\n*Viewers:\n " .. count .. "\n*Description:\n "..(c.description == "" and "Not set" or c.description).."\n*Password:\n " .. (c.password == "" and "Not set" or "Set - '"..c.password.."'")) elseif param == "update" then if getPlayerStorageValue(cid, 656544) > os.time() then return doPlayerSendCancel(cid, "You used this command lately. Wait: " .. (getPlayerStorageValue(cid, 656544)-os.time()) .. " sec.") end doPlayerSave(cid) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "The cast settings have been updated.") doPlayerSetStorageValue(cid, 656544, os.time()+60) end return true end  
       
       
    • By stauro
      Alguém sabe como adicionar atributo de sorte no item? Tipo  "Luck + 2%"
      Não consigo achar nenhum item que tenha pra eu copiar, os itens que eu sei não estão com esse atributo
       
       
       
       
         
       
       
      Resolvido.
    • By Bruce Pereira
      Alguém me ajudar a adicionar uma storage nessa script, tentei de varias formas e não consegui.
       
       
    • By raphadoidera
      .Qual servidor ou website você utiliza como base? 
      8.60
      Qual o motivo deste tópico? 
      Esse script de trap está dando exhausted no combo. Eu queria que o char depois de usar a Trap, continuasse combando no alvo. Alguém pode ajudar?
      Está surgindo algum erro? Se sim coloque-o aqui. 
       
      Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui. 

      WhatsApp_Video_2021-05-03_at_16_03_21.mp4 @139 salva nessa irmão?
  • Recently Browsing   0 members

    No registered users viewing this page.


×
×
  • Create New...

Important Information

Confirmação de Termo