Ir para conteúdo

Featured Replies

Postado

Bom, dei uma pesquisada e aprendi como mudar o shiny feito pelo NPC de clan, como mudar o valor, o boost necessário, mas nada de como mudar o item pedido pelo npc.

Exemplo: NPC Psycraft Master pede um Hypno+20 e 500k para transforma-lo em shiny. Eu queria além disso pedir outro item, Scarab Coin, esse item no meu ot serve como um event point, pra comprar house vc precisa de 3 scarab, shiny box 9, etc, ele é conseguido em quests, cada quest da 1 dele. Queria que o npc pedisse o pokemon+20 , 500k e 2 scarab coin para fazer o shiny. Alguem pode me ajudar ? ^^

 

Id do Scarab Coin - 2159

Meu cliente é base Cyan

 

 

Arquivo.lua de um dos Npcs de clan:

 

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
 
       
        if (msgcontains(msg, 'clan') or msgcontains(msg, 'Clan')) then   --alterado v1.7
           if getPlayerClanName(cid) == 'Psycraft' then   --alterado v1.7
              selfSay("You already are of the clan psycraft!", cid)
              talkState[talkUser] = 0
              return true
           elseif getPlayerClanNum(cid) ~= -1 then     --alterado v1.7
              selfSay("You already are of another clan!", cid)
              talkState[talkUser] = 0
              return true    
           end
              selfSay("So you want to join in my clan... Are you sure that?", cid)
              talkState[talkUser] = 2  
        elseif (msgcontains(msg, 'yes') or msgcontains(msg, 'Yes')) and talkState[talkUser] == 2 then
           if getPlayerLevel(cid) < 120 then
              selfSay("You are too weak yet... You need to be atleast level 120 to enter in the clan!", cid)
              talkState[talkUser] = 0
              return true
           end
           selfSay("OK then... Now you are a great member of de clan psycraft!", cid)
           setPlayerClan(cid, 'Psycraft')   --alterado v1.7
           talkState[talkUser] = 0
           
           
        elseif (msgcontains(msg, 'leave') or msgcontains(msg, 'Leave')) then  --alterado v1.7  \/
           if getPlayerClanName(cid) ~= 'Psycraft' then 
              selfSay("You aren't of the clan, get out of here!", cid)
              talkState[talkUser] = 0
              return true
           else
              selfSay("So you want to leave the clan... Are you sure that?", cid)
              talkState[talkUser] = 3
           end
        elseif (msgcontains(msg, 'yes') or msgcontains(msg, 'Yes')) and talkState[talkUser] == 3 then 
           if removePlayerClan(cid) then
              selfSay("Ok then, good luck!", cid)
              talkState[talkUser] = 0
              return true
           else
              selfSay("You have some task to finish of one trainer! Go finish it!", cid)
              talkState[talkUser] = 0
              return true
           end
           
        
        elseif (msgcontains(msg, 'shiny') or msgcontains(msg, 'Shiny')) then    --alterado v1.7
           if getPlayerClanName(cid) ~= 'Psycraft' then    --alterado v1.7
              selfSay("You aren't of the clan Psycraft! Get out of here!", cid)
              return true
           else   
              selfSay("So you want to transform your Hypno in a Shiny Hypno? It will cost 500k!", cid)
              talkState[talkUser] = 4
           end
        elseif (msgcontains(msg, 'yes') or msgcontains(msg, 'Yes')) and talkState[talkUser] == 4 then
           if getPlayerSlotItem(cid, 8).uid <= 0 then
              selfSay("Sorry, you don't have a pokemon in the main slot!", cid)
              talkState[talkUser] = 0
		      return true
	       end 
	                                                                             --alterado v1.2
	       if #getCreatureSummons(cid) >= 1 then
	          selfSay("Go back your pokemon!", cid)
              talkState[talkUser] = 0
              return true
           end
	       
	       local pb = getPlayerSlotItem(cid, 8).uid
	       
	       if getItemAttribute(pb, "poke") ~= "Hypno" then
	          selfSay("Put a Hypno's pokeball atleast +20 in main slot!", cid)
              talkState[talkUser] = 0
              return true
           end
              
           if not getItemAttribute(pb, "boost") or getItemAttribute(pb, "boost") < 20 then
              selfSay("Sorry, your Hypno is not boosted +20!", cid)
              talkState[talkUser] = 0
              return true
           end
                                          --100000 = 1k, 1000000 = 10k, 10000000 = 100k
           if doPlayerRemoveMoney(cid, 50000000) == true then
              selfSay("So there is it! Enjoy!", cid)
              doItemSetAttribute(pb, "hp", 1)
              doItemSetAttribute(pb, "poke", "Shiny Hypno")
		      doItemSetAttribute(pb, "description", "Contains a Shiny Hypno.")
		      doItemEraseAttribute(pb, "boost")
		      doTransformItem(getPlayerSlotItem(cid, 7).uid, fotos["Shiny Hypno"])

		doItemSetAttribute(pb, "Icone", "yes")	
		doTransformItem(pb, icons[getItemAttribute(pb, "poke")].on)

		      if useKpdoDlls then
		        doCreatureExecuteTalkAction(cid, "/pokeread")
	          end
		      talkState[talkUser] = 0
		      return true
	      else
	          selfSay("You don't have enough money!", cid)
	          talkState[talkUser] = 0
	          return true
          end
        end

return true
end

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

 

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

Postado

MMHUCMQ.png  Esta é uma mensagem automática, este tópico foi movido para a área correta.
  Regras do fórum: http://www.tibiaking.com/forum/topic/1281-regras-gerais/#comment-7680

Este tópico foi movido:
De: Scripting OTServ > OTServ > Monsters e NPCs
Para: Suporte OTServ > OTServ > Suporte de Scripts

discord.pngDiscord: vankk #7765

Precisando de ajuda? Entre em contato comigo via Discord.

 

Muitos vêm seus muitos dias de glória, mas poucos vêm seus muitos dias de luta.

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.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo