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

TFS 0.X Explain this please? extra sharing exp

KingKing

Member
Joined
Nov 6, 2019
Messages
33
Reaction score
6
Hello,

can some one explain this part from my config.lua?

Lua:
    experienceShareRadiusX = 30
    experienceShareRadiusY = 30
    experienceShareRadiusZ = 1
    experienceShareLevelDifference = 2 / 3
    extraPartyExperienceLimit = 100
    extraPartyExperiencePercent = 25
    experienceShareActivity = 2 * 60 * 1000

I want everyone enter the party team get 25% extra exp with 100% max bonus.

any help?
TFS 0.3.7 downgraded for 8.60
 
Solution
Those three are wrongly defined:
Code:
experienceShareLevelDifference = 2 / 3 -- Probably like 2 levels lower and 3 levels higher eg. level 100 guy can share exp with lvl 98 guy and lvl 103 guy
extraPartyExperienceLimit = 100 -- The maximum bonus percentage, in this case 100% is the max
extraPartyExperiencePercent = 25 -- Bonus percent each player in the party = Takes 4 people to get 100% exp bonus, after which it doesnt increase
experienceShareLevelDifference - this is min level in party to enable shared exp (highest lvl in party * experienceShareLevelDifference) -> min allowed party lvl )
In your example experienceShareLevelDifference = 2/3, so.. lets take party with players of lvls 100, 120, 140. Highest lv in your pt...
Just a wild shot here, havent seen any scripts or anything but I'm guessing it goes like this.

experienceShareRadiusX = 30 -- Is like 30 squares to either right and left side -- for the exp to count towards the shared experience.
experienceShareRadiusY = 30 -- Is 30 squares up and down
experienceShareRadiusZ = 1 -- Is 1 floor up or down
experienceShareLevelDifference = 2 / 3 -- Probably like 2 levels lower and 3 levels higher eg. level 100 guy can share exp with lvl 98 guy and lvl 103 guy
extraPartyExperienceLimit = 100 -- The maximum bonus percentage, in this case 100% is the max
extraPartyExperiencePercent = 25 -- Bonus percent each player in the party = Takes 4 people to get 100% exp bonus, after which it doesnt increase
 
Just a wild shot here, havent seen any scripts or anything but I'm guessing it goes like this.

experienceShareRadiusX = 30 -- Is like 30 squares to either right and left side -- for the exp to count towards the shared experience.
experienceShareRadiusY = 30 -- Is 30 squares up and down
experienceShareRadiusZ = 1 -- Is 1 floor up or down
experienceShareLevelDifference = 2 / 3 -- Probably like 2 levels lower and 3 levels higher eg. level 100 guy can share exp with lvl 98 guy and lvl 103 guy
extraPartyExperienceLimit = 100 -- The maximum bonus percentage, in this case 100% is the max
extraPartyExperiencePercent = 25 -- Bonus percent each player in the party = Takes 4 people to get 100% exp bonus, after which it doesnt increase
extraPartyExperienceLimit
extraPartyExperiencePercent

i think the same as your thought but when i try to make 4 voc with share exp. i get no bonus.
that's why i ask about them
 
Those three are wrongly defined:
Code:
experienceShareLevelDifference = 2 / 3 -- Probably like 2 levels lower and 3 levels higher eg. level 100 guy can share exp with lvl 98 guy and lvl 103 guy
extraPartyExperienceLimit = 100 -- The maximum bonus percentage, in this case 100% is the max
extraPartyExperiencePercent = 25 -- Bonus percent each player in the party = Takes 4 people to get 100% exp bonus, after which it doesnt increase
experienceShareLevelDifference - this is min level in party to enable shared exp (highest lvl in party * experienceShareLevelDifference) -> min allowed party lvl )
In your example experienceShareLevelDifference = 2/3, so.. lets take party with players of lvls 100, 120, 140. Highest lv in your pt is 140, so we will take it to calculations. 140 * (2/3) = 93.333. So in party u cannot have player with lvl lower than 93.3 (so player lvl has to be at least 94) to enable shared exp.


