Ir para conteúdo

Featured Replies

Postado

Bom dia galera, é o seguinte....

Eu gostaria de um npc que ao dizer "Hi" a ele, eu pudesse editar sua fala para contar uma historia "x", e, no meio desse texto, caso o player diga "Jester Rod", o npc diga o seguinte:

 

"Eu sou o grande escolhido para poder criar este grande item... mas para sao necessarios 10 jester essence (8303), 1 holy falcon (2141) e 1 medal of honour (5785). Deseja Forjar este item?"

 

Quando o player digitar "Forjar" ele troque os 3 itens:

10 jester essence (8303)

1 holy falcon (2141) 

1 medal of honour (5785)

 

Pela:

Jester Rod (7958)

 

Postado

XML ( Configure você mesmo )

<?xml version="1.0" encoding="UTF-8"?>
<npc name="sensei" script="data/npc/scripts/npc.lua" walkinterval="2000" speed="0" floorchange="0">
<health now="100" max="100"/>
<look type="45" head="19" body="113" legs="95" feet="115" addons="0"/>
  <parameters>
    <parameter key="message_greet" value="coloque a historia aki" />
  </parameters>
</npc>

Script ( Já configurada como você pediu )

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 config = {

item1 = 8303,
item2 = 2141,
item3 = 5785,
items = 7958,
sto   = 34523


}

if(msgcontains(msg, 'Jester rod')) then
   
   selfSay(cid, 'Eu sou o grande escolhido para poder criar este grande item... mas para sao necessarios 10 jester essence, 1 holy falcon e 1 medal of honour. Deseja Forjar este item?')

return true
end

if(msgcontains(msg, 'forjar')) then
 if getPlayerStorageValue(cid, config.sto) == -1 then
  if getPlayerItemCount(cid, config.item1) >= 10  then
   if getPlayerItemCount(cid, config.item2) >= 1   then
    if getPlayerItemCount(cid, config.item3) >= 1   then
     
    
     doPlayerAddItem(cid, config.items, 1)
     selfSay(cid , 'Voce forjou a jester rod')
     setPlayerStorageValue(cid, config.sto, 1)
     doPlayerRemoveItem(cid, config.item1, 10)
     doPlayerRemoveItem(cid, config.item1, 1)
     doPlayerRemoveItem(cid, config.item1, 1)
        
    else
    selfSay(cid, 'Voce precisa de 1 medal of honour')
    end
   else 
   selfSay(cid, 'Voce precisa de 1 holy falcon')
   end
  else
  selfSay(cid, 'Voce precisa de 10 jester essence')
  end  
 else
 selfSay(cid, 'Voce ja forjou a sua jester rod')
 end
return true
end
end


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

 

giphy.gif

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