[Resolvido] Efeito ao andar tfs 1.2

Mixlortt
em Resolvidos

Mixlortt

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 09/05/19Posts: 21

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

SrNaja

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 03/01/22Posts: 36

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)


 

Mixlortt

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 09/05/19Posts: 21
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

SrNaja

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 03/01/22Posts: 36
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

 

Mixlortt

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 09/05/19Posts: 21
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!!!

SrNaja

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 03/01/22Posts: 36
1 hora atrás, Mixlortt disse:

consegui mano, valeu!!!

que bom, fico muito feliz

Dilooow

avatar
Visconde
Visconde

INFOS

Grupo: ViscondeRegistrado: 26/03/18Posts: 255
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 

SrNaja

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 03/01/22Posts: 36
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

Dilooow

avatar
Visconde
Visconde

INFOS

Grupo: ViscondeRegistrado: 26/03/18Posts: 255
4 horas atrás, SrNaja disse:

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

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

SrNaja

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 03/01/22Posts: 36
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

 

Dilooow

avatar
Visconde
Visconde

INFOS

Grupo: ViscondeRegistrado: 26/03/18Posts: 255
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


 

SrNaja

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 03/01/22Posts: 36
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

 

Dilooow

avatar
Visconde
Visconde

INFOS

Grupo: ViscondeRegistrado: 26/03/18Posts: 255
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>

SrNaja

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 03/01/22Posts: 36
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

 

Dilooow

avatar
Visconde
Visconde

INFOS

Grupo: ViscondeRegistrado: 26/03/18Posts: 255
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