• 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!

Mwall Bridge Uer Rune

Coldimus

New Member
Joined
Apr 1, 2021
Messages
7
Reaction score
1
Location
Albania
Hey, folks!

I'm relatively interested in how I could make it charge 1 rune upon usage, and if any player(s) is detected in the pos2 interval, it should move the player(s) one step forward/backward, so that the rune can conduct its creation properly.

Server Information:
》TFS Version: 0.4
》Client: 8.60

Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, FALSE)
setCombatParam(combat, COMBAT_PARAM_CREATEITEM, 1497)

local arr = {
    {0, 1, 0},
    {0, 3, 0},
    {0, 1, 0},
}

local area = createCombatArea(arr)
setCombatArea(combat, area)

local t = {
    {{x = 1282, y = 995, z = 7}, {x = 1283, y = 995, z = 7}}
}

function onCastSpell(cid, var)
local pos = getThingPos(cid)
local pos2 = {x = 1286, y = 992, z = 7}
    for i = 1, #t do
        if isInRange(pos, unpack(t[i])) and isCreature(cid) then
        return
        doCombat(cid, combat, positionToVariant(pos2))
        end
    end
end
 
Solution
Thanks for your respond! Unfortunately, it doesn't fulfill all the 3 mwalls when a player is standing on the pos2 interval, but instead fulfill the rest of the positions, what I want to happen is that it shall move the player one step backward and fulfill all 3 mwalls properly.
ezgif.com-gif-maker(1).gif
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, FALSE)
setCombatParam(combat, COMBAT_PARAM_CREATEITEM, 1497)
local arr = {
    {0, 1, 0},
    {0, 3, 0},
    {0, 1, 0}
}
local area = createCombatArea(arr)
setCombatArea(combat, area)
local function pushCreature(position)
    local z = position.z
    local y = position.y
    for x =...
how I could make it charge 1 rune upon usage
a) in config.lua set removeRuneCharges to true

b) if u don't want charges to be removed from all runes, then add
Lua:
local runeId = 2293
local chargesToRemove = 1
before
Lua:
for i = 1, #t do
and then add:
Lua:
doPlayerRemoveItem(cid, runeId, chargesToRemove) -- tries to remove item from player inventory
before
Lua:
return doCombat(cid, combat, positionToVariant(pos2))

But there's a problem now, since (as far as I know..) onCastSpell doesn't know the UID of the rune being used it cannot remove charges from the rune if it's placed outside of player inventory, e.g: on floor.
 
Thanks for your response! However, we have a slight issue now, the rune is no longer functional for usage, here is the error printing in the console:

[11:27:01.967] [Error - LuaInterface::loadFile] data/spells/scripts/support/bridge ue mwall.lua:28: 'end' expected (to close 'if' at line 25) near 'doCombat'
[11:27:01.969] [Warning - Event::loadScript] Cannot load script (data/spells/scripts/support/bridge ue mwall.lua)
[11:27:01.971] data/spells/scripts/support/bridge ue mwall.lua:28: 'end' expected (to close 'if' at line 25) near 'doCombat'
 
Thanks for your response! However, we have a slight issue now, the rune is no longer functional for usage, here is the error printing in the console:

[11:27:01.967] [Error - LuaInterface::loadFile] data/spells/scripts/support/bridge ue mwall.lua:28: 'end' expected (to close 'if' at line 25) near 'doCombat'
[11:27:01.969] [Warning - Event::loadScript] Cannot load script (data/spells/scripts/support/bridge ue mwall.lua)
[11:27:01.971] data/spells/scripts/support/bridge ue mwall.lua:28: 'end' expected (to close 'if' at line 25) near 'doCombat'
Show the script
 
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, FALSE)
setCombatParam(combat, COMBAT_PARAM_CREATEITEM, 1497)

local arr = {
    {0, 1, 0},
    {0, 3, 0},
    {0, 1, 0},
}

local area = createCombatArea(arr)
setCombatArea(combat, area)

local t = {
    {{x = 1282, y = 995, z = 7}, {x = 1283, y = 995, z = 7}}
}

function onCastSpell(cid, var)
local pos = getThingPos(cid)
local pos2 = {x = 1286, y = 992, z = 7}
local runeId = 2309
local chargesToRemove = 1
    for i = 1, #t do
        if isInRange(pos, unpack(t[i])) and isCreature(cid) then
        doPlayerRemoveItem(cid, runeId, chargesToRemove)
        return doCombat(cid, combat, positionToVariant(pos2))
        end
    end
