MartK
Active Member
- Joined
- Dec 6, 2018
- Messages
- 63
- Solutions
- 1
- Reaction score
- 28
1.- First Step in creature.cpp, Find:
2.- find this fuction and edit for
3.- find this fuction & and change all for this :
4.- Go monster.cpp and find:
inside the fuction see
& change for :
5.- Find this fuction, remove and change all for this:
bool Monster::selectTarget(Creature* creature)
& thats its all :*
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())
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 :*