Ir para conteúdo

Featured Replies

Postado

O titúlo do tópico é bem auto explicativo, mas para garantir, segue um gif do funcionamento:

Spoiler

Anima%C3%A7%C3%A3o.gif.f13c3e9d0bc1cfa1791d6c98ad938796.gif


 

 

Segue abaixo instruções para o funcionamento do código 

Spoiler

data/creaturescripts/creaturescripts.xml:
<event type="think" name="player_change_lookdir" interval="1" event="script" value="playerchangelookdir.lua"/>

 

data/creaturescripts/scripts/login.lua:

registerCreatureEvent(cid, "player_change_lookdir")

 

data/creaturescripts/scripts/playerchangelookdir.lua:

 

function verifyLookDirPos(cid)
        local positions = {
            north1 = {x = getCreaturePosition(cid).x-1, y = getCreaturePosition(cid).y-1,z = getCreaturePosition(cid).z},
            north2 = {x = getCreaturePosition(cid).x, y = getCreaturePosition(cid).y - 1, z = getCreaturePosition(cid).z},
            north3 = {x = getCreaturePosition(cid).x + 1, y = getCreaturePosition(cid).y - 1, z = getCreaturePosition(cid).z},
            south1 = {x = getCreaturePosition(cid).x - 1, y = getCreaturePosition(cid).y + 1},
            south2 = {x = getCreaturePosition(cid).x, y = getCreaturePosition(cid).y + 1},
            south3 = {x = getCreaturePosition(cid).x + 1, y = getCreaturePosition(cid).y + 1},
            east = {x = getCreaturePosition(cid).x + 1, y = getCreaturePosition(cid).y},
            west = {x = getCreaturePosition(cid).x - 1, y = getCreaturePosition(cid).y},
        }
        local targetpos = getCreaturePosition(getCreatureTarget(cid))
        local targetposition = {x = targetpos.x, y = targetpos.y, z = targetpos.z}
        
        if (targetposition.x == positions.north1.x and targetposition.y == positions.north1.y or targetposition.x == positions.north2.x and targetposition.y == positions.north2.y or targetposition.x == positions.north3.x and targetposition.y == positions.north3.y) then
            return "isinnorth"
        end        
        
        if (targetposition.x == positions.south1.x and targetposition.y == positions.south1.y or targetposition.x == positions.south2.x and targetposition.y == positions.south2.y or targetposition.x == positions.south3.x and targetposition.y == positions.south3.y) then
            return "isinsouth"
        end        
        
        if (targetposition.x == positions.east.x and targetposition.y == positions.east.y) then
            return "isineast"
        end
        
        if (targetposition.x == positions.west.x and targetposition.y == positions.west.y) then
            return "isinwest"
        end

end


function onThink(cid)

    if (isPlayer(cid) and getCreatureTarget(cid) > 1) then
    local north = {x = getCreaturePosition(cid).x-1, y = getCreaturePosition(cid).y-1,z = getCreaturePosition(cid).z}
        if(verifyLookDirPos(cid) == "isinnorth") then
            doCreatureSetLookDir(cid, 0)
        end        
        
        if(verifyLookDirPos(cid) == "isinsouth") then
            doCreatureSetLookDir(cid, 2)
        end        
        
        if(verifyLookDirPos(cid) == "isineast") then
            doCreatureSetLookDir(cid, 1)
        end        
        
        if(verifyLookDirPos(cid) == "isinwest") then
            doCreatureSetLookDir(cid, 3)
        end
    end
    
    return true
end

 

 

  • 2 months later...
Postado
  • Autor
Em 04/11/2021 em 17:03, ADM Alef disse:

é possível colocar esse script pra ser ativado e desativado por comando ?

dá sim, basta adicionar uma verificação se o player possui x storage, e criar um comando que ao o player enviar, adicionar o storage da verificação, pede na seção de suporte e pedidos

  • 11 months later...
Postado

Esse script, pelo que vi e usei, no caso só pega ser fox 1sqm do bicho ? não teria como por distance ? por exemplo até 3/4 sqm ? para ficar virando ? 

Esse script, pelo que vi e usei, no caso só pega ser fox 1sqm do bicho ? não teria como por distance ? por exemplo até 3/4 sqm ? para ficar virando ? 

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.9k

Informação Importante

Confirmação de Termo