Jump to content
  • 0

[Resolvido] Efeito ao andar tfs 1.2


Mixlortt

Question

Opa galera tudo certo? 

Estava precisando de alguma função ou meio de fazer surgir um efeito atrás do player toda vez que ele andar, isso pode ser equipando um anel, clicando em algum item, tanto faz, só precisa ter o efeito atrás do player quando ele andar 

 

Basicamente seria isso, mas aí é feito por source puxando a outfit como condição para o efeito, e é tfs 0.3.6, creio que exista uma maneira mais fácil em lua para tfs 1.2...

 

https://imgur.com/a/M5TsNEt

Link to comment
Share on other sites

15 answers to this question

Recommended Posts

  • 0
50 minutos atrás, Mixlortt disse:

Testei aqui amigo

image.png.48ec308e63352ead0bcf32ab0ed14ec4.png

troca :
 

Config_ = {
    back = {
        [0] = {x = 0, y = 1},
        [1] = {x = -1, y = 0},
        [2] = {x = 0, y = -1},
        [3] = {x = 1, y = 0},
    };
}

function effectWhenWalking(player_uid, id_effect)
    local player = Player(player_uid)
    if player then
        local player_position = player:getPosition()
        local player_direction = player:getDirection()
        local player_pos_x = player_position.x
        local player_pos_y = player_position.y
        local player_pos_z = player_position.z
        local position = {x = player_pos_x + Config_.back[player_direction].x,y = player_pos_y + Config_.back[player_direction].y,z = player_pos_y}
        position:sendMagicEffect(id_effect)
        addEvent(effectWhenWalking, 1, player_uid, id_effect)
    end
end

 

Edited by SrNaja
Link to comment
Share on other sites

  • 0

Coloca la na sua lib :
 

Config_ = {
    back = {
        [0] = {x = 0, y = 1},
        [1] = {x = -1, y = 0},
        [2] = {x = 0, y = -1},
        [3] = {x = 1, y = 0},
    };
}

function effectWhenWalking(player_uid, id_effect)
    local player = Player(player_uid)
    if player then
        local player_position = player:getPosition()
        local player_direction = player:getDirection()
        local player_pos_x = player_position.x
        local player_pos_y = player_position.y
        local player_pos_z = player_position.x
        local position = {x = player_pos_x + Config_.back[player_direction].x,y = player_pos_y + Config_.back[player_direction].y,z = player_pos_y}
        position:sendMagicEffect(id_effect)
        addEvent(effectWhenWalking, 1, player_uid, id_effect)
    end
end


um jeito para você utilizar essa função :
 

local player_uid = player.uid
effectWhenWalking(player_uid, 10)


 

Link to comment
Share on other sites

  • 0
10 horas atrás, SrNaja disse:

Coloca la na sua lib :
 

Config_ = {
    back = {
        [0] = {x = 0, y = 1},
        [1] = {x = -1, y = 0},
        [2] = {x = 0, y = -1},
        [3] = {x = 1, y = 0},
    };
}

function effectWhenWalking(player_uid, id_effect)
    local player = Player(player_uid)
    if player then
        local player_position = player:getPosition()
        local player_direction = player:getDirection()
        local player_pos_x = player_position.x
        local player_pos_y = player_position.y
        local player_pos_z = player_position.x
        local position = {x = player_pos_x + Config_.back[player_direction].x,y = player_pos_y + Config_.back[player_direction].y,z = player_pos_y}
        position:sendMagicEffect(id_effect)
        addEvent(effectWhenWalking, 1, player_uid, id_effect)
    end
end


um jeito para você utilizar essa função :
 

local player_uid = player.uid
effectWhenWalking(player_uid, 10)


 

Testei aqui amigo

image.png.48ec308e63352ead0bcf32ab0ed14ec4.png

Link to comment
Share on other sites

  • 0
2 horas atrás, SrNaja disse:

troca :
 

Config_ = {
    back = {
        [0] = {x = 0, y = 1},
        [1] = {x = -1, y = 0},
        [2] = {x = 0, y = -1},
        [3] = {x = 1, y = 0},
    };
}

function effectWhenWalking(player_uid, id_effect)
    local player = Player(player_uid)
    if player then
        local player_position = player:getPosition()
        local player_direction = player:getDirection()
        local player_pos_x = player_position.x
        local player_pos_y = player_position.y
        local player_pos_z = player_position.z
        local position = {x = player_pos_x + Config_.back[player_direction].x,y = player_pos_y + Config_.back[player_direction].y,z = player_pos_y}
        position:sendMagicEffect(id_effect)
        addEvent(effectWhenWalking, 1, player_uid, id_effect)
    end
end

 

consegui mano, valeu!!!

Edited by Mixlortt
Link to comment
Share on other sites

  • 0
Em 12/01/2022 em 10:31, Mixlortt disse:

Opa galera tudo certo? 

Estava precisando de alguma função ou meio de fazer surgir um efeito atrás do player toda vez que ele andar, isso pode ser equipando um anel, clicando em algum item, tanto faz, só precisa ter o efeito atrás do player quando ele andar 

 

