Ir para conteúdo
  • Cadastre-se

Derivado Quando o npc fica proximo do outro, os 2 npcs responde ao msm tempo


Posts Recomendados

Ola pessoal, me desculpe se estiver postando isso no lugar improprio, mas é minha primeira vez aqui..

estou com uma duvida e gostaria de saber se tem como resolver meu problema, vou mandar 2 print q vai resumir oq estou dizendo no titulo...

 

 a 1 imagem é outro ot

a 2 imagem é meu ot

 

me ajudem por favor...

outro ot.png

meu ot.jpg

Link para o post
Compartilhar em outros sites
Agora, roriscrave disse:

tem um lugar que muda o tanto de 'sqm' que o npc consegue 'escutar', pode ser isso...só nao sei onde

pow eu nao faço a minima ideia tmb de onde fica isso

Link para o post
Compartilhar em outros sites
8 horas atrás, THGSanttos disse:

Manda seu .lua do npc

-- Include external classes.
dofile('data/npc/scripts/lib/npcsystem/npcsystem.lua')

-- get the distance to a creature
function getDistanceToCreature(id)
    if id == 0 or id == nil then
        selfGotoIdle()
    end
    
    cx, cy, cz = creatureGetPosition(id)
    sx, sy, sz = selfGetPosition()
    
    if cx == nil then
        return nil
    end
    
    return math.max(math.abs(sx-cx), math.abs(sy-cy))
end

-- do one step to reach position
function moveToPosition(x,y,z)
    selfMoveTo(x, y, z)
end

-- do one step to reach creature
function moveToCreature(id)
    if id == 0 or id == nil then
        selfGotoIdle()
    end
    tx,ty,tz=creatureGetPosition(id)
    if tx == nil then
        selfGotoIdle()
    else
       moveToPosition(tx, ty, tz)
   end
end

function getCount(msg)
        b, e = string.find(msg, "%d+")

        if b == nil or e == nil then
                count = 1
        else
                count = tonumber(string.sub(msg, b, e))
        end
        if count > 100000 then
                count = 100000
        elseif count == 0 then
                count = 1
        end
        return count
end 

function balance(cid)
                local storage = 666
                local value = getPlayerStorageValue(cid, storage)

                if value > 0 then
                                selfSay('Your account balance is '..value..' gold.')
                else
                                setPlayerStorageValue(cid, storage, 0)
                                selfSay('You don\'t have money in your bank account.')
                end
end
 
function withdraw(cid, value)
                local storage = 666
                local balance = getPlayerStorageValue(cid, storage)

                if balance == -1 then
                        -- Não tinha depositos ainda -> Iniciar com 0
                        setPlayerStorageValue(cid, storage, 0)
                end

                if value <= 0 then
                                selfSay('You cannot withdraw invalid values.')
                elseif balance < value then
                                selfSay('There is not enough gold on your account.')
                else            
                                selfSay('Here you are, '..value..' gold. Please let me know if there is something else I can do for you.')
                                setPlayerStorageValue(cid, storage, balance-value)
                                doPlayerAddMoney(cid,value)
                end
end
 
function deposit(cid, value)
                local storage = 666
                local balance = getPlayerStorageValue(cid, storage)
                
                if balance == -1 then
                        -- Não tinha depositos ainda -> Iniciar com 0
                        setPlayerStorageValue(cid, storage, 0)
                end

                if value < 0 then
                                selfSay('You cannot deposit negative values.')
                elseif doPlayerRemoveMoney(cid,value) == TRUE then
                                selfSay('Alright, we have added the amount of '..value..' gold to your balance. You can withdraw your money anytime you want to.')
                                setPlayerStorageValue(cid, storage, balance + value)
                else
                                selfSay('You do not have enough gold.')
                end
 
end

function transfer(cid, value, xid)
        local storage = 666
        local balanceEu = getPlayerStorageValue(cid, storage)
        local balanceEle = getPlayerStorageValue(xid, storage)

        if value <= 0 then
                selfSay('You cannot transfer illegal values.')
        elseif balanceEu >= value then
                setPlayerStorageValue(cid, storage, balanceEu - value)
                setPlayerStorageValue(xid, storage, balanceEle + value)
                selfSay('Alright, we have transfered the amount of '..value..' gold from your balance to '..NomeDele..' balance.')
                doPlayerSendTextMessage(xid,4,'OT Bank System : '..getPlayerName(cid)..' transfered the amount of '..value..' gold to your balance.')
                selfSay(getPlayerName(xid)..' received confirmation about transfer.')
        else
                selfSay('You do not have enough gold.')
        end
end

function doPlayerGetMoney(cid)
        local gold = getPlayerItemCount(cid,2148)
        local platinum = getPlayerItemCount(cid,2152)
        local crystal = getPlayerItemCount(cid,2160)
        local total = gold + (platinum*100) + (crystal*10000)
        return total
end

-- stop talking
function selfGotoIdle()
    following = false
    attacking = false
    selfAttackCreature(0)
    target = 0
end

-- getCount function by Jiddo
function getCount(msg)
    b, e = string.find(msg, "%d+")
    
    if b == nil or e == nil then
        count = 1
    else
        count = tonumber(string.sub(msg, b, e))
    end
    
    if count > 2000 then
        count = 2000
    elseif count == 0 then
        count = 1
    end
    
    return count
end

