• 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+ 1.x player:setGhostMode() -- player can't heal

roriscrave

Advanced OT User
Joined
Dec 7, 2011
Messages
1,188
Solutions
34
Reaction score
200
Hi, i created one spell that player will be invis por X sec (player:getGhostMode(true))
but if player is in ghost mode, he cant heal, how can i change it?
using tfs 1.3, i think is something like here?
creature.cpp:

C++:
bool ConditionDamage::doDamage(Creature* creature, int32_t healthChange)
{
    if (creature->isSuppress(getType())) {
        return true;
    }

    CombatDamage damage;
    damage.origin = ORIGIN_CONDITION;
    damage.primary.value = healthChange;
    damage.primary.type = Combat::ConditionToDamageType(conditionType);

    Creature* attacker = g_game.getCreatureByID(owner);
    if (field && creature->getPlayer() && attacker && attacker->getPlayer()) {
        damage.primary.value = static_cast<int32_t>(std::round(damage.primary.value / 2.));
    }

    if (!creature->isAttackable() || Combat::canDoCombat(attacker, creature) != RETURNVALUE_NOERROR) {
        if (!creature->isInGhostMode()) {
            g_game.addMagicEffect(creature->getPosition(), CONST_ME_POFF);
        }
        return false;
    }

    if (g_game.combatBlockHit(damage, attacker, creature, false, false, field)) {
        return false;
    }
    return g_game.combatChangeHealth(attacker, creature, damage);
}
 
Back
Top