extraPartyExperienceLimit - min exp to be obtained from monster to add bonus exp.
In your case extraPartyExperienceLimit = 100.
If you have enabled shared exp, and u will get less than 100exp from enemy, then you will not be rewarded by bonus exp for party sharing.


extraPartyExperiencePercent - bonus exp percentage.
If shared exp is enabled, active, and you get more exp than extraPartyExperienceLimit, then it is increased by such percentage.
for example u have set 25% bonus.
u have 5 ppl in pt, and monster gives 1000 exp.
Each player will get 200 exp + bonus (1000 * 25% = 250) => 450 exp

Here's the part of code related to that:
C++:
    double shareExperience = (experience / (double)(memberList.size() + 1));
    if(experience > (double)g_config.getNumber(ConfigManager::EXTRA_PARTY_LIMIT))
        shareExperience += (experience * (double)(g_config.getNumber(ConfigManager::EXTRA_PARTY_PERCENT) / 100));
src: peonso/forgottenserver036pl1 (https://github.com/peonso/forgottenserver036pl1/blob/caf524d396542b489d8c7e22cbb329be80f5b949/src/party.cpp#L319)

Hope that I didn't mismatch anything ^^.
 
Solution
Those three are wrongly defined:
Code:
experienceShareLevelDifference = 2 / 3 -- Probably like 2 levels lower and 3 levels higher eg. level 100 guy can share exp with lvl 98 guy and lvl 103 guy
extraPartyExperienceLimit = 100 -- The maximum bonus percentage, in this case 100% is the max
extraPartyExperiencePercent = 25 -- Bonus percent each player in the party = Takes 4 people to get 100% exp bonus, after which it doesnt increase

experienceShareLevelDifference - this is min level in party to enable shared exp (highest lvl in party * experienceShareLevelDifference) -> min allowed party lvl )
In your example experienceShareLevelDifference = 2/3, so.. lets take party with players of lvls 100, 120, 140. Highest lv in your pt is 140, so we will take it to calculations. 140 * (2/3) = 93.333. So in party u cannot have player with lvl lower than 93.3 (so player lvl has to be at least 94) to enable shared exp.


extraPartyExperienceLimit - min exp to be obtained from monster to add bonus exp.
In your case extraPartyExperienceLimit = 100.
If you have enabled shared exp, and u will get less than 100exp from enemy, then you will not be rewarded by bonus exp for party sharing.


extraPartyExperiencePercent - bonus exp percentage.
If shared exp is enabled, active, and you get more exp than extraPartyExperienceLimit, then it is increased by such percentage.
for example u have set 25% bonus.
u have 5 ppl in pt, and monster gives 1000 exp.
Each player will get 200 exp + bonus (1000 * 25% = 250) => 450 exp

Here's the part of code related to that:
C++:
    double shareExperience = (experience / (double)(memberList.size() + 1));
    if(experience > (double)g_config.getNumber(ConfigManager::EXTRA_PARTY_LIMIT))
        shareExperience += (experience * (double)(g_config.getNumber(ConfigManager::EXTRA_PARTY_PERCENT) / 100));
src: peonso/forgottenserver036pl1 (https://github.com/peonso/forgottenserver036pl1/blob/caf524d396542b489d8c7e22cbb329be80f5b949/src/party.cpp#L319)

Hope that I didn't mismatch anything ^^.
You made only 10 posts, this one is the best <3
Thanks very much :) it worked.
@esigma94 Do you know how to make it depend on party number ? if 2 or 3 or 4 ?
 
Last edited:
Without doing changes in c++ code you won't be able to achieve that (or I can't find any solution atm).
Also what to change in code depends on what you want to do.
If you need to do some calculations dependant on amount of party members, then Party::shareExperience() method is a good place to do that.
If you'd like to control when shared exp should be active, then modifying Party::canUseSharedExperience() sounds fine.
and so on..

If you prefer to do some lua scripts with these bonuses, you should first add some events and methods related to above in c++.
TFS I took a look at (0.3.6pl1) does not contain events on gaining experience or methods to control party (check if shared exp is enabled/active etc).


