Olá,
local cfg = {
itemid = xxxx, --Substitua 'xxxx' pelo ID do item usado na Promotion
qnt = xx --Substitua 'xx' pela quantidade do item requerido
}
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 msgCallback(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, 'promotion')then
npcHandler:say("Are you sure?", cid)
talkState[talkUser] = 1
end
if(msgcontains(msg, 'yes') and talkState[talkUser] == 1)then
if(doPlayerRemoveItem(cid, cfg.itemid, cfg.qnt) == TRUE)then
npcHandler:say("From now, you are promoted!", cid)
setPlayerPromotionLevel(cid, 1)
talkState[talkUser] = 0
npcHandler:releaseFocus(cid)
else
npcHandler:say("You don't have ".. cfg.qnt .." ".. getItemNameById(cfg.itemid) .."", cid)
talkState[talkUser] = 0
npcHandler:releaseFocus(cid)
end
else
npcHandler:say("Then not", cid)
talkState[talkUser] = 0
npcHandler:releaseFocus(cid)
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Coloque o conteúdo acima em um arquivo LUA dentro da pasta data/npc/scripts. Após isso, crie um arquivo XML na pasta data/npc e coloque o conteúdo abaixo:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="John" script="data/npc/scripts/NOME DO ARQUIVO.lua" walkinterval="3500" floorchange="0">
<health now="200" max="200"/>
<look type="128" head="114" body="132" legs="114" feet="115" addons="2"/>
<parameters>
<parameter key="message_greet" value="Hello |PLAYERNAME|! I can {promotion} you for 10 ancient runes"/>
<parameter key="message_farewell" value="Bye |PLAYERNAME|!"/>
</parameters>
</npc>
É extremamente importante que você coloque em NOME DO ARQUIVO, o nome do arquivo LUA que você deu.
Você só precisa configurar duas coisas no script LUA,
local cfg = {
itemid = xxxx, --Substitua 'xxxx' pelo ID do item usado na Promotion
qnt = xx --Substitua 'xx' pela quantidade do item requerido
}
Auto-explicativo
Até mais,












info
Grupo: Campones
Registrado: 24/04/10
Posts: 14
Reputação: +8
Char no Tibia: bluub
Eu to querendo o script de um npc que muda a sua vocation por 10 runas antigas
runa antiga = É 1 runa que eu fiz que vai ser nescessario para pagar pela vocation... ela nao tem efeito, só serve como "dinheiro especial"
a versão do meu ot é 8.57
Styller Yourots Styller Yourots 0.7.2.
Aguardo
ah , não sei se esta é a area certa,porfavor se não for,mude-a e desculpe
Duvidas sobre a minha ortografia kkk pergunta ae:
:hi: