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

Passive monsters tfs 0.3x to x.4 no bugs With no bugs

MartK

Active Member
Joined
Dec 6, 2018
Messages
63
Solutions
1
Reaction score
28
1.- First Step in creature.cpp, Find:
Code:
bool Creature::setAttackedCreature(Creature* creature)

2.- find this fuction and edit for
Code:
 if(attackedCreature)
    {
        onAttackedCreature(attackedCreature);
        attackedCreature->onAttacked();
    }

Code:
 if(attackedCreature)
    {
        onAttackedCreature(attackedCreature);
        attackedCreature->onAttacked();
        attackedCreature->addDamagePoints(this, 0);
    }

3.- find this fuction & and change all for this :

Code:
void Creature::addDamagePoints(Creature* attacker, int32_t damagePoints)

Code:
void Creature::addDamagePoints(Creature* attacker, int32_t damagePoints)
{
    uint32_t attackerId = 0;
    if(attacker)
        attackerId = attacker->isPlayerSummon() ? attacker->getMaster()->getID() : attacker->getID();

    CountMap::iterator it = damageMap.find(attackerId);
    if(it != damageMap.end())
    {
        it->second.ticks = OTSYS_TIME();
        if(damagePoints > 0)
            it->second.total += damagePoints;
    }
    else
        damageMap[attackerId] = CountBlock_t(damagePoints);

    if(damagePoints > 0)
        lastHitCreature = attackerId;
}

4.- Go monster.cpp and find:
Code:
void Monster::onThink(uint32_t interval)

inside the fuction see
Code:
else if(!targetList.empty())
& change for :

Code:
 else if(!targetList.empty())
    {
        if(!followCreature || !hasFollowPath)
            searchTarget();
    }

5.- Find this fuction, remove and change all for this:
bool Monster::selectTarget(Creature* creature)

Code:
bool Monster::selectTarget(Creature* creature)
{
#ifdef __DEBUG__
    std::cout << "Selecting target... " << std::endl;
#endif
    if(!isTarget(creature))
        return false;

    uint32_t targetId = creature->isPlayerSummon() ? creature->getMaster()->getID() : creature->getID();
    if(!isHostile() && !hasBeenAttacked(targetId))
        return false;   

    CreatureList::iterator it = std::find(targetList.begin(), targetList.end(), creature);
    if(it == targetList.end())
    {
        //Target not found in our target list.
#ifdef __DEBUG__
        std::cout << "Target not found in targetList." << std::endl;
#endif
        return false;
    }

    if(setAttackedCreature(creature))
        Dispatcher::getInstance().addTask(createTask(boost::bind(&Game::checkCreatureAttack, &g_game, getID())));

    return setFollowCreature(creature, true);
}

& thats its all :*
 
A silly question, but after doing this changes, do i have to compile my server?
Im asking this because i can never compile the server. I think i downloaded a buged server, dont know
 
A silly question, but after doing this changes, do i have to compile my server?
Im asking this because i can never compile the server. I think i downloaded a buged server, dont know
Any C++ edits require compilation.
 
Back
Top