Reparar este script

El Bu

Member
Messages
42
Points
151
TFS 02 VERSION TIBIA 9.6 Que tal alguien me podria apoyar reparando este script de un helmeth que crea dos efectos alrededor del player uno dentro de pz y otro fuera de pz alrededor del player y hace un poco de daño al que le pegue, al caminar el player el efecto sigue saliendo alrededor de el ABAJO COLOCO EL ERROR QUE ME SALE EN CONSOLA:
JavaScript:
local Config = {
    PZ = { -- Efectos en Zona protegida
        CONST_ANI_ENERGY, -- Efecto mágico a distancia
        CONST_ME_PURPLEENERGY, -- Efecto mágico normal
    },
    PVP = { -- Efectos en Zona NO protegida
        CONST_ANI_FIRE, -- Efecto mágico a distancia
        CONST_ME_FIREAREA, -- Efecto mágico normal
    },
    Outfit = {336, 335}, -- Traje femenino, Traje masculino
    Combat = COMBAT_FIREDAMAGE, -- Tipo de daño elemental
    Time = 150, -- Milisegundos que tardará en aparecer cada golpe
    Direction = {NORTH, NORTHEAST, EAST, SOUTHEAST, SOUTH, SOUTHWEST, WEST, NORTHWEST}, -- Direciones a las que irá cada golpe. (Puedes cambiar el orden)
}
local function canEffect(pos, proj) -- Night Wolf based on Nord
    if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then
        return false
    end
    local n = not proj and 3 or 2
    for i = 1, 255 do
        pos.stackpos = i
        local tile = getTileThingByPos(pos)
        if tile.itemid ~= 0 and not isCreature(tile.uid) then
            if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
                return false
            end
        end
    end
    return true
end
local function loop(delay, cid, times, burst, item, slot)
    local Belero, fonte = {}, {}
    if times <= table.maxn(Config.Direction) then
        if isPlayer(cid) and getPlayerSlotItem(cid, slot).itemid == item.itemid then
            local Formula = {
                min = (getPlayerLevel(cid) * 1 + getPlayerMagLevel(cid) * 1) * 0.5,
                max = (getPlayerLevel(cid) * 1 + getPlayerMagLevel(cid) * 1) * 2,
            }
            local toPosition = getPositionByDirection(getThingPos(cid), Config.Direction[times], 1)
            if canEffect(toPosition, true) then
                if getTileInfo(toPosition).protection or getTileInfo(getThingPos(cid)).protection then
                    Belero, fonte = Config.PZ[1], Config.PZ[2]
                else
                    Belero, fonte = Config.PVP[1], Config.PVP[2]
                    doAreaCombatHealth(cid, Config.Combat, toPosition, 0, - Formula.min, - Formula.max, CONST_ME_NONE)
                end
                doSendDistanceShoot(getThingPos(cid), toPosition, Belero)
                doSendMagicEffect(toPosition, fonte)
            end
        else
            return true
        end
        times, burst = times + 1, burst + 100
        addEvent(loop, delay, delay, cid, times, burst, item, slot)
    else
        loop(delay, cid, 1, burst, item, slot)
    end
    return true
end
function onEquip(cid, item, slot)
    local outfit = getCreatureOutfit(cid)
    outfit.lookType = getPlayerSex(cid) > 0 and Config.Outfit[2] or Config.Outfit[1]
    doSetCreatureOutfit(cid, outfit, -1)
    loop(Config.Time, cid, 1, 0, item, slot)
    return true
end
function onDeEquip(cid, item, slot)
    doRemoveCondition(cid, CONDITION_OUTFIT)
    return true
end


1740333032735.png
Muchas Gracias. TFS 02 VERSION TIBIA 9.6
 
