Ir para conteúdo

Featured Replies

  • Respostas 8
  • Visualizações 794
  • Created
  • Última resposta

Top Posters In This Topic

Postado

Como voce quer a bless? por talkactions ou npc?

Ei kk eu sei q o topico nãum e meu mais se poderia criar uma de npc para versão 8.54?

1573453_2.png

"HeHe"

 

Postado
  • Administrador

Crie um arquivo chamado Bless.lua na pasta data/npc/scripts e cole isso

no caso o preço é 50k

local focuses = {}
local function isFocused(cid)
    for i, v in pairs(focuses) do
        if(v == cid) then
            return true
        end
    end
    return false
end
 
local function addFocus(cid)
    if(not isFocused(cid)) then
        table.insert(focuses, cid)
    end
end
local function removeFocus(cid)
    for i, v in pairs(focuses) do
        if(v == cid) then
            table.remove(focuses, i)
            break
        end
    end
end
local function lookAtFocus()
    for i, v in pairs(focuses) do
        if(isPlayer(v)) then
            doNpcSetCreatureFocus(v)
            return
        end
    end
    doNpcSetCreatureFocus(0)
end
 
local price = 50000 -- Valor da bless
 
function onCreatureSay(cid, type, msg)
    if(not (isFocused(cid)) and (msg == "hi" or msg == "hello")) then
        selfSay("Welcome, ".. getCreatureName(cid) ..". I sell {blessing}.", cid)
        addFocus(cid)
    elseif((isFocused(cid)) and (msg == "bless" or msg == "blessing")) then
        selfSay("Would you like buying blessing per ".. doNumberFormat(price) .." gold coins?", cid)
    elseif((isFocused(cid)) and (msg == "yes")) then
        if getPlayerMoney(cid) >= price then
            selfSay("Alright.", cid)
            doPlayerRemoveMoney(cid, price)
            doPlayerAddBlessing(cid, 1)
            doPlayerAddBlessing(cid, 2)
            doPlayerAddBlessing(cid, 3)
            doPlayerAddBlessing(cid, 4)
            doPlayerAddBlessing(cid, 5)
            doPlayerAddBlessing(cid, 6)
        else
            selfSay("You don't have enough money.", cid)
        end
    elseif((isFocused(cid)) and (msg == "bye" or msg == "goodbye" or msg == "cya")) then
        selfSay("Goodbye!", cid)
        closeShopWindow(cid)
        removeFocus(cid)
    end
end
 
function onThink()
    for i, focus in pairs(focuses) do
        if(not isCreature(focus)) then
            removeFocus(focus)
        else
            local distance = getDistanceTo(focus) or -1
            if((distance > 4) or (distance == -1)) then
                selfSay("Hey, where you going?")
                removeFocus(focus)
            end
        end
    end
    lookAtFocus()
end

Crie um arquivo chamado Bless.xml na pasta data/npc e cole isso

<?xml version="1.0" encoding="UTF-8"?>
<npc name="Bless Seller" script="Bless.lua" walkinterval="2000" floorchange="0">
    <health now="150" max="150" />
    <look type="135" head="57" body="59" legs="40" feet="76" corpse="2212" />
</npc>

TibiaKing Team- KingTópicos
www.tibiaking.com

Postado

 

Crie um arquivo chamado Bless.lua na pasta data/npc/scripts e cole isso

no caso o preço é 50k

local focuses = {}
local function isFocused(cid)
    for i, v in pairs(focuses) do
        if(v == cid) then
            return true
        end
    end
    return false
end
 
local function addFocus(cid)
    if(not isFocused(cid)) then
        table.insert(focuses, cid)
    end
end
local function removeFocus(cid)
    for i, v in pairs(focuses) do
        if(v == cid) then
            table.remove(focuses, i)
            break
        end
    end
end
local function lookAtFocus()
    for i, v in pairs(focuses) do
        if(isPlayer(v)) then
            doNpcSetCreatureFocus(v)
            return
        end
    end
    doNpcSetCreatureFocus(0)
end
 
local price = 50000 -- Valor da bless
 
function onCreatureSay(cid, type, msg)
    if(not (isFocused(cid)) and (msg == "hi" or msg == "hello")) then
        selfSay("Welcome, ".. getCreatureName(cid) ..". I sell {blessing}.", cid)
        addFocus(cid)
    elseif((isFocused(cid)) and (msg == "bless" or msg == "blessing")) then
        selfSay("Would you like buying blessing per ".. doNumberFormat(price) .." gold coins?", cid)
    elseif((isFocused(cid)) and (msg == "yes")) then
        if getPlayerMoney(cid) >= price then
            selfSay("Alright.", cid)
            doPlayerRemoveMoney(cid, price)
            doPlayerAddBlessing(cid, 1)
            doPlayerAddBlessing(cid, 2)
            doPlayerAddBlessing(cid, 3)
            doPlayerAddBlessing(cid, 4)
            doPlayerAddBlessing(cid, 5)
            doPlayerAddBlessing(cid, 6)
        else
            selfSay("You don't have enough money.", cid)
        end
    elseif((isFocused(cid)) and (msg == "bye" or msg == "goodbye" or msg == "cya")) then
        selfSay("Goodbye!", cid)
        closeShopWindow(cid)
        removeFocus(cid)
    end
end
 
function onThink()
    for i, focus in pairs(focuses) do
        if(not isCreature(focus)) then
            removeFocus(focus)
        else
            local distance = getDistanceTo(focus) or -1
            if((distance > 4) or (distance == -1)) then
                selfSay("Hey, where you going?")
                removeFocus(focus)
            end
        end
    end
    lookAtFocus()
end

Crie um arquivo chamado Bless.xml na pasta data/npc e cole isso

<?xml version="1.0" encoding="UTF-8"?>
<npc name="Bless Seller" script="Bless.lua" walkinterval="2000" floorchange="0">
    <health now="150" max="150" />
    <look type="135" head="57" body="59" legs="40" feet="76" corpse="2212" />
</npc>

Eu falo Blessgin mas o npc não responde :c

1573453_2.png

"HeHe"

 

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