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

C++ TFS 1.2 Is it possible to fix the spell emote spam

Tbol

Well-Known Member
Joined
Apr 7, 2019
Messages
530
Reaction score
56
I will try to explain what i mean but basically when you cast a spell orange text appears above your head right? So if you cast it like a lot of time it stacks up and it looks just nasty so i will provide image what i mean
Is it possible to make it so it send only like max 3 not that much as in image
 

Attachments

Solution
I needed this too, it should work for you too, you'll have to adjust the numbers because I have different cooldowns,
first go to enums.h
add CONDITION_EMOTESPELLEXHAUST to the bottom of ConditionType_t table:
Code:
    CONDITION_EXHAUST_COMBAT = 1 << 23, // unused
    CONDITION_EXHAUST_HEAL = 1 << 24, // unused
    CONDITION_PACIFIED = 1 << 25,
    CONDITION_SPELLCOOLDOWN = 1 << 26,
    CONDITION_SPELLGROUPCOOLDOWN = 1 << 27,
    CONDITION_EMOTESPELLEXHAUST = 1 << 28,
add to conditions.cpp:
by case CONDITION_MUTED add case CONDITION_EMOTESPELLEXHAUST:
Code:
        case CONDITION_EXHAUST_COMBAT:
        case CONDITION_EXHAUST_BUFF:
        case CONDITION_EXHAUST_HEAL:
        case CONDITION_MUTED:
        case...
Whats the point of spamming spells if we can do it easier with addevent?
I mean spell cooldown is 1 seconds and you want it to cast spell only 3 times. And I have over 100 spells that have same cooldown so I don't think it's smart
 
game.cpp -> bool Game::playerSaySpell(Player* player, SpeakClasses type, const std::string& text) You can play with some type of temporizador so that the text of said spell has a cooldown, so that you can continue executing your spell but the text that is shown only appears every so often
 
Can be changed in like 10sec
But still you would be able too cast spell only 3 times which is the dumbest solution ever
game.cpp -> bool Game::playerSaySpell(Player* player, SpeakClasses type, const std::string& text) You can play with some type of temporizador so that the text of said spell has a cooldown, so that you can continue executing your spell but the text that is shown only appears every so often
But still it doesnt put a limit of text and if i understand right isnt text would be off, like with delay it would look like its lagging? And wont it hit trough performance?
 
I needed this too, it should work for you too, you'll have to adjust the numbers because I have different cooldowns,
first go to enums.h
add CONDITION_EMOTESPELLEXHAUST to the bottom of ConditionType_t table:
Code:
    CONDITION_EXHAUST_COMBAT = 1 << 23, // unused
    CONDITION_EXHAUST_HEAL = 1 << 24, // unused
    CONDITION_PACIFIED = 1 << 25,
    CONDITION_SPELLCOOLDOWN = 1 << 26,
    CONDITION_SPELLGROUPCOOLDOWN = 1 << 27,
    CONDITION_EMOTESPELLEXHAUST = 1 << 28,
add to conditions.cpp:
by case CONDITION_MUTED add case CONDITION_EMOTESPELLEXHAUST:
Code:
        case CONDITION_EXHAUST_COMBAT:
        case CONDITION_EXHAUST_BUFF:
        case CONDITION_EXHAUST_HEAL:
        case CONDITION_MUTED:
        case CONDITION_EMOTESPELLEXHAUST:
and game.cpp, mine looked like this:
Code:
    if (result == TALKACTION_BREAK) {
        if (!g_config.getBoolean(ConfigManager::EMOTE_SPELLS)) {
            return internalCreatureSay(player, TALKTYPE_SAY, words, false);
        } else {
            return internalCreatureSay(player, TALKTYPE_MONSTER_SAY, words, false);
        }

    } else if (result == TALKACTION_FAILED) {
        return true;
    }
I changed it to this:
Code:
    if (result == TALKACTION_BREAK) {


        if (!player->hasCondition(CONDITION_EMOTESPELLEXHAUST)) {
            Condition* condition = Condition::createCondition(CONDITIONID_DEFAULT, CONDITION_EMOTESPELLEXHAUST, 4000, 0);
            player->addCondition(condition);
            return internalCreatureSay(player, TALKTYPE_MONSTER_SAY, words, false);
        } else {
            if (player->getCondition(CONDITION_EMOTESPELLEXHAUST)->getTicks() >= 4000) {
                return true;
            }
            else {
                player->getCondition(CONDITION_EMOTESPELLEXHAUST)->setTicks(std::min(7000, 2500 + player->getCondition(CONDITION_EMOTESPELLEXHAUST)->getTicks()));
                return internalCreatureSay(player, TALKTYPE_MONSTER_SAY, words, false);
            }
        }

    } else if (result == TALKACTION_FAILED) {
        return true;
    }
I'm not sure about the differences between 1.2 and 1.3
 
Solution
I needed this too, it should work for you too, you'll have to adjust the numbers because I have different cooldowns,
first go to enums.h
add CONDITION_EMOTESPELLEXHAUST to the bottom of ConditionType_t table:
Code:
    CONDITION_EXHAUST_COMBAT = 1 << 23, // unused
    CONDITION_EXHAUST_HEAL = 1 << 24, // unused
    CONDITION_PACIFIED = 1 << 25,
    CONDITION_SPELLCOOLDOWN = 1 << 26,
    CONDITION_SPELLGROUPCOOLDOWN = 1 << 27,
    CONDITION_EMOTESPELLEXHAUST = 1 << 28,
add to conditions.cpp:
by case CONDITION_MUTED add case CONDITION_EMOTESPELLEXHAUST:
Code:
        case CONDITION_EXHAUST_COMBAT:
        case CONDITION_EXHAUST_BUFF:
        case CONDITION_EXHAUST_HEAL:
        case CONDITION_MUTED:
        case CONDITION_EMOTESPELLEXHAUST:
and game.cpp, mine looked like this:
Code:
    if (result == TALKACTION_BREAK) {
        if (!g_config.getBoolean(ConfigManager::EMOTE_SPELLS)) {
            return internalCreatureSay(player, TALKTYPE_SAY, words, false);
        } else {
            return internalCreatureSay(player, TALKTYPE_MONSTER_SAY, words, false);
        }

    } else if (result == TALKACTION_FAILED) {
        return true;
    }
I changed it to this:
Code:
    if (result == TALKACTION_BREAK) {


        if (!player->hasCondition(CONDITION_EMOTESPELLEXHAUST)) {
            Condition* condition = Condition::createCondition(CONDITIONID_DEFAULT, CONDITION_EMOTESPELLEXHAUST, 4000, 0);
            player->addCondition(condition);
            return internalCreatureSay(player, TALKTYPE_MONSTER_SAY, words, false);
        } else {
            if (player->getCondition(CONDITION_EMOTESPELLEXHAUST)->getTicks() >= 4000) {
                return true;
            }
            else {
                player->getCondition(CONDITION_EMOTESPELLEXHAUST)->setTicks(std::min(7000, 2500 + player->getCondition(CONDITION_EMOTESPELLEXHAUST)->getTicks()));
                return internalCreatureSay(player, TALKTYPE_MONSTER_SAY, words, false);
            }
        }

    } else if (result == TALKACTION_FAILED) {
        return true;
    }
I'm not sure about the differences between 1.2 and 1.3
Does it affect performance in any way?
 
Does it affect performance in any way?
This on a deeper level could be said to add extra nanoseconds of delay between when the spell is invoked and when the spell is executed, because now a few extra things are checked and a couple of extra actions are done, but it is absolutely irrelevant to human time, but nothing more, if I'm wrong, someone correct me
 
Back
Top