Ir para conteúdo

Featured Replies

  • Respostas 18
  • Visualizações 1.1k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • @Jociel Tenta assim local t = { [255] = {256, 50, 3000, 3000} -- {old vocation} = {New vocation, looktype, life extra, mana extra} } local itemid, count = 2150 , 5 -- ID do item que precisa

  • @Jociel local t = { [255] = {256, 50, 3000, 3000} -- {old vocation} = {New vocation, looktype, life extra, mana extra} } local itemid, count = 2150 , 5 -- ID do item que precisa local level =

Postado
  Em 25/05/2018 em 23:36, Jociel disse:

@Sttorm 

se nao for pedi demais poderia fazer essa promotion em tal LVL:

e depois que fizesse desse kick no player so para fechar em chave de ouro

local t  = {

[255] = {256, 50, 3000, 3000} -- {old vocation} = {New vocation, looktype, life extra, mana extra} 

}

local itemid, count = 2150 , 5 -- ID do item que precisa
local level = 100 -- level necessario para a promotion 

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)
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
local a = t[getPlayerVocation(cid)]
local outfit = {lookType = a[2]}

      if msgcontains(msg, "yes") then
         if a then
            if getPlayerLevel(cid) >= level then 
               if doPlayerRemoveItem(cid, itemid, count) then
                  doPlayerSetVocation(cid, a[1])
                  doCreatureChangeOutfit(cid, outfit)
                  setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + a[3])
                  setCreatureMaxMana(cid, getCreatureMaxMana(cid) + a[4])
                  addEvent(doRemoveCreature, 1000, cid)
               else
                   selfSay("voce nao tem o item necessario", cid)
               end
            else
                selfSay("Voce nao tem o level necessario", cid)
            end
         else
             selfSay("Sua vocation não tem promotion", cid)
         end
      end
return TRUE
end

 

Postado
  • Autor
  Em 26/05/2018 em 00:04, Sttorm disse:

local t  = {

[255] = {256, 50, 3000, 3000} -- {old vocation} = {New vocation, looktype, life extra, mana extra} 

}

local itemid, count = 2150 , 5 -- ID do item que precisa
local level = 100 -- level necessario para a promotion 

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)
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
local a = t[getPlayerVocation(cid)]
local outfit = {lookType = a[2]}

      if msgcontains(msg, "yes") then
         if a then
            if getPlayerLevel(cid) >= level then 
               if doPlayerRemoveItem(cid, itemid, count) then
                  doPlayerSetVocation(cid, a[1])
                  doCreatureChangeOutfit(cid, outfit)
                  setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + a[3])
                  setCreatureMaxMana(cid, getCreatureMaxMana(cid) + a[4])
                  addEvent(doRemoveCreature, 1000, cid)
               else
                   selfSay("voce nao tem o item necessario", cid)
               end
            else
                selfSay("Voce nao tem o level necessario", cid)
            end
         else
             selfSay("Sua vocation não tem promotion", cid)
         end
      end
return TRUE
end

 

quando o player conversa com o npc da o seguinte error

[26/05/2018 11:07:43] [Error - Npc interface] 
[26/05/2018 11:07:43] data/npc/scripts/mysticSystem.lua:onCreatureSay
[26/05/2018 11:07:43] Description: 
[26/05/2018 11:07:43] data/npc/scripts/mysticSystem.lua:25: attempt to index local 'a' (a nil value)
[26/05/2018 11:07:43] stack traceback:
[26/05/2018 11:07:43]     data/npc/scripts/mysticSystem.lua:25: in function 'callback'
[26/05/2018 11:07:43]     data/npc/lib/npcsystem/npchandler.lua:390: in function 'onCreatureSay'
[26/05/2018 11:07:43]     data/npc/scripts/mysticSystem.lua:19: in function <data/npc/scripts/mysticSystem.lua:19>

 

e quando o player nao tem a vocation o npc nao fala nada

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

Informação Importante

Confirmação de Termo