Ir para conteúdo

Featured Replies

Postado

Boa tarde galera do TK

 

 

Tenho um NPC em meu server que muda vocação, só que quando o druid ta level 8k e muda a vocação, a quantidade de ML que ele tem é bem alta,  e a ML pro Knight fica a mesma.

 

Um EK com 100k de mana é foda né kk, consigo alterar pra quando trocar a vocação alterar HP/Mana de acordo com as vocations?

 

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, 'sorcerer') or msgcontains(msg, 'sorc')) then
selfSay('Deseja virar {Sorcerer} por 10 Lethal Orbs?', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if(getPlayerItemCount(cid, 7722) >= 10) then
doPlayerRemoveItem(cid, 7722, 10)
doPlayerSetVocation(cid,1)
selfSay('Vocação trocada com sucesso , Agora você é um Sorcerer.', cid)
else
selfSay('Você não tem {Lethal Orbs} Suficientes.', cid)
end
talkState[talkUser] = 0

elseif(msgcontains(msg, 'druid') or msgcontains(msg, 'druida')) then
selfSay('Deseja virar {Druid} por 10 Lethal Orbs?', cid)
talkState[talkUser] = 2
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 2) then
if(getPlayerItemCount(cid, 7722) >= 10) then
doPlayerRemoveItem(cid, 7722, 10)
doPlayerSetVocation(cid,2)
selfSay('Vocação trocada com sucesso , Agora você é um Druid.', cid)
else
selfSay('Você não tem {Lethal Orbs} Suficientes.', cid)
end
talkState[talkUser] = 0

elseif(msgcontains(msg, 'Knight') or msgcontains(msg, 'kina')) then
selfSay('Deseja virar {knight} por 10 Lethal Orbs?', cid)
talkState[talkUser] = 3
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 3) then
if(getPlayerItemCount(cid, 7722) >= 10) then
doPlayerRemoveItem(cid, 7722, 10)
doPlayerSetVocation(cid,4)
selfSay('Vocação trocada com sucesso , Agora você é um Knight.', cid)
else
selfSay('Você não tem {Lethal Orbs} Suficientes.', cid)
end
talkState[talkUser] = 0

elseif(msgcontains(msg, 'paladin') or msgcontains(msg, 'pala')) then
selfSay('Deseja virar {Paladin} por 10 Lethal Orbs?', cid)
talkState[talkUser] = 4
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 4) then
if(getPlayerItemCount(cid, 7722) >= 10) then
doPlayerRemoveItem(cid, 7722, 10)
doPlayerSetVocation(cid,3)
selfSay('Vocação trocada com sucesso , Agora você é um Paladin.', cid)
else
selfSay('Você não tem {Lethal Orbs} Suficientes.', cid)
end
talkState[talkUser] = 0
end
return true
end

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

 

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

Resolvido por Qwizer

Ir para solução
  • Respostas 9
  • Visualizações 581
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCr

Posted Images

Postado
local t = {
              --[vocation name] = {vocationid, hp extra, mana extra},
              
["Druid"]    = {2, 100, 50},
["Knight"]   = {4, 100, 50},
["Paladin"]  = {3, 100, 50},
["Sorcerer"] = {1, 100, 50},

}

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 get_voc = t[getParameters()]
local pos = getCreaturePosition(cid)

   if get_voc then
    if(getPlayerItemCount(cid, 7722) >= 10) then
    
   doPlayerRemoveItem(cid, 7722, 10)
   selfSay('Vocation trocada com sucesso', cid)
   doSendMagicEffect(pos, 5)
   doPlayerSetVocation(cid, get_voc[1])
   setCreatureMaxHealth(cid, getCreatureMaxMana(cid) + get_voc[2])
   setCreatureMaxMana(cid, getCreatureMaxMana(cid) + get_voc[3])
   
    else
    selfSay('Você não tem {Lethal Orbs} Suficientes.', cid)
    doSendMagicEffect(pos, 3)
    return true
    end
   else
   selfSay('{Vocation} not found', cid)
   doSendMagicEffect(pos, 3) 
   return true
   end
return true
end 

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

 

Postado
  • Autor
12 horas atrás, Sttorm disse:

local t = {
              --[vocation name] = {vocationid, hp extra, mana extra},
              
["Druid"]    = {2, 100, 50},
["Knight"]   = {4, 100, 50},
["Paladin"]  = {3, 100, 50},
["Sorcerer"] = {1, 100, 50},

}

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 get_voc = t[getParameters()]
local pos = getCreaturePosition(cid)

   if get_voc then
    if(getPlayerItemCount(cid, 7722) >= 10) then
    
   doPlayerRemoveItem(cid, 7722, 10)
   selfSay('Vocation trocada com sucesso', cid)
   doSendMagicEffect(pos, 5)
   doPlayerSetVocation(cid, get_voc[1])
   setCreatureMaxHealth(cid, getCreatureMaxMana(cid) + get_voc[2])
   setCreatureMaxMana(cid, getCreatureMaxMana(cid) + get_voc[3])
   
    else
    selfSay('Você não tem {Lethal Orbs} Suficientes.', cid)
    doSendMagicEffect(pos, 3)
    return true
    end
   else
   selfSay('{Vocation} not found', cid)
   doSendMagicEffect(pos, 3) 
   return true
   end