end
 
Tested on 0.4 - 3777,
Works.

Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, FALSE)
setCombatParam(combat, COMBAT_PARAM_CREATEITEM, 1497)
local arr = {
    {0, 1, 0},
    {0, 3, 0},
    {0, 1, 0}
}
local area = createCombatArea(arr)
setCombatArea(combat, area)
local t = {
    {
        {x = 1282, y = 995, z = 7},
        {x = 1283, y = 995, z = 7}
    }
}
function onCastSpell(cid, var)
    local pos = getThingPos(cid)
    local pos2 = {x = 1286, y = 992, z = 7}
    local runeId = 2309
    local chargesToRemove = 1
    for i = 1, #t do
        if isInRange(pos, unpack(t[i])) and isCreature(cid) then
            doPlayerRemoveItem(cid, runeId, chargesToRemove)
            return doCombat(cid, combat, positionToVariant(pos2))
        end
    end
    return true
end
 
Thanks, it operates great!

Do you have any clue how I can make it work with the second part, when it comes to pushing back the player(s) when located on the pos2 interval upon using the mwall bridge uer rune?
 
Last edited:
Thanks, it operates great!

Do you have any clue how I can make it work with the second part, when it comes to pushing back the player(s) when located on the pos2 interval upon using the mwall bridge uer rune?

ezgif.com-gif-maker.gif
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, FALSE)
setCombatParam(combat, COMBAT_PARAM_CREATEITEM, 1497)
local arr = {
    {0, 1, 0},
    {0, 3, 0},
    {0, 1, 0}
}

local area = createCombatArea(arr)
setCombatArea(combat, area)
local t = {
    {
        {x = 1282, y = 995, z = 7},
        {x = 1283, y = 995, z = 7}
    }
}

function onCastSpell(cid, var)
    local pos = getThingPos(cid)
    local pos2 = {x = 1286, y = 992, z = 7}}
    local runeId = 2309
    local chargesToRemove = 1
    for i = 1, #t do
        if isInRange(pos, unpack(t[i])) and isCreature(cid) then
            doPlayerRemoveItem(cid, runeId, chargesToRemove)
            -- push creature
            local topCreature = getTopCreature(pos2)
            if topCreature and topCreature.uid > 0 then
                doMoveCreature(topCreature.uid, 1)
            end
            return doCombat(cid, combat, positionToVariant(pos2))
        end
    end
    return true
end
 
Thanks for your respond! Unfortunately, it doesn't fulfill all the 3 mwalls when a player is standing on the pos2 interval, but instead fulfill the rest of the positions, what I want to happen is that it shall move the player one step backward and fulfill all 3 mwalls properly.
 
Thanks for your respond! Unfortunately, it doesn't fulfill all the 3 mwalls when a player is standing on the pos2 interval, but instead fulfill the rest of the positions, what I want to happen is that it shall move the player one step backward and fulfill all 3 mwalls properly.
ezgif.com-gif-maker(1).gif
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, FALSE)
setCombatParam(combat, COMBAT_PARAM_CREATEITEM, 1497)
local arr = {
    {0, 1, 0},
    {0, 3, 0},
    {0, 1, 0}
}
local area = createCombatArea(arr)
setCombatArea(combat, area)
local function pushCreature(position)
    local z = position.z
    local y = position.y
    for x = position.x - 1, position.x + 1 do
        local pos = {x = x, y = y, z = z}
        local topCreature = getTopCreature(pos)
        if topCreature and topCreature.uid > 0 then
            local dest = {x = position.x + 2, y = position.y, z = position.z}
            doTeleportThing(topCreature.uid, dest, true)
            doSendMagicEffect(dest, CONST_ME_POFF)
        end
    end
end
local t = {
    {
        {x = 1282, y = 995, z = 7},
        {x = 1283, y = 995, z = 7}
    }
}
function onCastSpell(cid, var)
    local pos = getThingPos(cid)
    local pos2 = {x = 1286, y = 992, z = 7}
    local runeId = 2309
    local chargesToRemove = 1
    for i = 1, #t do
        if isInRange(pos, unpack(t[i])) and isCreature(cid) then
            doPlayerRemoveItem(cid, runeId, chargesToRemove)
            -- push creature
            pushCreature(pos2)
            return doCombat(cid, combat, positionToVariant(pos2))
        end
    end
    return true
end
 
Solution
Back
Top