Ir para conteúdo
  • 0

@PEDIDO


Thiago3712

Pergunta

3 respostass a esta questão

Posts Recomendados

Em data/npc/scripts adicione o arquivo promotion.lua com isso dentro:

 

-- Script by Will Oliveira

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 config = {
level = 300, -- Level minimo pra obter a promotion
money
= 500, -- Preço da promotion (em gps)
first_voc = 13,14,15,16 -- Id da vocação anterior da promotion
promot_voc
= 642,643,644,220 -- Id da vocação promovida
npc_message
= { -- Falas do npc
"Do you want to be promoted?",
"You don't have the required vocation to be promoted.",
"You don't have the required level to be promoted.",
"Sorry, you don't have enough money.",
"You're already promoted.",
"Done. You're promoted!"
}
}
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid
if(msgcontains(msg, 'promotion')) and getPlayerVocation(cid) == config.first_voc and getPlayerLevel(cid) >= config.level and getPlayerMoney(cid) >= config.money then
selfSay(config.npc_message[1], cid)
talkState[talkUser] = 1
elseif getPlayerVocation(cid) == config.promot_voc then
selfSay(config.npc_message[5], cid)
elseif getPlayerLevel(cid) < config.level then
selfSay(config.npc_message[3], cid)
elseif getPlayerMoney(cid) < config.money then
selfSay(config.npc_message[4], cid)
elseif getPlayerVocation(cid) ~= config.first_voc then
selfSay(config.npc_message[2], cid)
end
if (msgcontains(msg, 'yes')) and talkState[talkUser] == 1 then
doPlayerRemoveMoney(cid, config.money)
doPlayerSetVocation(cid, config.promot_voc)
doSendMagicEffect(getCreaturePosition(cid), 28)
selfSay(config.npc_message[6], cid)
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

Em data/npc adicione um arquivo xml com o nome do seu npc, dentro desse arquivo adicione isso:

 

<?xml version="1.0" encoding="UTF-8"?>

<npc name="Aldo" script="promotion.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="128" head="17" body="54" legs="114" feet="0" addons="2"/>
<parameters>
<parameter key="message_greet" value="Hello |PLAYERNAME|, I'm a promoter."/>
</parameters>
</npc>

 

Em npc name você coloca o nome do seu npc, que no caso já ta com o nome Aldo.

 

em:

level = 300, -- Level minimo pra obter a promotion - determine o lvl

money = 500, -- Preço da promotion (em gps)
first_voc = 13,14,15,16 -- Id da vocação anterior da promotion
promot_voc
= 642,643,644,220 -- Id da vocação promovida

 

 

Créditos pelo script: WillOliveira

Créditos pelo upgrade: Kempaichi

 

Link para o comentário
https://xtibia.com/forum/topic/221887-pedido/#findComment-1567060
Compartilhar em outros sites

Em data/npc/scripts adicione o arquivo promotion.lua com isso dentro:

 

-- Script by Will Oliveira

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

level = 300, -- Level minimo pra obter a promotion

money = 500, -- Preço da promotion (em gps)

first_voc = 13,14,15,16 -- Id da vocação anterior da promotion

promot_voc = 642,643,644,220 -- Id da vocação promovida

npc_message = { -- Falas do npc

"Do you want to be promoted?",

"You don't have the required vocation to be promoted.",

"You don't have the required level to be promoted.",

"Sorry, you don't have enough money.",

"You're already promoted.",

"Done. You're promoted!"

}

}

if(not npcHandler:isFocused(cid)) then

return false

end

local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid

if(msgcontains(msg, 'promotion')) and getPlayerVocation(cid) == config.first_voc and getPlayerLevel(cid) >= config.level and getPlayerMoney(cid) >= config.money then

selfSay(config.npc_message[1], cid)

talkState[talkUser] = 1

elseif getPlayerVocation(cid) == config.promot_voc then

selfSay(config.npc_message[5], cid)

elseif getPlayerLevel(cid) < config.level then

selfSay(config.npc_message[3], cid)

elseif getPlayerMoney(cid) < config.money then

selfSay(config.npc_message[4], cid)

elseif getPlayerVocation(cid) ~= config.first_voc then

selfSay(config.npc_message[2], cid)

end

if (msgcontains(msg, 'yes')) and talkState[talkUser] == 1 then

doPlayerRemoveMoney(cid, config.money)

doPlayerSetVocation(cid, config.promot_voc)

doSendMagicEffect(getCreaturePosition(cid), 28)

selfSay(config.npc_message[6], cid)

end

end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

Em data/npc adicione um arquivo xml com o nome do seu npc, dentro desse arquivo adicione isso:

 

<?xml version="1.0" encoding="UTF-8"?>

<npc name="Aldo" script="promotion.lua" walkinterval="2000" floorchange="0">

<health now="100" max="100"/>

<look type="128" head="17" body="54" legs="114" feet="0" addons="2"/>

<parameters>

<parameter key="message_greet" value="Hello |PLAYERNAME|, I'm a promoter."/>

</parameters>

</npc>

 

Em npc name você coloca o nome do seu npc, que no caso já ta com o nome Aldo.

 

em:

level = 300, -- Level minimo pra obter a promotion - determine o lvl

money = 500, -- Preço da promotion (em gps)

first_voc = 13,14,15,16 -- Id da vocação anterior da promotion

promot_voc = 642,643,644,220 -- Id da vocação promovida

 

 

Créditos pelo script: WillOliveira

Créditos pelo upgrade: Kempaichi

 

Obrigado . Vo Testa Aki . Ja Dei REP ++

Link para o comentário
https://xtibia.com/forum/topic/221887-pedido/#findComment-1567073
Compartilhar em outros sites

Tópico movido para a seção de dúvidas e pedidos resolvidos.

O tópico foi fechado e movido para lixeira por estar inativo a mais de 30 dias. Caso seja preciso reabrir o mesmo, favor entrar em contato com a equipe.

Link para o comentário
https://xtibia.com/forum/topic/221887-pedido/#findComment-1589550
Compartilhar em outros sites

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

×
×
  • Criar Novo...