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

Decreasing exhaust?

Hernest

New Member
Joined
Jul 26, 2010
Messages
152
Reaction score
3
Location
poland
Is there any way to decrease exhaust for spells? Only when the storage is equal to 1 or something, so changing in spells.xml isn't a solution. The idea is a rune which is decreasing spells exhaust for some time.
 
i literally told you the solution
what are you needing exhaust in sources for
dont tell me "the code is 1.2" that i posted cause its not hard to downgrade it
 
i literally told you the solution
what are you needing exhaust in sources for
dont tell me "the code is 1.2" that i posted cause its not hard to downgrade it

Those scripts creates a separate exhaust system, not alter the existing one?
I think he wants to create a rune that works by reducing all spell cooldowns by 25% or something. We would need a way to fetch spells.xml cooldown attribute, and temporarily reduce them while the rune effect duration is active.

How would you suggest doing that in LUA?

@Hernest Perhaps look up ConditionSpellCooldown in condition.cpp (Not sure if the name is identical on TFS 0.4)
 
Last edited:
Those scripts creates a separate exhaust system, not alter the existing one?
I think he wants to create a rune that works by reducing all spell cooldowns by 25% or something. We would need a way to fetch spells.xml cooldown attribute, and temporarily reduce them while the rune effect duration is active.

How would you suggest doing that in LUA?

@Hernest Perhaps look up ConditionSpellCooldown in condition.cpp (Not sure if the name is identical on TFS 0.4)
Code:
local exhaust = 10

if player:getStorageValue(xxxxx) == 1 then
    exhaust =  exhaust * 0.75
end

player:setExhaustion(xxxxx, exhaust)
Unless you mean reducing an existing exhaust condition on a player when the rune is used?

I believe both methods should work, I just don't understand why this lua method would not work.

- edit, minor changes in sentence structure.
 
Last edited:
Lua:
local exhaust = 10

if player:getStorageValue(xxxxx) == 1 then
    exhaust =  exhaust * 0.75
end

player:setExhaustion(xxxxx, exhaust)
Unless you mean reducing an existing exhaust condition on a player when the rune is used?

I believe both methods should work, I just don't understand why this lua method would not work.

- edit, minor changes in sentence structure.

Because that cooldown group does not relate or allow you to modify the actual spell cooldowns at all. It is a separate cooldown system.

Etc:
Attack cooldown, (this spell) & group (all attack)

Ultimate Energy Strike: 30 seconds attack single spell cooldown and 4 seconds for all attack spells
So you can only use this spell every 30 seconds, and after you use this spell, you can not use another attack spell such as exori vis until 4 seconds have passed.
XML:
<instant group="attack" spellid="155" name="Ultimate Energy Strike" words="exori max vis" lvl="100" mana="100" prem="1" range="3" casterTargetOrDirection="1" blockwalls="1"
cooldown="30000" groupcooldown="4000"
needlearn="0" script="attack/ultimate_energy_strike.lua">

<vocation name="Sorcerer" />
<vocation name="Master Sorcerer" />

</instant>

Great energy beam: 6 seconds attack single spell cooldown and 2 seconds for all attack spells
XML:
<instant group="attack" spellid="23" name="Great Energy Beam" words="exevo gran vis lux" lvl="29" mana="110" direction="1"
cooldown="6000" groupcooldown="2000"
needlearn="0" script="attack/great_energy_beam.lua">

        <vocation name="Sorcerer" />
        <vocation name="Master Sorcerer" />

</instant>

Bad way (but maybe possible): Manually edit every LUA spell script file, adding 0 seconds exhaust in spells.xml, and configure every cooldown mechanic in the LUA file itself to support -25% cooldown reduction.

Potential better way:
Create a creature/player event listener that listens to some sort of "onCastAnySpell" that sends spells.xml attributes as parameters such as group type, level, mana, cooldown, groupcooldown for the currently casted spell. Allowing you to alter the data before it is processed further.
Lua:
-- This is a mockup function, and does not actually exist.
function onCastAnySpell(cid, spellid, lvl, cooldown, groupcooldown, mana)
 
    if (isPlayer(cid)) then
        local player = Player(cid)
    
        -- If player have 25% reduced cooldown
        if player:getStorageValue(xxxxx) == 1 then
            cooldown =  cooldown * 0.75
            groupcooldown = groupcooldown * 0.75
        end

        -- If player have 25% lower mana cost
        if player:getStorageValue(yyyy) == 1 then
            mana =  mana * 0.75
        end

        -- If player have Witch Hat (10570) and spell id is 9 (Summon Creature / utevo res)
        local item = Item(player:getSlotItem(SLOT_HELMET))
        if (item.getId() == 10570 AND spellid == 9) then
            -- 20% less summon creature spell cost, where the mana cost varies depending on monster
            mana = mana * 0.8
        end

    else
        local creature = Creature(cid)
        -- Do something cool with monster spells?
    end

    return cid, spellid, lvl, cooldown, groupcooldown, mana
end
 
Last edited:
Back
Top