-- buy an item
function buy(cid, itemid, count, cost)
    cost = count*cost
    amount = count
    if doPlayerRemoveMoney(cid, cost) == 1 then
        if getItemStackable(itemid) then
            while count > 100 do
                doPlayerAddItem(cid, itemid, 100)
                count = count - 100
            end
            
            doPlayerAddItem(cid, itemid, count) -- add the last items, if there is left
        else
            while count > 0 do
                doPlayerAddItem(cid, itemid, 1)
                count = count - 1
            end
        end
        
        if amount <= 1 then
            selfSay('Here is your '.. getItemName(itemid) .. '!')
        else
            selfSay('Here are your '.. amount ..' '.. getItemName(itemid) .. 's!')        
        end
    else
        selfSay('Sorry, you do not have enough money.')
    end
end

function buyFluidContainer(cid, itemid, count, cost, fluidtype)
    cost = count*cost
    amount = count
    if doPlayerRemoveMoney(cid, cost) == 1 then
        while count > 0 do
            doPlayerAddItem(cid, itemid, fluidtype)
            count = count - 1
        end
        
        if amount <= 1 then
            selfSay('Here is your '.. getItemName(itemid) .. '!')
        else
            selfSay('Here are your '.. amount ..' '.. getItemName(itemid) .. 's!')        
        end
    else
        selfSay('Sorry, you do not have enough money.')
    end
end

function buyContainer(cid, container, itemid, count, money)
    if doPlayerRemoveMoney(cid, money) == 1 then
        bp = doPlayerAddItem(cid, container, 1)
        x = 0
        
        while x < 20 do
            doAddContainerItem(bp, itemid, count)
            x = x + 1
        end
        
        selfSay('Here you are.')
    else
        selfSay('Sorry, you don\'t have enough money.')
    end
end 

-- sell an item
function sell(cid, itemid, count, cost)
    cost = count*cost
    if doPlayerRemoveItem(cid, itemid, count) == 1 then
        doPlayerAddMoney(cid, cost)
        
        if cost > 0 then
            selfSay('You couldn\'t retrieve '.. cost ..' gold pieces, please contact the admin.')
        end
        
        if count <= 1 then
            selfSay('Thanks for this '.. getItemName(itemid) .. '!')
        else
            selfSay('Thanks for these '.. count..' '.. getItemName(itemid) .. 's!')        
        end
    else
        selfSay('Sorry, you do not have this item.')
    end
end

-- pay for anything?
function pay(cid, cost)
    if doPlayerRemoveMoney(cid, cost) == 1 then
        return true
    else
        return false
    end
end

-- learn spell
function learnSpell(cid, spell, cost)
    x,y,z = creatureGetPosition(cid)
    if doPlayerLearnSpell(cid, spell) == 1 then
        if doPlayerRemoveMoney(cid, cost) == 1 then
            doSendMagicEffect({x=x, y=y, z=z}, 14)
            selfSay('To use it say: '.. spell ..'.')
        else
            selfSay('Sorry, you do not have this item.')
        end
    else
        selfSay('You already know this spell.')
    end
end

-- Travel player
function travel(cid, x, y, z)
    destpos = {x = x, y = y, z = z}
    doTeleportThing(cid, destpos)
    doSendMagicEffect(destpos, 10)
end

-- add all addons
function addon(cid, addon)
    if getPlayerSex(cid) == 1 then
        for x = 128, 134 do
            doPlayerAddAddon(cid, x, addon)
        end

        for y = 143, 146 do
            doPlayerAddAddon(cid, y, addon)
        end
        
        for z = 151, 154 do
            doPlayerAddAddon(cid, z, addon)
        end
    else    
        for x = 136, 142 do
            doPlayerAddAddon(cid, x, addon)
        end

        for y = 147, 150 do
            doPlayerAddAddon(cid, y, addon)
        end
        
        for z = 155, 158 do
            doPlayerAddAddon(cid, z, addon)
        end
    end
end

function msgcontains(txt, str)
    return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end
 

Link para o post
Compartilhar em outros sites

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

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

  • Conteúdo Similar

    • Por LeoTK
      Salve galera neste tópico irei postar algumas prints do mapa do servidor para quem queira acompanhar e quem sabe até utilizar de inspiração para mapear o seu NTO.
       
      #Att 11/08/2022

       
       
       
       
      Konoha (Em Desenvolvimento)
       
       
       
       
    • Por DiigooMix
      Como o título já diz, será que alguém possui sprite do hitto e se possível as transformações dele?
    • Por OmegaZero
      Olá gostaria que alguém me ajudasse com uma "scripting" não sei se é pela mesma, seria o seguinte uma determinada arma teria a chance de dar double hit e não sei oque fazer alguem poderia ajudar?

      OBS:não sei se é o local correto se não for mova, desculpe
    • Por Madarasenju
      Olá galera do Tibia King, queria por uns npc's no meu server que não tem função de trade nem nada do tipo, queria que eles só andassem como enfeite, Rep+ Pra quem me ajudar... grato desde já.
    • Por SilenceRoot
      A magia é assim o você usa a a magia e ela ficará ativado por 10 segundos, até que o inimigo lance a primeira magia ou todos de uma vez, quando ele lançar a primeira magia, ele não lhe acertará ou seja esquivando dela, e logo em seguida será teletransportado aleatoriamente ao redor do inimigo que usou.
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo