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

Solved how to hit the whole stacked players with runes? Nostalrius 1.2 - 772

dropz

Member
Joined
May 4, 2022
Messages
46
Reaction score
24
suppp guys!!

i've searched here for this solution but dont found it... im even reup a old thread about it and had some tries to the solution but nothing worked properly


so i thought to create a new one to try solve it and maybe help others in the future whos looking for the same solution...


well as i wrote in the title, i want to players get able to hit whole stack with runes but just for agressive runes if i found a solution that be applicable for the healing runes too for example not is the point cuz will be "wrong" in my view ifs for example people who use a UH in stack heal all the players but for attack runes it must happens to hit all them...

i tried solve this editing some stuffs in .lua/.xml and didnt get success..

i tried too edit few lines of the source code in spells.cpp in the function of CombatSpell::castSpell :
but didnt get succeed too..

so if someone knows how to deal with that, i will be very grateful.

note: im using a nostalrius tfs 1.2 to old protocol 772 (old school xD)

thats the old thread what i reup for some tries:


there u can found few tries for this issue but until now nothing worked properly...


thanks in advance <3



editing the post and explaining whats happened, the problem was solved!!!

first of all i want to thanks @Sarah Wesker!! "you gave me the knife so its was just i slice"

if u are using the tfs 1.2 like im, u dont need add a new one line of code in spells and create another file for the runes, u can do that:

first of all change the needtarget="1" to needtarget="0" in the respective lines of target runes what u want to hit whole stack.
example:

Lua:
<rune name="Sudden Death" id="3155" allowfaruse="1" charges="1" needtarget="0" maglv="15" blocktype="solid" script="runes/sudden death.lua" />

after that you go to the /data/spells/scripts/runes/rune.lua in this case for me sudden death.lua and there you can keep your formulas, just adding in the final the function onCastSpell and the .lua will stay like that:

Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_DEATH)

function onGetFormulaValues(player, level, maglevel)
    local base = 150
    local variation = 20
 
    local formula = 3 * maglevel + (2 * level)
 
    local min = (formula * (base - variation)) / 100
    local max = (formula * (base + variation)) / 100
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(player, variant, isHotkey)
    local tile = Tile(variant:getPosition())
    if tile then
        local topVisibleCreature = tile:getTopVisibleCreature(player)
        if topVisibleCreature then
            if topVisibleCreature:getId() ~= player:getId() and (not topVisibleCreature:isPlayer() or not topVisibleCreature:getGroup():getAccess()) then
                return combat:execute(player, variant)
            end
        end

        local bottomVisibleCreature = tile:getBottomVisibleCreature(player)
        if bottomVisibleCreature then
            if bottomVisibleCreature:getId() ~= player:getId() and (not bottomVisibleCreature:isPlayer() or not bottomVisibleCreature:getGroup():getAccess()) then
                return combat:execute(player, variant)
            end
        end
    end

    player:getPosition():sendMagicEffect(CONST_ME_POFF)
    player:sendCancelMessage(RETURNVALUE_CANONLYUSETHISRUNEONCREATURES)
    return false
end

note: pay attention on the variables, they must be equal the other runes

gif-hitting-whole-stack.gif
 
Last edited:
suppp guys!!

i've searched here for this solution but dont found it... im even reup a old thread about it and had some tries to the solution but nothing worked properly


so i thought to create a new one to try solve it and maybe help others in the future whos looking for the same solution...


well as i wrote in the title, i want to players get able to hit whole stack with runes but just for agressive runes if i found a solution that be applicable for the healing runes too for example not is the point cuz will be "wrong" in my view ifs for example people who use a UH in stack heal all the players but for attack runes it must happens to hit all them...

i tried solve this editing some stuffs in .lua/.xml and didnt get success..

i tried too edit few lines of the source code in spells.cpp in the function of CombatSpell::castSpell :
but didnt get succeed too..

so if someone knows how to deal with that, i will be very grateful.

note: im using a nostalrius tfs 1.2 to old protocol 772 (old school xD)

thats the old thread what i reup for some tries:


there u can found few tries for this issue but until now nothing worked properly...


thanks in advance <3



editing the post and explaining whats happened, the problem was solved!!!

first of all i want to thanks @Sarah Wesker!! "you gave me the knife so its was just i slice"

if u are using the tfs 1.2 like im, u dont need add a new one line of code in spells and create another file for the runes, u can do that:

first of all change the needtarget="1" to needtarget="0" in the respective lines of target runes what u want to hit whole stack.
example:

Lua:
<rune name="Sudden Death" id="3155" allowfaruse="1" charges="1" needtarget="0" maglv="15" blocktype="solid" script="runes/sudden death.lua" />

after that you go to the /data/spells/scripts/runes/rune.lua in this case for me sudden death.lua and there you can keep your formulas, just adding in the final the function onCastSpell and the .lua will stay like that:

Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_DEATH)

function onGetFormulaValues(player, level, maglevel)
    local base = 150
    local variation = 20
 
    local formula = 3 * maglevel + (2 * level)
 
    local min = (formula * (base - variation)) / 100
    local max = (formula * (base + variation)) / 100
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(player, variant, isHotkey)
    local tile = Tile(variant:getPosition())
    if tile then
        local topVisibleCreature = tile:getTopVisibleCreature(player)
        if topVisibleCreature then
            if topVisibleCreature:getId() ~= player:getId() and (not topVisibleCreature:isPlayer() or not topVisibleCreature:getGroup():getAccess()) then
                return combat:execute(player, variant)
            end
        end

        local bottomVisibleCreature = tile:getBottomVisibleCreature(player)
        if bottomVisibleCreature then
            if bottomVisibleCreature:getId() ~= player:getId() and (not bottomVisibleCreature:isPlayer() or not bottomVisibleCreature:getGroup():getAccess()) then
                return combat:execute(player, variant)
            end
        end
    end

    player:getPosition():sendMagicEffect(CONST_ME_POFF)
    player:sendCancelMessage(RETURNVALUE_CANONLYUSETHISRUNEONCREATURES)
    return false
end

note: pay attention on the variables, they must be equal the other runes

View attachment 67615
if you set target to 0 you are not able to hit to the void anymore?
tested. it has a graphical issue it it combines all the damage in a "solo" number value

or is this how it should be? or client side issue?
 
Last edited:
if you set target to 0 you are not able to hit to the void anymore?
tested. it has a graphical issue it it combines all the damage in a "solo" number value

or is this how it should be? or client side issue?

well i think it should be like this..
in other servers where i played and this function get enabled i remember the hitpoints combining all the damage points showing a huge numbers of hit in the stack.
probably is possible change it but im glad for now working like a charm and its cool too u see a huge numbers hitting up xD
 
with this explosion rune get buggy because it says that i must use only in player how do i fix that for this rune? also for gfb fb rune among others?
 
Bump have the same issue with explosion runes and others that shouldn't or are not mostly shooted directly to the players
help
 
Bump have the same issue with explosion runes and others that shouldn't or are not mostly shooted directly to the players
help
you dont need to make modifications in area runes, they already hit the whole stack.

its only to modify sd, hmm and lmm or another rune with one target.

area runes or spell always hit everyone in the area
 
Back
Top