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

MartK

Member
Joined
Dec 6, 2018
Messages
42
Best answers
1
Reaction score
14
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 :*
 

Matheus Vieira

New Member
Joined
Apr 11, 2015
Messages
21
Best answers
0
Reaction score
0
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
 

Delusion

Divine Intellect
Support Team
Joined
Feb 14, 2015
Messages
4,935
Best answers
451
Reaction score
2,547
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.
 
Top