Solution
TFS 02 VERSION TIBIA 9.6 Que tal alguien me podria apoyar reparando este script de un helmeth que crea dos efectos alrededor del player uno dentro de pz y otro fuera de pz alrededor del player y hace un poco de daño al que le pegue, al caminar el player el efecto sigue saliendo alrededor de el ABAJO COLOCO EL ERROR QUE ME SALE EN CONSOLA:
JavaScript:
local Config = {
    PZ = { -- Efectos en Zona protegida
        CONST_ANI_ENERGY, -- Efecto mágico a distancia
        CONST_ME_PURPLEENERGY, -- Efecto mágico normal
    },
    PVP = { -- Efectos en Zona NO protegida
        CONST_ANI_FIRE, -- Efecto mágico a distancia
        CONST_ME_FIREAREA, -- Efecto mágico normal
    },
    Outfit = {336, 335}, -- Traje femenino, Traje masculino...
TFS 02 VERSION TIBIA 9.6 Que tal alguien me podria apoyar reparando este script de un helmeth que crea dos efectos alrededor del player uno dentro de pz y otro fuera de pz alrededor del player y hace un poco de daño al que le pegue, al caminar el player el efecto sigue saliendo alrededor de el ABAJO COLOCO EL ERROR QUE ME SALE EN CONSOLA:
JavaScript:
local Config = {
    PZ = { -- Efectos en Zona protegida
        CONST_ANI_ENERGY, -- Efecto mágico a distancia
        CONST_ME_PURPLEENERGY, -- Efecto mágico normal
    },
    PVP = { -- Efectos en Zona NO protegida
        CONST_ANI_FIRE, -- Efecto mágico a distancia
        CONST_ME_FIREAREA, -- Efecto mágico normal
    },
    Outfit = {336, 335}, -- Traje femenino, Traje masculino
    Combat = COMBAT_FIREDAMAGE, -- Tipo de daño elemental
    Time = 150, -- Milisegundos que tardará en aparecer cada golpe
    Direction = {NORTH, NORTHEAST, EAST, SOUTHEAST, SOUTH, SOUTHWEST, WEST, NORTHWEST}, -- Direciones a las que irá cada golpe. (Puedes cambiar el orden)
}
local function canEffect(pos, proj) -- Night Wolf based on Nord
    if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then
        return false
    end
    local n = not proj and 3 or 2
    for i = 1, 255 do
        pos.stackpos = i
        local tile = getTileThingByPos(pos)
        if tile.itemid ~= 0 and not isCreature(tile.uid) then
            if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
                return false
            end
        end
    end
    return true
end
local function loop(delay, cid, times, burst, item, slot)
    local Belero, fonte = {}, {}
    if times <= table.maxn(Config.Direction) then
        if isPlayer(cid) and getPlayerSlotItem(cid, slot).itemid == item.itemid then
            local Formula = {
                min = (getPlayerLevel(cid) * 1 + getPlayerMagLevel(cid) * 1) * 0.5,
                max = (getPlayerLevel(cid) * 1 + getPlayerMagLevel(cid) * 1) * 2,
            }
            local toPosition = getPositionByDirection(getThingPos(cid), Config.Direction[times], 1)
            if canEffect(toPosition, true) then
                if getTileInfo(toPosition).protection or getTileInfo(getThingPos(cid)).protection then
                    Belero, fonte = Config.PZ[1], Config.PZ[2]
                else
                    Belero, fonte = Config.PVP[1], Config.PVP[2]
                    doAreaCombatHealth(cid, Config.Combat, toPosition, 0, - Formula.min, - Formula.max, CONST_ME_NONE)
                end
                doSendDistanceShoot(getThingPos(cid), toPosition, Belero)
                doSendMagicEffect(toPosition, fonte)
            end
        else
            return true
        end
        times, burst = times + 1, burst + 100
        addEvent(loop, delay, delay, cid, times, burst, item, slot)
    else
        loop(delay, cid, 1, burst, item, slot)
    end
    return true
end
function onEquip(cid, item, slot)
    local outfit = getCreatureOutfit(cid)
    outfit.lookType = getPlayerSex(cid) > 0 and Config.Outfit[2] or Config.Outfit[1]
    doSetCreatureOutfit(cid, outfit, -1)
    loop(Config.Time, cid, 1, 0, item, slot)
    return true
end
function onDeEquip(cid, item, slot)
    doRemoveCondition(cid, CONDITION_OUTFIT)
    return true
end


View attachment 5278
Muchas Gracias. TFS 02 VERSION TIBIA 9.6

Abre tu servidor en visual studio code,
primero busca haber si tienes getPosByDir, si no la tienes abre el global.lua ( si tienes uno ) si no tienes pegalo en tu script mismo, al principio del todo.
En caso que tengas getPosByDir, entonces cambia en tu script el nombre de getPositionByDirection por getPosByDir.
Sino, utiliza este codigo:
JavaScript:
function getPositionByDirection(pos, dir, distance)
    local newPos = {x = pos.x, y = pos.y, z = pos.z}
    if dir == NORTH then
        newPos.y = newPos.y - distance
    elseif dir == NORTHEAST then
        newPos.x = newPos.x + distance
        newPos.y = newPos.y - distance
    elseif dir == EAST then
        newPos.x = newPos.x + distance
    elseif dir == SOUTHEAST then
        newPos.x = newPos.x + distance
        newPos.y = newPos.y + distance
    elseif dir == SOUTH then
        newPos.y = newPos.y + distance
    elseif dir == SOUTHWEST then
        newPos.x = newPos.x - distance
        newPos.y = newPos.y + distance
    elseif dir == WEST then
        newPos.x = newPos.x - distance
    elseif dir == NORTHWEST then
        newPos.x = newPos.x - distance
        newPos.y = newPos.y - distance
    end
    return newPos
end
 
Solution
Abre tu servidor en visual studio code,
primero busca haber si tienes getPosByDir, si no la tienes abre el global.lua ( si tienes uno ) si no tienes pegalo en tu script mismo, al principio del todo.
En caso que tengas getPosByDir, entonces cambia en tu script el nombre de getPositionByDirection por getPosByDir.
Sino, utiliza este codigo:
JavaScript:
function getPositionByDirection(pos, dir, distance)
    local newPos = {x = pos.x, y = pos.y, z = pos.z}
    if dir == NORTH then
        newPos.y = newPos.y - distance
    elseif dir == NORTHEAST then
        newPos.x = newPos.x + distance
        newPos.y = newPos.y - distance
    elseif dir == EAST then
        newPos.x = newPos.x + distance
    elseif dir == SOUTHEAST then
        newPos.x = newPos.x + distance
        newPos.y = newPos.y + distance
    elseif dir == SOUTH then
        newPos.y = newPos.y + distance
    elseif dir == SOUTHWEST then
        newPos.x = newPos.x - distance
        newPos.y = newPos.y + distance
    elseif dir == WEST then
        newPos.x = newPos.x - distance
    elseif dir == NORTHWEST then
        newPos.x = newPos.x - distance
        newPos.y = newPos.y - distance
    end
    return newPos
end
Listo muchas gracias!! eres el mejor brother
 

Tibia Server Lists

#1 FEATURED US Ultron OT 1,496 / 5,000 EXPStages PROTO8.6 ENGINEUltron OT RANK PTS6.6 -9% VOTES0 #2 FEATURED US Nefera 183 / 0 EXPx1 PROTO15.20 ENGINECrystal Server RANK PTS5.9 +25% VOTES0 #3 FEATURED CL ZHYRAVEX 12 / 500 EXPx5 PROTO10.98 ENGINETFS 1.4.2 RANK PTS4.7 +100% VOTES0 #4 FEATURED ES Deixis 0 / 0 EXPStages PROTO1098 ENGINETFS RANK PTS4.0 -61% VOTES1 #5 DE DBU Online 212 / 400 EXP11 PROTO8.6 ENGINETFS 1.0 RANK PTS6.1 +1,000% VOTES0 #6 BR Exordion Legacy 77 / 2,000 EXPx2 PROTO7.72 ENGINEExordion RANK PTS5.7 +2% VOTES0 #7 MX Marlboro War 31 / 300 EXP999 PROTO8.6 ENGINETFS 0.3.7 RANK PTS5.5 -28% VOTES0 #8 BR Tibinha YurOts 30 / 150 EXPStages PROTO7.4 ENGINEYurOTS 1.5 RANK PTS5.5 +3% VOTES0 #9 ES JustRL FreeTC 1530 26 / 250 EXPx2 PROTO15.30 ENGINECrystal Server RANK PTS5.0 +19% VOTES0 #10 US Wiki Ots 52 / 1,000 EXPx9999 PROTOcustom client ENGINETFS 1.4.2 RANK PTS5.0 +100% VOTES0 #11 PL Lubelski 12 / 1,000 EXP200 PROTO7.6 ENGINELubelskiOTS 2.56.0 RANK PTS4.9 -17% VOTES0 #12 BR Turion Server 0 / 2,000 EXPx1 PROTO7.4 ENGINETurion 7.7 Project RANK PTS4.7 +267% VOTES0 #13 PL ReWar 0 / 2,000 EXPcustom PROTO8.6 ENGINEOther RANK PTS4.6 +100% VOTES0 #14 US Halera 0 / 0 EXPStages PROTO10.98 ENGINETFS 1.4.2 RANK PTS4.4 -80% VOTES0 #15 PL Velesta 0 / 1,000 EXP20 PROTO8.0 ENGINETFS 1.4.2 RANK PTS4.4 -100% VOTES0 #16 US BerethaOnline 0 / 2,000 EXPStages PROTO15.0 ENGINETFS RANK PTS4.3 -76% VOTES0 #17 ES Farlia Global 2026 0 / 333 EXPx5 PROTO15.25 ENGINEFarliaServ 1.525 RANK PTS4.0 -100% VOTES0 #18 SE MortalisOT Custom 0 / 500 EXP100x -1.2x PROTO10.98 ENGINEMortalisOT V1 RANK PTS4.0 -100% VOTES0 #19 RU Oldavia | 8.60 0 / 0 EXPx9999 PROTO8.6 ENGINETFS 1.3 RANK PTS3.9 +100% VOTES0 #20 US Rommania 0 / 3,000 EXPstages, x10 PROTO7.4 ENGINETFS 0.4 RANK PTS3.6 -89% VOTES0 #21 MX Maeli 2 / 150 EXPx10 PROTO10.98 ENGINETFS 1.4.2 RANK PTS3.5 -33% VOTES0 #22 ES DarkDragon EXPx10 PROTO8.6 ENGINECanary RANK PTS0.0 0% VOTES0
Top