• 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+ How to make monster deal damage to monster in tfs 1.5 nekiro

mano368

Senior Support Team Member
Staff member
Support Team
Joined
Sep 2, 2011
Messages
647
Solutions
46
Reaction score
296
Location
Brazil
Hello,

As in title, how to make monster deal damage to monster with spells.
Ex.: dragon do damage to minotaur while flam hur a player

Plus.: how to make player pzlock when attack pk back(pk attack first)

Thanks
 
Solution
monster damage others
combat.cpp

remove
C++:
} else if (attacker->getMonster()) {
            const Creature* targetMaster = target->getMaster();
            if (!targetMaster || !targetMaster->getPlayer()) {
                const Creature* attackerMaster = attacker->getMaster();
                if (!attackerMaster || !attackerMaster->getPlayer()) {
                    return RETURNVALUE_YOUMAYNOTATTACKTHISCREATURE;
                }
            }
fightback pz
player.cpp
C++:
} else if (!targetPlayer->hasAttacked(this)) {
            if (!pzLocked) {
to
C++:
} else if (!targetPlayer->hasAttacked(this) || g_config.getBoolean(ConfigManager::FIGHTBACK_PZ)) {
            if (!pzLocked && g_game.getWorldType() !=...
monster damage others
combat.cpp

remove
C++:
} else if (attacker->getMonster()) {
            const Creature* targetMaster = target->getMaster();
            if (!targetMaster || !targetMaster->getPlayer()) {
                const Creature* attackerMaster = attacker->getMaster();
                if (!attackerMaster || !attackerMaster->getPlayer()) {
                    return RETURNVALUE_YOUMAYNOTATTACKTHISCREATURE;
                }
            }
fightback pz
player.cpp
C++:
} else if (!targetPlayer->hasAttacked(this)) {
            if (!pzLocked) {
to
C++:
} else if (!targetPlayer->hasAttacked(this) || g_config.getBoolean(ConfigManager::FIGHTBACK_PZ)) {
            if (!pzLocked && g_game.getWorldType() != WORLD_TYPE_PVP_ENFORCED) {
also add
configmanager.h
C++:
FIGHTBACK_PZ
configmanager.cpp
C++:
boolean[FIGHTBACK_PZ] = getGlobalBoolean(L, "fightbackPz", false);
config.lua
Lua:
fightbackPz = true
 
Solution
@emil92b
thank you bro, worked!

made some changes to work with config.lua in monster damage too, thank you again!
Post automatically merged:

when testing, I noticed that the player who attacks back gets a yellow skull, which would justify his death to whoever was killing him, so I modified(copy from nostalrius) the whole part and when testing, it now seems to work correctly, just like before.

C:
void Player::onAttackedCreature(Creature* target, bool addFightTicks /* = true */)
{
    Creature::onAttackedCreature(target);

    if (target->getZone() == ZONE_PVP) {
        return;
    }

    if (target == this) {
        if (addFightTicks) {
            addInFightTicks();
        }
        return;
    }

    if (hasFlag(PlayerFlag_NotGainInFight)) {
        return;
    }

    Player* targetPlayer = target->getPlayer();
    if (targetPlayer) { /* old > (targetPlayer && !isPartner(targetPlayer) && !isGuildMate(targetPlayer))*/
        if (!pzLocked && g_game.getWorldType() != WORLD_TYPE_PVP_ENFORCED) {
            pzLocked = true;
            sendIcons();
        }

        targetPlayer->addInFightTicks();
      
        if (!isPartner(targetPlayer)) {
            if (getSkull() == SKULL_NONE && getSkullClient(targetPlayer) == SKULL_YELLOW) {
                addAttacked(targetPlayer);
                targetPlayer->sendCreatureSkull(this);
      
            } else {
                if (!targetPlayer->hasAttacked(this)) {
                    if (!Combat::isInPvpZone(this, targetPlayer) && !isInWar(targetPlayer)) {
                        addAttacked(targetPlayer);
                        if (targetPlayer->getSkull() == SKULL_NONE && getSkull() == SKULL_NONE) {
                            setSkull(SKULL_WHITE);
                        }
                    }
                  
                    if (getSkull() == SKULL_NONE) {
                        targetPlayer->sendCreatureSkull(this);
                    }
                }
            }
        }
    }      

    if (addFightTicks) {
        addInFightTicks();
    }
}
 
Last edited:
Back
Top