Basicamente seria isso, mas aí é feito por source puxando a outfit como condição para o efeito, e é tfs 0.3.6, creio que exista uma maneira mais fácil em lua para tfs 1.2...

 

https://imgur.com/a/M5TsNEt

em quais arquivos vai para fazer isso achei muito interessante?

Em 13/01/2022 em 19:59, Mixlortt disse:

Testei aqui amigo

image.png.48ec308e63352ead0bcf32ab0ed14ec4.png

passa completo o system e quais pasta vai e tal 

Link to comment
Share on other sites

  • 0
Em 01/02/2022 em 02:05, Dilooow disse:

em quais arquivos vai para fazer isso achei muito interessante?

passa completo o system e quais pasta vai e tal 

o sistema já esta pronto, e já falei aonde tem que colocar

Link to comment
Share on other sites

  • 0
Em 02/02/2022 em 17:44, Dilooow disse:

sou nub nao sei aonde poem queria por uma bike assim com efeito pode me ajudar?

coloca a função na lib, uma pergunta você tem o script da bike?, se sim me mande

 

Link to comment
Share on other sites

  • 0
Em 05/02/2022 em 16:11, SrNaja disse:

coloca a função na lib, uma pergunta você tem o script da bike?, se sim me mande

 

local delay = 0.1
local bonusSpeed = 1.2
local outfitMale = 1315
local outfitFemale = 1316
local condition = Condition(CONDITION_OUTFIT)
condition:setTicks(-1)

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if os.time() > player:getStorageValue(storageDelay) then
               player:setStorageValue(storageDelay, os.time() + delay)
    else
        player:sendCancelMessage(RETURNVALUE_YOUAREEXHAUSTED)
        return true
    end

    if fromPosition.x ~= 65535 then
        player:sendCancelMessage("First pick up the bike.")
        return true
    end

    if player:getStorageValue(storageRide) == 1 then
        player:sendCancelMessage("Sorry, not possible while on ride.")
        return true
    end

    if player:getStorageValue(storageFly) == 1 then
        player:sendCancelMessage("Sorry, not possible while on fly.")
        return true
    end

    if player:getStorageValue(storageSurf) > 0 then
        player:sendCancelMessage("Sorry, not possible while on surf.")
        return true
    end

    if player:getStorageValue(storageDive) > 0 then
        player:sendCancelMessage("Sorry, not possible while on dive.")
        return true
    end

    if player:getStorageValue(storageEvent) > 0 then
        player:sendCancelMessage("Sorry, not possible while on event.")
        return true
    end

    if player:getStorageValue(storageBike) > 0 then
        player:removeCondition(CONDITION_OUTFIT)
        player:changeSpeed(player:getBaseSpeed()-player:getSpeed())
        player:setStorageValue(storageBike, -1)
    else
        local delta = player:getSpeed() * bonusSpeed
        if player:getSex() == PLAYERSEX_MALE then outfit = outfitMale else outfit = outfitFemale end
        condition:setOutfit({lookType = outfit})
        player:addCondition(condition)
        player:setStorageValue(storageBike, 1)
        player:changeSpeed(delta)
    end

    return true
end


 

Link to comment
Share on other sites

  • 0
local delay = 0.1
local effect = 12 -- id do effect
local bonusSpeed = 1.2
local outfitMale = 1315
local outfitFemale = 1316
local condition = Condition(CONDITION_OUTFIT)
condition:setTicks(-1)

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if os.time() > player:getStorageValue(storageDelay) then
               player:setStorageValue(storageDelay, os.time() + delay)
    else
        player:sendCancelMessage(RETURNVALUE_YOUAREEXHAUSTED)
        return true
    end

    if fromPosition.x ~= 65535 then
        player:sendCancelMessage("First pick up the bike.")
        return true
    end

    if player:getStorageValue(storageRide) == 1 then
        player:sendCancelMessage("Sorry, not possible while on ride.")
        return true
    end

    if player:getStorageValue(storageFly) == 1 then
        player:sendCancelMessage("Sorry, not possible while on fly.")
        return true
    end

    if player:getStorageValue(storageSurf) > 0 then
        player:sendCancelMessage("Sorry, not possible while on surf.")
        return true
    end

    if player:getStorageValue(storageDive) > 0 then
        player:sendCancelMessage("Sorry, not possible while on dive.")
        return true
    end

    if player:getStorageValue(storageEvent) > 0 then
        player:sendCancelMessage("Sorry, not possible while on event.")
        return true
    end

    if player:getStorageValue(storageBike) > 0 then
        player:removeCondition(CONDITION_OUTFIT)
        player:changeSpeed(player:getBaseSpeed()-player:getSpeed())
        player:setStorageValue(storageBike, -1)
    else
        local delta = player:getSpeed() * bonusSpeed
        if player:getSex() == PLAYERSEX_MALE then outfit = outfitMale else outfit = outfitFemale end
        condition:setOutfit({lookType = outfit})
        player:addCondition(condition)
        player:setStorageValue(storageBike, 1)
        player:changeSpeed(delta)
        effectWhenWalking(player.uid, effect)
    end

    return true
end

 