return true
end 

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

 

Bom dia Sttorm,

 

O NPC só responde o Hi, não fala mais nada.

 

09:11 Change Vocation: Para mudar profissao custa 10 Lethal Orbs, Deseja virar Sorcerer , Druid , Paladin ou Knight ?
09:11 GOD Slayer [9999]: druid

 

 

test.png

12 horas atrás, Sttorm disse:

local t = {
              --[vocation name] = {vocationid, hp extra, mana extra},
              
["Druid"]    = {2, 100, 50},
["Knight"]   = {4, 100, 50},
["Paladin"]  = {3, 100, 50},
["Sorcerer"] = {1, 100, 50},

}

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 get_voc = t[getParameters()]
local pos = getCreaturePosition(cid)

   if get_voc then
    if(getPlayerItemCount(cid, 7722) >= 10) then
    
   doPlayerRemoveItem(cid, 7722, 10)
   selfSay('Vocation trocada com sucesso', cid)
   doSendMagicEffect(pos, 5)
   doPlayerSetVocation(cid, get_voc[1])
   setCreatureMaxHealth(cid, getCreatureMaxMana(cid) + get_voc[2])
   setCreatureMaxMana(cid, getCreatureMaxMana(cid) + get_voc[3])
   
    else
    selfSay('Você não tem {Lethal Orbs} Suficientes.', cid)
    doSendMagicEffect(pos, 3)
    return true
    end
   else
   selfSay('{Vocation} not found', cid)
   doSendMagicEffect(pos, 3) 
   return true
   end
return true
end 

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

 

image.thumb.png.3d8a0cb52dc5a4bc01d606e73f6d8220.png

lib.zip

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

Postado

Tenta assim:
 

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 function getPlayerInfoByVocation(cid, vocation)
	local info = getVocationInfo(vocation)
	local level = getPlayerLevel(cid)
	return {health = (info.healthGain * level-1) + 150, mana = (info.manaGain * level-1) + 90, cap = (info.capacity) * level}
end

if(msgcontains(msg, 'sorcerer') or msgcontains(msg, 'sorc')) then
selfSay('Deseja virar {Sorcerer} por 10 Lethal Orbs?', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if(getPlayerItemCount(cid, 7722) >= 10) then
doPlayerRemoveItem(cid, 7722, 10)
doPlayerSetVocation(cid,1)
local values = getPlayerInfoByVocation(cid, 1)
setCreatureMaxHealth(cid, values.health)
setCreatureMaxMana(cid, values.mana)
doPlayerSetMaxCapacity(cid, values.cap)
selfSay('Vocação trocada com sucesso , Agora você é um Sorcerer.', cid)
else
selfSay('Você não tem {Lethal Orbs} Suficientes.', cid)
end
talkState[talkUser] = 0

elseif(msgcontains(msg, 'druid') or msgcontains(msg, 'druida')) then
selfSay('Deseja virar {Druid} por 10 Lethal Orbs?', cid)
talkState[talkUser] = 2
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 2) then
if(getPlayerItemCount(cid, 7722) >= 10) then
doPlayerRemoveItem(cid, 7722, 10)
doPlayerSetVocation(cid,2)
local values = getPlayerInfoByVocation(cid, 2)
setCreatureMaxHealth(cid, values.health)
setCreatureMaxMana(cid, values.mana)
doPlayerSetMaxCapacity(cid, values.cap)
selfSay('Vocação trocada com sucesso , Agora você é um Druid.', cid)
else
selfSay('Você não tem {Lethal Orbs} Suficientes.', cid)
end
talkState[talkUser] = 0

elseif(msgcontains(msg, 'Knight') or msgcontains(msg, 'kina')) then
selfSay('Deseja virar {knight} por 10 Lethal Orbs?', cid)
talkState[talkUser] = 3
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 3) then
if(getPlayerItemCount(cid, 7722) >= 10) then
doPlayerRemoveItem(cid, 7722, 10)
doPlayerSetVocation(cid,4) 
local values = getPlayerInfoByVocation(cid, 4)
setCreatureMaxHealth(cid, values.health)
setCreatureMaxMana(cid, values.mana)
doPlayerSetMaxCapacity(cid, values.cap)
selfSay('Vocação trocada com sucesso , Agora você é um Knight.', cid)
else
selfSay('Você não tem {Lethal Orbs} Suficientes.', cid)
end
talkState[talkUser] = 0

elseif(msgcontains(msg, 'paladin') or msgcontains(msg, 'pala')) then
selfSay('Deseja virar {Paladin} por 10 Lethal Orbs?', cid)
talkState[talkUser] = 4
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 4) then
if(getPlayerItemCount(cid, 7722) >= 10) then
doPlayerRemoveItem(cid, 7722, 10)
doPlayerSetVocation(cid,3)
local values = getPlayerInfoByVocation(cid, 3)
setCreatureMaxHealth(cid, values.health)
setCreatureMaxMana(cid, values.mana)
doPlayerSetMaxCapacity(cid, values.cap)
selfSay('Vocação trocada com sucesso , Agora você é um Paladin.', cid)
else
selfSay('Você não tem {Lethal Orbs} Suficientes.', cid)
end
talkState[talkUser] = 0
end
return true
end

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

 

                                                                     Ajudei? De nada \o/                                            Att Rusherzin

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