Isn't Gifted bugged in this mod? Looks like with it you will be getting max vanilla rolls for everything up to level 31
my guess is that this mod adds 30 values for levelups, and this condition becomes true when you take gifted:else if (_maxOnly) { this.m.Attributes[i].insert(0, this.Const.AttributesLevelUp[i].Max); }so this mod just adds 30 max rolled values :D
May be too late, but it seems to me that when the mod tries to distribute 9+ talent levels from a pool(or even less when background restricts talents) it has a potential to roll low(say 1) for each attribute and then be unable to distribute remaining points from pool(as it tries to find an attribute with 0 talent) leading to infite loop.
i replaced in "mod_talents_reworked.nut" this part while( talentPool > 0 ) { local i = this.Math.rand(0, this.Const.Attributes.COUNT - 1);
if (this.m.Talents[i] == 0 && (this.getBackground() == null || this.getBackground().getExcludedTalents().find(i) == null)) { local r = this.Math.rand(1, 100); local val = 0;
if (r <= 45){ //45% val = 1; }else if (r <= 70){ //25% val = 2; }else if (r <= 85){ //15% val = 3; }else if (r <= 95){ //10% val = 4; }else{ val = 5; //5% } //logInfo(r + " - " + val); if(val > talentPool) { val = talentPool; } this.m.Talents[i] = val; talentPool-= val; } } with this (added new logic so code became bigger): local availableAttrsForTalents = []; local attrId; // id of availableAttrsForTalents local talentId; // id of talent, it's = availableAttrsForTalents[attrId]; local val; //how many stars to put in the talent local allAttributes = [0,1,2,3,4,5,6,7]; /*gt.Const.Attributes: Hitpoints = 0, Bravery = 1, Fatigue = 2, Initiative = 3, MeleeSkill = 4, RangedSkill = 5, MeleeDefense = 6, RangedDefense = 7, */
if (this.getBackground() == null) { availableAttrsForTalents = allAttributes; } else { foreach (attrId in allAttributes) { if(this.getBackground().getExcludedTalents().find(attrId) == null) { availableAttrsForTalents.push(attrId); } } } while( talentPool > 0 ) { if (availableAttrsForTalents.len() == 1) { // only 1 possible attr left - put all stars there attrId = 0; talentId = availableAttrsForTalents[attrId]; val = talentPool;
if (this.m.Talents[talentId] == 0 && (this.getBackground() == null || this.getBackground().getExcludedTalents().find(talentId) == null)) { local r = this.Math.rand(1, 100); val = 0;
// correction multiplier for cases when // talent pool is too high and there are very few available talents r = r * talentPool/availableAttrsForTalents.len();
if (r <= 45){ //45% val = 1; }else if (r <= 70){ //25% val = 2; }else if (r <= 85){ //15% val = 3; }else if (r <= 95){ //10% val = 4; }else{ val = 5; //5% } //logInfo(r + " - " + val); if(val > talentPool) { val = talentPool; }
this.m.Talents[talentId] = val; talentPool-= val; availableAttrsForTalents.remove(attrId); } } } and it looks like freezes are over
Wow, sounds like a really useful and cool mod, but I already have a mod that touches on veteran levels. Would it be possible to make a version of this mod without changing veteran levels? If it's not difficult then it will only be a plus
I added an alternate version without the changes to veteran levels, didn't tested it but it should work. Don't know if the 2 mods will be compatible though, but it may!
20 comments
my guess is that this mod adds 30 values for levelups, and this condition becomes true when you take gifted:
else if (_maxOnly)
so this mod just adds 30 max rolled values :D{
this.m.Attributes[i].insert(0, this.Const.AttributesLevelUp[i].Max);
}
while( talentPool > 0 )
with this (added new logic so code became bigger):{
local i = this.Math.rand(0, this.Const.Attributes.COUNT - 1);
if (this.m.Talents[i] == 0 && (this.getBackground() == null || this.getBackground().getExcludedTalents().find(i) == null))
{
local r = this.Math.rand(1, 100);
local val = 0;
if (r <= 45){ //45%
val = 1;
}else if (r <= 70){ //25%
val = 2;
}else if (r <= 85){ //15%
val = 3;
}else if (r <= 95){ //10%
val = 4;
}else{
val = 5; //5%
}
//logInfo(r + " - " + val);
if(val > talentPool) {
val = talentPool;
}
this.m.Talents[i] = val;
talentPool-= val;
}
}
local availableAttrsForTalents = [];
and it looks like freezes are overlocal attrId; // id of availableAttrsForTalents
local talentId; // id of talent, it's = availableAttrsForTalents[attrId];
local val; //how many stars to put in the talent
local allAttributes = [0,1,2,3,4,5,6,7];
/*gt.Const.Attributes:
Hitpoints = 0,
Bravery = 1,
Fatigue = 2,
Initiative = 3,
MeleeSkill = 4,
RangedSkill = 5,
MeleeDefense = 6,
RangedDefense = 7,
*/
if (this.getBackground() == null)
{
availableAttrsForTalents = allAttributes;
}
else
{
foreach (attrId in allAttributes)
{
if(this.getBackground().getExcludedTalents().find(attrId) == null)
{
availableAttrsForTalents.push(attrId);
}
}
}
while( talentPool > 0 )
{
if (availableAttrsForTalents.len() == 1)
{
// only 1 possible attr left - put all stars there
attrId = 0;
talentId = availableAttrsForTalents[attrId];
val = talentPool;
this.m.Talents[talentId] = val;
talentPool -= val;
availableAttrsForTalents.remove(attrId);
}
else if (availableAttrsForTalents.len() > 0)
{
attrId = this.Math.rand(0, availableAttrsForTalents.len() - 1);
talentId = availableAttrsForTalents[attrId];
if (this.m.Talents[talentId] == 0 && (this.getBackground() == null || this.getBackground().getExcludedTalents().find(talentId) == null))
{
local r = this.Math.rand(1, 100);
val = 0;
// correction multiplier for cases when
// talent pool is too high and there are very few available talents
r = r * talentPool/availableAttrsForTalents.len();
if (r <= 45){ //45%
val = 1;
}else if (r <= 70){ //25%
val = 2;
}else if (r <= 85){ //15%
val = 3;
}else if (r <= 95){ //10%
val = 4;
}else{
val = 5; //5%
}
//logInfo(r + " - " + val);
if(val > talentPool) {
val = talentPool;
}
this.m.Talents[talentId] = val;
talentPool-= val;
availableAttrsForTalents.remove(attrId);
}
}
}