Solved Monsters get experience and kill other monsters. TFS 0,4

Nekiro

best c0der
Support Team
Joined
Sep 7, 2015
Messages
1,811
Reaction score
566
Hello, I want to disable monsters getting experience...
I mean:


They get experience instead of player so player is getting much less exp than he should.

How to fix that or disable?
 
OP
Nekiro

Nekiro

best c0der
Support Team
Joined
Sep 7, 2015
Messages
1,811
Reaction score
566
Oh i forgot. Tfs 0.4
 

tetra20

DD
Joined
Jan 17, 2009
Messages
1,304
Reaction score
285
Location
Egypt
creature.cpp
change
Code:
void Creature::addDamagePoints(Creature* attacker, int32_t damagePoints)
{
   uint32_t attackerId = 0;
   if(attacker)
     attackerId = 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;
}
To
Code:
void Creature::addDamagePoints(Creature* attacker, int32_t damagePoints)
{
   uint32_t attackerId = 0;
   if(attacker)
     attackerId = attacker->getID();
   
   if(attacker->getMonster())
     return;
   
   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;
}
 
OP
Nekiro

Nekiro

best c0der
Support Team
Joined
Sep 7, 2015
Messages
1,811
Reaction score
566
Works. thank you.
 

Activity

Member
Joined
Apr 7, 2016
Messages
182
Reaction score
21
Is it mean monsters will help the player and player will get all experience?
 

Stigma

Veteran OT User
Joined
Feb 14, 2015
Messages
4,556
Reaction score
2,106
Is it mean monsters will help the player and player will get all experience?
This is a bugfix for monsters gaining xp if they hit eachother with something (such as an AoE). So yes in a way if the monster hits another the player will still get all of the experience.
 
Top