• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

TFS 1.X+ problem with the magic wall, and upgrade it...

hyz

Member
Joined
Oct 30, 2008
Messages
39
Reaction score
16
I have a problem with my magic wall, after I change the item that is created, it doesn't disappear...
I'm using TFS 1.3

Lua:
--[[SevuEntertainment(c)]]--
local recAnimateText = false
local startSeconds = 20

local combat = Combat()
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, 27)
combat:setParameter(COMBAT_PARAM_CREATEITEM, 2698)

mwCountDownStart = function(position, seconds)
    local spectators = Game.getSpectators(position, false, true, 7, 7, 7, 7)
    if #spectators > 0 then
        if not recAnimateText then
            Creature.say(spectators[1], seconds, TALKTYPE_MONSTER_SAY, false, nil, position)
        else
            Player.sendTextMessage(spectators[1], MESSAGE_EXPERIENCE_OTHERS, nil, position, seconds, TEXTCOLOR_MAYABLUE)
        end
    end
    if seconds > 0 then
        addEvent(mwCountDownStart, 1000, position, seconds -1)
    end
end

function onCastSpell(creature, variant, isHotkey)a
    if combat:execute(creature, variant) then
        mwCountDownStart(Variant.getPosition(variant), startSeconds)
        return true
    end
    return false
end

I would also like to upgrade it, but I don't have enough knowledge, maybe someone can help me with that too.

I wanted that when the magic wall was created, it is also created on the floor above the tile ground ID (460) after the end of the 20 seconds, it will create Ground ID (459) for 1 second and then destroy.

The idea is to enable the player to give exani hur "up and exani hur "down on the magic wall, and then whoever has it on top of the magic wall falls to the floor below (so bugs don't happen) this was a possible solution that I thought about more I don't know what to do, if anyone can help with this I would be grateful.

-
It would be possible to create a destroy field-like rune, to destroy the magic wall (2698) stopping the count and making the players that are on top of it fall to the floor below
 
Last edited:
data/scripts/magic_wall_rune_custom.lua
Lua:
local config = {
    name = "Magic Wall Rune",
    runeId = 2293, -- id of the rune you are going to use
    charges = 3,
    level = 33,
    magicLevel = 7,
    cooldown = 2000,
    groupCooldown = 2000,

    itemId = 2698, -- id of the item that will be created in the destination position
    seconds = 20,
    colour = TEXTCOLOR_MAYABLUE
}

local function startCooldownText(seconds, position, toPos)
    if seconds > 0 then
        local spectators = Game.getSpectators(position, false, true, 7, 7, 7, 7)
        if #spectators > 0 then
            spectators[1]:sendTextMessage(MESSAGE_EXPERIENCE_OTHERS, nil, position, seconds, config.colour)
        end
        addEvent(startCooldownText, 1000, seconds-1, position, toPos)
    else
        local tile = Tile(position)
        if tile then
            local item = tile:getItemById(config.itemId)
            if item then
                item:remove()
            end
        end

        tile = Tile(toPos)
        if tile then
            for i, creature in pairs(tile:getCreatures()) do
                creature:teleportTo(position)
            end
        end
    end
end

local combat = Combat()
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)

local rune = Spell(SPELL_RUNE)

function rune.onCastSpell(player, variant, isHotkey)
    if combat:execute(player, variant) then
        local position = variant:getPosition()
        local tile = Tile(position)
        if tile then
            local toPos = Position(position) - Position(0, 0, 1)
            local toTile = Tile(toPos)
            if not toTile then
                Game.createTile(toPos)
            end

            for i, creature in pairs(tile:getCreatures()) do
                creature:teleportTo(toPos)
            end

            Game.createItem(config.itemId, 1, position)
            startCooldownText(config.seconds, position, toPos)
        end
        return true
    end
    return false
end

rune:level(config.level)
rune:groupCooldown(config.groupCooldown)
rune:isBlocking()
rune:runeId(config.runeId)
rune:charges(config.charges)
rune:allowFarUse(true)
rune:cooldown(config.cooldown)
rune:id(86)
rune:magicLevel(config.magicLevel)
rune:name(config.name)
rune:group("attack")
rune:register()
GIF 28-02-2022 08-32-10 p. m..gif
 
on my TFS it didn't work, but from what I saw in the GIF you made it throws the player up, in case it hits any player.

I would like it to be like the normal Magic Wall, however, I wanted it to work to give exani hur "up to climb on top of the magic wall
 
Lua:
magic wall script \/
local combat = Combat()
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)
combat:setParameter(COMBAT_PARAM_CREATEITEM, ITEM_MAGICWALL)


local time = 20

local function countDown(cid, position, time)
    local player = Player(cid)
    if not player or time == 0 then
        return
    end
    
    player:say(time, TALKTYPE_MONSTER_SAY, false, 0, position)
    addEvent(countDown, 1000, cid, position, time - 1)
end

function onCastSpell(creature, variant, isHotkey)
    countDown(creature.uid, Variant.getPosition(variant), 20)
    return combat:execute(creature, variant)
end
Make sure to file items.xml
Code:
  </item>
  <item id="1497" article="a" name="magic wall">
    <attribute key="type" value="magicfield" />
    <attribute key="decayTo" value="0" />
    <attribute key="duration" value="20" />
  </item>
  <item id="1498" article="a" name="magic wall">
    <attribute key="type" value="magicfield" />
    <attribute key="decayTo" value="0" />
    <attribute key="duration" value="20" />
  </item>
 
Back
Top