c++ example.
The simplest thing I think you can do is to increase bonus exp when more players are in party.

Replace this fragment of code
C++:
    if(experience > (double)g_config.getNumber(ConfigManager::EXTRA_PARTY_LIMIT))
        shareExperience += (experience * (double)(g_config.getNumber(ConfigManager::EXTRA_PARTY_PERCENT) / 100));
src: peonso/forgottenserver036pl1 (https://github.com/peonso/forgottenserver036pl1/blob/caf524d396542b489d8c7e22cbb329be80f5b949/src/party.cpp#L320)

With following
C++:
    int32_t bonusExpPercentPerMember = 10 * (memberList.size() - 1); // 3 players in party => +10%, 4 ppl => +20%, 5 ppl => +30%
    if(experience > (double)g_config.getNumber(ConfigManager::EXTRA_PARTY_LIMIT))
        shareExperience += (experience * (double)((g_config.getNumber(ConfigManager::EXTRA_PARTY_PERCENT) + bonusExpPercentPerMember) / 100));

Then as you can read in comment in code, every player after second one in party (so third, forth etc) will result in additional 10% to the bonus exp.
3 players in party => +10%, 4 ppl => +20%, 5 ppl => +30%
 
Without doing changes in c++ code you won't be able to achieve that (or I can't find any solution atm).
Also what to change in code depends on what you want to do.
If you need to do some calculations dependant on amount of party members, then Party::shareExperience() method is a good place to do that.
If you'd like to control when shared exp should be active, then modifying Party::canUseSharedExperience() sounds fine.
and so on..

If you prefer to do some lua scripts with these bonuses, you should first add some events and methods related to above in c++.
TFS I took a look at (0.3.6pl1) does not contain events on gaining experience or methods to control party (check if shared exp is enabled/active etc).


c++ example.
The simplest thing I think you can do is to increase bonus exp when more players are in party.

Replace this fragment of code
C++:
    if(experience > (double)g_config.getNumber(ConfigManager::EXTRA_PARTY_LIMIT))
        shareExperience += (experience * (double)(g_config.getNumber(ConfigManager::EXTRA_PARTY_PERCENT) / 100));
src: peonso/forgottenserver036pl1 (https://github.com/peonso/forgottenserver036pl1/blob/caf524d396542b489d8c7e22cbb329be80f5b949/src/party.cpp#L320)

With following
C++:
    int32_t bonusExpPercentPerMember = 10 * (memberList.size() - 1); // 3 players in party => +10%, 4 ppl => +20%, 5 ppl => +30%
    if(experience > (double)g_config.getNumber(ConfigManager::EXTRA_PARTY_LIMIT))
        shareExperience += (experience * (double)((g_config.getNumber(ConfigManager::EXTRA_PARTY_PERCENT) + bonusExpPercentPerMember) / 100));

Then as you can read in comment in code, every player after second one in party (so third, forth etc) will result in additional 10% to the bonus exp.
3 players in party => +10%, 4 ppl => +20%, 5 ppl => +30%
That’s all great,
I wanted that last part.
If there are more members gives more exp.
But this 10% related to the percent in config.lua ? Or what ?
If i set bonus at config.lua 30% , what will be the new bonus ?
——
Edited.
Ok i calculated, it will be 40% if 3 players in party.
This added calculate party member size, leader not counted as a member, right?
 
Exactly ;) it will be 40%.
Also as you already said, leader is not included in memberList.
Shared experience can be activated only when at least 2 players are in party so in this method size of memberList (memberList.size()) cannot be less than 1 (leader + 1 member).

Min party case (leader + 1 member => 2 ppl in party):
baseBonus = 30%
above2playersExtraBonus = 10%
memberList.size() = 1
extrabonus = 10 * (1 - 1) = 10 * 0 = 0
overallBonus = baseBonus + extraBonus = 30% + 0% = 30%

