• 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+ Shield Skill without shield

GOD Half

Member
Joined
May 9, 2010
Messages
179
Reaction score
15
Can anyone help me make a system that the character increases the shield skill when using armor instead of shield?

SOLVED:
I just added that code (will receive the skill if it takes damage):
C++:
    if (damage > 0) {
        addSkillAdvance(SKILL_SHIELD, 1);
    }

In the part below (player.cpp):
C++:
BlockType_t Player::blockHit(Creature* attacker, CombatType_t combatType, int32_t& damage,
                             bool checkDefense /* = false*/, bool checkArmor /* = false*/, bool field /* = false*/)
{
    BlockType_t blockType = Creature::blockHit(attacker, combatType, damage, checkDefense, checkArmor, field);

    if (attacker) {
        sendCreatureSquare(attacker, SQ_COLOR_BLACK);
    }

    if (blockType != BLOCK_NONE) {
        return blockType;
    }

    if (damage <= 0) {
        damage = 0;
        return BLOCK_ARMOR;
    }

    if (damage > 0) {
        addSkillAdvance(SKILL_SHIELD, 1);
    }

Or change to get skill if take any attack (with damage or no):
C++:
    if (attacker) {
        sendCreatureSquare(attacker, SQ_COLOR_BLACK);
        addSkillAdvance(SKILL_SHIELD, 1); // ADD THIS
    }
 
Last edited:
Back
Top