• 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+ spells.cpp bug with exhaust or cooldown 0 triggers PlayerFlag_HasNoExhaustion

Tbol

Well-Known Member
Joined
Apr 7, 2019
Messages
592
Reaction score
64
Hello, so i noticed a issue with spells.xml im using cooldown="0" or exhaustion="0" the reason i set it to 0 so the spell wont have exhaust and i could execute the spell instantly, but the problem seems like it ignores the set value 0 and it sets to default 1 second i assume the problem is here
C++:
    if (!player->hasFlag(PlayerFlag_HasNoExhaustion)) {
        if (player->hasCondition(CONDITION_SPELLGROUPCOOLDOWN, group) || player->hasCondition(CONDITION_SPELLCOOLDOWN, spellId)) {           
            player->sendCancelMessage(RETURNVALUE_YOUAREEXHAUSTED);

            if (isInstant()) {
                //g_game.addMagicEffect(player->getPosition(), CONST_ME_POFF);
            }

            return false;
        }
    }
C++:
void Spell::postCastSpell(Player* player, bool finishedCast /*= true*/, bool payCost /*= true*/) const
{
    if (finishedCast) {
        if (!player->hasFlag(PlayerFlag_HasNoExhaustion)) {
            if (cooldown > 0) {
                Condition* condition = Condition::createCondition(CONDITIONID_DEFAULT, CONDITION_SPELLCOOLDOWN, cooldown, 0, false, spellId);
                player->addCondition(condition);
            }

            if (groupCooldown > 0) {
                Condition* condition = Condition::createCondition(CONDITIONID_DEFAULT, CONDITION_SPELLGROUPCOOLDOWN, groupCooldown, 0, false, group);
                player->addCondition(condition);
            }

            if (!player->hasFlag(PlayerFlag_NotGainInFight)) {
                if (aggressive) {
                    player->addInFightTicks();
                }
            }
        }
    }

    if (payCost) {
        Spell::postCastSpell(player, getManaCost(player), getSoulCost());
    }
}
 
just remove the flag completely? from the spell
That was the first stuff i tried, it still gives the cooldown for 1 second thats why im confused my two options src is fucked or this inside spell itself fucks something up
LUA:
            if spellId == 3 then
                exhaustStorage[playerId] = (os.time() + (config.pushExhaust - 1)) -- We already add 1 second as a fail-safe before the addEvent
                cooldownCondition:setParameter(CONDITION_PARAM_TICKS, config.pushExhaust * 1000)
            else
                exhaustStorage[playerId] = (os.time() + (config.exhaustTime - 1))
                cooldownCondition:setParameter(CONDITION_PARAM_TICKS, config.exhaustTime * 1000)
            end
            player:addCondition(cooldownCondition)

            local target = player:getTarget()
            if not target then
                return
            end
LUA:
    if exhaustStorage[playerId] then
        if exhaustStorage[playerId] - os.time() > 0 then
            player:sendCancelMessage("You are exhausted.")
            player:getPosition():sendMagicEffect(CONST_ME_POFF)
            return false
        end
    end
 
turn the spell into talkaction instead.
then just inside the talkaction remove ! before and write the command for spell right
and add manaspent according to its cost etc
basically run the spell inside talkaction by creating combat etc and cast it
 
turn the spell into talkaction instead.
then just inside the talkaction remove ! before and write the command for spell right
and add manaspent according to its cost etc
basically run the spell inside talkaction by creating combat etc and cast it
A hell no :D is this a 2007? :D
 
what is your problem exactly? I gave you the solution.
how do you think spells are executed they are all essentialy talkactions? you want it to work the way you desire it its that easy.
You understand that there might be other issues like if i pick your solution it will not be compatible with my action bar, or other systems i have so far that requires it to be in spells and not TALKACTION.
 
You understand that there might be other issues like if i pick your solution it will not be compatible with my action bar, or other systems i have so far that requires it to be in spells and not TALKACTION.
ah u need the pretty image from 8.0 on your action bar instead of text? oh no if only you could write piece of code that will replace that text with graphics!
 
the defualt cooldown and groupcooldown is 1000
if you are only setting the cooldown then probably the groupcooldown of group (if you arent specifying the group then the default group is SPELLGROUP_NONE) is still default value of 1s
just try groupcooldown="0" as well
 
the defualt cooldown and groupcooldown is 1000
if you are only setting the cooldown then probably the groupcooldown of group (if you arent specifying the group then the default group is SPELLGROUP_NONE) is still default value of 1s
just try groupcooldown="0" as well
perfect
 
Back
Top