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

C++ summon don't get experience points

silveralol

Advanced OT User
Joined
Mar 16, 2010
Messages
1,480
Solutions
9
Reaction score
211
hello folks, I'm trying make the all summons don't get any experience, all the experience go to the master, I'm looking to the source, but don't get anything, could someone give a direction ?

bump
 
Last edited by a moderator:
Someone would probably give you direction, if you told us what server you are using...
Source is relatively the same across most distributions, what he is looking for hasn't changed since idk when.. I've seen it as far back as 0.3
 
Someone would probably give you direction, if you told us what server you are using...
well, I'm using tfs 1.2
Source is relatively the same across most distributions, what he is looking for hasn't changed since idk when.. I've seen it as far back as 0.3
about the source code of experience points, could be true that it not changed, but anyway, is better let the guys know what version I'm using :rolleyes:
 
Right, so open creature.cpp, locate this method:

C++:
void Creature::onGainExperience(uint64_t gainExp, Creature* target)

and you should find these two lines in this method's body:
C++:
gainExp /= 2;
master->onGainExperience(gainExp, target);

just remove this line:
C++:
gainExp /= 2;

and I think it should be enough. Of course you need to compile the server.
 
Right, so open creature.cpp, locate this method:

C++:
void Creature::onGainExperience(uint64_t gainExp, Creature* target)

and you should find these two lines in this method's body:
C++:
gainExp /= 2;
master->onGainExperience(gainExp, target);

just remove this line:
C++:
gainExp /= 2;

and I think it should be enough. Of course you need to compile the server.
No, don't remove code, always comment it out either an inline comment // or a block comment /* */ and leave a reason you commented it out. The reason for this if you start deleting things from the sources you might delete things which are needed and if you made no backups you will have to replace the file or all of the sources which is a headache in itself.
 
No, don't remove code, always comment it out either an inline comment // or a block comment /* */ and leave a reason you commented it out. The reason for this if you start deleting things from the sources you might delete things which are needed and if you made no backups you will have to replace the file or all of the sources which is a headache in itself.
yes, I always do it to not lose my mind trying find my last edition in the source

Right, so open creature.cpp, locate this method:

C++:
void Creature::onGainExperience(uint64_t gainExp, Creature* target)

and you should find these two lines in this method's body:
C++:
gainExp /= 2;
master->onGainExperience(gainExp, target);

just remove this line:
C++:
gainExp /= 2;

and I think it should be enough. Of course you need to compile the server.
I only can test it right now, then the monster still gain experience, I guess that this experience is gained by hiting the monster, calculated by the damage :eek:
 
Last edited by a moderator:
No, don't remove code, always comment it out either an inline comment // or a block comment /* */ and leave a reason you commented it out. The reason for this if you start deleting things from the sources you might delete things which are needed and if you made no backups you will have to replace the file or all of the sources which is a headache in itself.
You're right about that, bt I will stick to "delete" anyway, because I use CVS for any piece of software I work on and I can't imagine people not using it. So I would suggest using any CVS (git, hg, svn if you must) instead of making your code full of comments.

go to onGainExperience and after this line add

C++:
    if (this->getMonster() || master->getMonster()) {
        return;
    }
and test if it works
haha, I didn't notice this part, so it was working technically, just kept showing like summons were gaining experience : )
 
actually, by deleting (or commenting) that part
Code:
gainExp /= 2;
summon still get exp, but also players get full exp from monster killed, even if the summon killed the monster alone. That gainexp/2 means if you got a summon and hits divide exp by 2.
 
actually, by deleting (or commenting) that part
Code:
gainExp /= 2;
summon still get exp, but also players get full exp from monster killed, even if the summon killed the monster alone. That gainexp/2 means if you got a summon and hits divide exp by 2.

" I'm trying make the all summons don't get any experience, all the experience go to the master,". This is what he wanted - full exp for the master. Summons do not get exp, they don't have exp. It does display in-game that they do receive experience (this is fixed here: C++ - summon don't get experience points).
 
Im not saying your thing is wrong >.<.. im just saying that by deleting that part its working aswell :D
 
I'm having the exact same question but using another engine.
Anybody has a clue?
I've tried doing what @StreamSide told in the post above:

But this is how it looks on the nostalrius engine:

Anyt thoughts or ideas?
 
Back
Top