elkingahmed
New Member
- Joined
- May 31, 2012
- Messages
- 116
- Reaction score
- 2
my ots stage rate is 120,000 when i kill a monster with exp (40,000,000,000) i get very low exp anyone know why ? are there any maximum of the Exp received ?
He wants the files so he can find a solution.what exactly file you want from the source ?
here you aremonsters.cpp and monsters.h
make sure it's monsters and not monster
upload to pastebin.com
so what should i change to ?int experience means max positive value is 2,147,483,647
so what should i change to ?
if(readXMLInteger(root, "experience", intValue)){
mType->experience = intValue;
}
uint64_t ullValue = 0;
if(readXMLInteger64(root, "experience", ullValue)) {
mType->experience = ullValue;
}
tried and nothing changedthe value from experience="xxxx" in your monster xml file is being read into an integer (maximum value is 2,147,483,647, you have 40,000,000,000)
because of that, your value will wrap around back to -2,147,483,648 multiple times and keep counting from there until it counts out 40,000,000,000
by the end the final value will be 1,345,294,336
your final experience value after stages * that value will be 161,435,320,320,000 which is significantly less than what you would expect (4,800,000,000,000,000), note that this doesn't overflow because the value type the calculation is stored in is uint64_t which holds up to about 18 quintillion
what you need to do is find this in monsters.cpp
and replace it with thisC++:if(readXMLInteger(root, "experience", intValue)){ mType->experience = intValue; }
C++:uint64_t ullValue = 0; if(readXMLInteger64(root, "experience", ullValue)) { mType->experience = ullValue; }
you recompiled and replaced the exe?tried and nothing changed
std::cout << mType->name << " experience: " << ullValue << '\n';
mType->experience = ullValue;
workedyou recompiled and replaced the exe?
if it doesn't change then debug it yourself by using print to check if the values are correct
for example add
aboveC++:std::cout << mType->name << " experience: " << ullValue << '\n';
if it's correct, look in player.cpp at Player::addExperience and check print out that valueC++:mType->experience = ullValue;
static uint64_t getExpForLevel(int32_t level)
{
return (uint64_t)std::ceil((double)(50 * level * level * level)/3 - (100 * level * level) + ((850 * level) / 3) - 200);
}
well thankscreate a new thread for that, although i specifically can't help with that
i remember i also tried to use that formula and never had success
if you're using visual studio you can debug the exe with that once it gives you the option on the window where it says "theforgottenserver.exe has stopped working"well thanks
i've faced another big from the monsters :/
once i kill 2 monsters the tfs crash