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

Lua Infinite Rune Problem

Apoccalypse

New Member
Joined
Apr 15, 2017
Messages
114
Solutions
2
Reaction score
4
Hello ,
I use tfs 0.3.6 Client : 8.6
I have the following problem.From some reason two of my runes are infinite but they shouldn't be.
I am talking about magic wall rune and manarune.

Config.lua
Lua:
        removeWeaponAmmunition = true
    removeWeaponCharges = true
    removeRuneCharges = true

Spells.lua
Lua:
 <rune name="Manarune" id="2283" allowfaruse="1" charges="10" lvl="10" maglv="4" exhaustion="1000" aggressive="0" needtarget="1" blocktype="solid" script="New/Manarune.lua"/>

<rune name="Magic Wall" id="2293" allowfaruse="1" charges="3" lvl="32" maglv="9" exhaustion="1000" blocktype="all" event="script" value="support/magic wall rune.lua"/>

I tried to set charges to 1 but the problem is still the same. The strange thing is that other runes runs out correctly. Do any one know what can be a problem or how to force them to run out?
 
Solution
I have to tell honestly that I compared it like a thousand times and I didn't find any diffrences.
I just found alternative solution. I added to the code the line:
Lua:
doPlayerRemoveItem(cid, MyRuneId, 1)
and it works but I have a question:
Does it can be aboused in same way?
Place it right before "return doCombat" and you should be good.
Show me the xml of a rune that work, like ultimate healing rune.

Also show me the items.xml of UH rune, maanrune, mwall rune.
And show me the lua script of the runes.

That way we can compare something that works with something that doesn't.
 
So, here is comperison sudden death rune which works with magic wall rune which doesn't work:

Spells.xml
Lua:
<rune name="Paralyze" id="2278" allowfaruse="1" charges="1" lvl="54" maglv="18" exhaustion="2000" mana="1400" needtarget="1" blocktype="solid" event="script" value="support/paralyze.lua">
        <vocation id="2"/>
        <vocation id="6" showInDescription="0"/>
    </rune>

<rune name="Magic Wall" id="2293" allowfaruse="1" charges="3" lvl="32" maglv="9" exhaustion="1000" blocktype="all" event="script" value="support/magic wall rune.lua"/>

Scripts:

Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)

function onCastSpell(cid, var)
    local pos = variantToPosition(var)

    if isInRange(pos, {x=1041, y=985, z=9}, {x=1058, y=993, z=9}) or
        isInRange(pos, {x=1078, y=1230, z=15}, {x=1127, y=1262, z=15}) then
        return not doPlayerSendCancel(cid, 'You can\'t use this rune here.')
    end

    local a, b = getTileInfo(getThingPos(cid)), getTileInfo(pos)
    if a.protection or b.protection then
        return not doPlayerSendDefaultCancel(cid, RETURNVALUE_ACTIONNOTPERMITTEDINPROTECTIONZONE)
    elseif a.pvp or b.pvp then
        return not doPlayerSendCancel(cid, 'You can\'t use this rune here.')
    end

    local v = getTileItemByType(pos, ITEM_TYPE_MAGICFIELD).uid
    if v ~= 0 then
        doRemoveItem(v)
    end

    local count = getTileInfo(pos).items

    if count >= 8 then
        local removed
        for i = 1, count do
            pos.stackpos  = i
            local v = getThingfromPos(pos)
            if v.uid > 65535 and v.actionid == 0 and isMoveable(v.uid) and not isCreature(v.uid) then
                doRemoveItem(v.uid)
                removed = true
                break
            end
        end
        if not removed then
            return not doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTENOUGHROOM)
        end
    end
    print(count)

    v = doCreateItemEx(1497)
    if doTileAddItemEx(pos, v) == 1 and getTileItemByType(pos, ITEM_TYPE_MAGICFIELD).uid ~= 0 then
        doDecayItem(v)
        return doCombat(cid, combat, var)
    else
        return not doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTENOUGHROOM)
    end
end

Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -1, -60, -1, -60, 3, 3, 8, 10)

local conbat = createCombatObject()
setCombatParam(conbat, COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
setCombatParam(conbat, COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
setCombatParam(conbat, COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
setCombatParam(conbat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH)
setCombatFormula(conbat, COMBAT_FORMULA_LEVELMAGIC, -1, -60, -1, -60, 6, 6, 10, 11)

function onCastSpell(cid, var)
    if getPlayerSlotItem(cid, CONST_SLOT_AMMO).itemid == 12566 then
        return doCombat(cid, conbat, var)
    else
        return doCombat(cid, combat, var)
    end
end

Items.xml
Lua:
    <item id="2293" article="a" name="magic wall rune">
        <attribute key="runeSpellName" value="adevo grav tera"/>
        <attribute key="weight" value="120"/>
    </item>

<item id="2268" article="a" name="sudden death rune">
        <attribute key="runeSpellName" value="adori gran mort"/>
        <attribute key="weight" value="120"/>
    </item>
 
Last edited:
I have to tell honestly that I compared it like a thousand times and I didn't find any diffrences.
I just found alternative solution. I added to the code the line:
Lua:
doPlayerRemoveItem(cid, MyRuneId, 1)
and it works but I have a question:
Does it can be aboused in same way?
 
I have to tell honestly that I compared it like a thousand times and I didn't find any diffrences.
I just found alternative solution. I added to the code the line:
Lua:
doPlayerRemoveItem(cid, MyRuneId, 1)
and it works but I have a question:
Does it can be aboused in same way?
Place it right before "return doCombat" and you should be good.
 
Solution
It turned out that I was using magic wall rune script from the action.xml and that was a problem with this one....
Although Manarune still remains a riddle for me but since it works with it I will just let it be as it is.
Thanks Znote for help.
 
Back
Top