Another party case (leader + 3 member => 4 ppl in party):
baseBonus = 30%
above2playersExtraBonus = 10%
memberList.size() = 3
extrabonus = 10 * (3 - 1) = 10 * 2 = 20
overallBonus = baseBonus + extraBonus = 30% + 20% = 50%

Also you can add it to config.lua
In configmanager.h you have to add new number_config_t entry.
here is number_config_t defined: peonso/forgottenserver036pl1 (https://github.com/peonso/forgottenserver036pl1/blob/master/src/configmanager.h#L65)
let's call it:
C++:
PARTY_ABOVE2PLAYERS_BONUS


Next add line responsible to read this configuration from config.lua.
somewhere here: peonso/forgottenserver036pl1 (https://github.com/peonso/forgottenserver036pl1/blob/master/src/configmanager.cpp#L218)
like:
C++:
m_confNumber[PARTY_ABOVE2PLAYERS_BONUS] = getGlobalNumber("extraPartyExperienceAbove2Players", 10);


Then in this line:
C++:
int32_t bonusExpPercentPerMember = 10 * (memberList.size() - 1);
Change 10 to be read from ConfigManager (it keeps values from config.lua):
C++:
int32_t bonusExpPercentPerMember = g_config.getNumber(ConfigManager::PARTY_ABOVE2PLAYERS_BONUS) * (memberList.size() - 1);

Voilà! After compilation, u can keep your extra bonus above 2 players in config lua :p
Add to config.lua entry like:
Lua:
extraPartyExperienceAbove2Players = 15
And your bonus exp in party will be now increased by additional 15% for 3 players in party, 45% for 5 players in party etc...

PS. some explanations are simplyfied to not go too deep into unnecessary details :)
 
Exactly ;) it will be 40%.
Also as you already said, leader is not included in memberList.
Shared experience can be activated only when at least 2 players are in party so in this method size of memberList (memberList.size()) cannot be less than 1 (leader + 1 member).

Min party case (leader + 1 member => 2 ppl in party):
baseBonus = 30%
above2playersExtraBonus = 10%
memberList.size() = 1
extrabonus = 10 * (1 - 1) = 10 * 0 = 0
overallBonus = baseBonus + extraBonus = 30% + 0% = 30%

Another party case (leader + 3 member => 4 ppl in party):
baseBonus = 30%
above2playersExtraBonus = 10%
memberList.size() = 3
extrabonus = 10 * (3 - 1) = 10 * 2 = 20
overallBonus = baseBonus + extraBonus = 30% + 20% = 50%

Also you can add it to config.lua
In configmanager.h you have to add new number_config_t entry.
here is number_config_t defined: peonso/forgottenserver036pl1 (https://github.com/peonso/forgottenserver036pl1/blob/master/src/configmanager.h#L65)
let's call it:
C++:
PARTY_ABOVE2PLAYERS_BONUS


Next add line responsible to read this configuration from config.lua.
somewhere here: peonso/forgottenserver036pl1 (https://github.com/peonso/forgottenserver036pl1/blob/master/src/configmanager.cpp#L218)
like:
C++:
m_confNumber[PARTY_ABOVE2PLAYERS_BONUS] = getGlobalNumber("extraPartyExperienceAbove2Players", 10);


Then in this line:
C++:
int32_t bonusExpPercentPerMember = 10 * (memberList.size() - 1);
Change 10 to be read from ConfigManager (it keeps values from config.lua):
C++:
int32_t bonusExpPercentPerMember = g_config.getNumber(ConfigManager::PARTY_ABOVE2PLAYERS_BONUS) * (memberList.size() - 1);

Voilà! After compilation, u can keep your extra bonus above 2 players in config lua :p
Add to config.lua entry like:
Lua:
extraPartyExperienceAbove2Players = 15
And your bonus exp in party will be now increased by additional 15% for 3 players in party, 45% for 5 players in party etc...

PS. some explanations are simplyfied to not go too deep into unnecessary details :)
Thanks man, That's really great.
It worked perfect :)
Happy to see people like you helping ^^
 
Back
Top