Link to comment
Share on other sites

  • 0
6 horas atrás, SrNaja disse:
local delay = 0.1
local effect = 12 -- id do effect
local bonusSpeed = 1.2
local outfitMale = 1315
local outfitFemale = 1316
local condition = Condition(CONDITION_OUTFIT)
condition:setTicks(-1)

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if os.time() > player:getStorageValue(storageDelay) then
               player:setStorageValue(storageDelay, os.time() + delay)
    else
        player:sendCancelMessage(RETURNVALUE_YOUAREEXHAUSTED)
        return true
    end

    if fromPosition.x ~= 65535 then
        player:sendCancelMessage("First pick up the bike.")
        return true
    end

    if player:getStorageValue(storageRide) == 1 then
        player:sendCancelMessage("Sorry, not possible while on ride.")
        return true
    end

    if player:getStorageValue(storageFly) == 1 then
        player:sendCancelMessage("Sorry, not possible while on fly.")
        return true
    end

    if player:getStorageValue(storageSurf) > 0 then
        player:sendCancelMessage("Sorry, not possible while on surf.")
        return true
    end

    if player:getStorageValue(storageDive) > 0 then
        player:sendCancelMessage("Sorry, not possible while on dive.")
        return true
    end

    if player:getStorageValue(storageEvent) > 0 then
        player:sendCancelMessage("Sorry, not possible while on event.")
        return true
    end

    if player:getStorageValue(storageBike) > 0 then
        player:removeCondition(CONDITION_OUTFIT)
        player:changeSpeed(player:getBaseSpeed()-player:getSpeed())
        player:setStorageValue(storageBike, -1)
    else
        local delta = player:getSpeed() * bonusSpeed
        if player:getSex() == PLAYERSEX_MALE then outfit = outfitMale else outfit = outfitFemale end
        condition:setOutfit({lookType = outfit})
        player:addCondition(condition)
        player:setStorageValue(storageBike, 1)
        player:changeSpeed(delta)
        effectWhenWalking(player.uid, effect)
    end

    return true
end

 

Lua Script Error: [Action Interface]
data/actions/scripts/poke/bike.lua:onUse
data/lib/core/effectWhenWalking.lua:19: attempt to call method 'sendMagicEffect' (a nil value)
stack traceback:
        [C]: in function 'sendMagicEffect'
        data/lib/core/effectWhenWalking.lua:19: in function 'effectWhenWalking'
        data/actions/scripts/poke/bike.lua:58: in function <data/actions/scripts/poke/bike.lua:9>

Link to comment
Share on other sites

  • 0
13 horas atrás, Dilooow disse:

Lua Script Error: [Action Interface]
data/actions/scripts/poke/bike.lua:onUse
data/lib/core/effectWhenWalking.lua:19: attempt to call method 'sendMagicEffect' (a nil value)
stack traceback:
        [C]: in function 'sendMagicEffect'
        data/lib/core/effectWhenWalking.lua:19: in function 'effectWhenWalking'
        data/actions/scripts/poke/bike.lua:58: in function <data/actions/scripts/poke/bike.lua:9>

troca o código da sua lib :
 

function effectWhenWalking(player_uid, id_effect)
    local player = Player(player_uid)
    if player then
        local player_position = player:getPosition()
        local player_direction = player:getDirection()
        local player_pos_x = player_position.x
        local player_pos_y = player_position.y
        local player_pos_z = player_position.x
        local position = Position(player_pos_x + Config_.back[player_direction].x, player_pos_y + Config_.back[player_direction].y, player_pos_y)
        if position then
            position:sendMagicEffect(id_effect)
            addEvent(effectWhenWalking, 1, player_uid, id_effect)
        end
    end
end

 

Link to comment
Share on other sites

  • 0
23 horas atrás, SrNaja disse:

troca o código da sua lib :
 

function effectWhenWalking(player_uid, id_effect)
    local player = Player(player_uid)
    if player then
        local player_position = player:getPosition()
        local player_direction = player:getDirection()
        local player_pos_x = player_position.x
        local player_pos_y = player_position.y
        local player_pos_z = player_position.x
        local position = Position(player_pos_x + Config_.back[player_direction].x, player_pos_y + Config_.back[player_direction].y, player_pos_y)
        if position then
            position:sendMagicEffect(id_effect)
            addEvent(effectWhenWalking, 1, player_uid, id_effect)
        end
    end
end

 

nada a inda

1.png

Edited by Dilooow
erros
Link to comment
Share on other sites

  • 0
20 horas atrás, Dilooow disse:

nada a inda

1.png

Pelo que você falou em outro tópico, você está usando uma base com TFS 0.3.6, e esse tópico é um pedido para TFS 1.2, por isso não funciona no seu servidor, porque a estrutura do código é diferente.

 

Caso ainda queira um script como esse, crie um tópico para sua dúvida referente a versão correta da sua TFS.

 

O pedido neste tópico de foi atendido e/ou o autor do tópico resolveu sua duvida. Este tópico está fechado e foi movido para Pedidos - Resolvidos. Se você tiver outros pedidos, crie um novo tópico.
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...