Open bgoetz opened 4 years ago
I would really love the perk xp bonus that you talk about. In what file do I put these changes? Do I have to compile a DLL or is it as easy as just changing a file?
I program for a living so you can get technical with me.
So this is the dirty way, where you have to update with each patch. You could create a module which theoretically is more stable, but this worked for me.
bin/Win64_Shipping_Client
and then every DLL in Modules
(there should be 11, don't include any mods).
DefaultPerks
, open the instance, then search for the specific perk.
75f
, it defaults to 15f
. RaiseTheMeek is right below it.TaleWorlds.Core
or System.Linq
. Just toss that stuff at the top in the editor, if need be.
HourlyTick
, DailyTick
, and WeeklyTick
. Move around a bit (I usually wait a whole day, since DailyTick
is the most common). And do other minor testing according to your changes (entering towns, recruiting troops, etc.). Wow awesome, thanks for the guide very helpful!
Because I'm lazy here's the Python script I use to run things in the background. There's another thing in there that doubles the maximum size of all bandits, for more Fun™.
Oh. And you don't need to clear and re-add assemblies after a patch. Learned that the hard way. Just hit File>Reload All Assemblies.
Ohh I like the double bandit max, that is useful. Thanks for the tips guys going to patch the dll now. So annoying how little exp you get for everything.
if (this.IsActive && this.HasPerk(DefaultPerks.Leadership.RaiseTheMeek))
{
foreach (CharacterObject attackerTroop2 in from x in this.MemberRoster.Troops
where x.Tier < 4
select x)
{
int troopPerksXp2 = Campaign.Current.Models.PartyTrainingModel.GetTroopPerksXp(DefaultPerks.Leadership.RaiseTheMeek);
float bonusMultiplier = (float)Math.Max(Math.Log10((double)this.MemberRoster.Troops.Count()), 1.0);
int troopIndex = this.MemberRoster.FindIndexOfTroop(attackerTroop2);
if (troopIndex >= 0)
{
int totalTrainable = this.MemberRoster.GetElementNumber(troopIndex) - this.MemberRoster.GetElementWoundedNumber(troopIndex);
if (totalTrainable <= 0)
{
bonusMultiplier = 0f;
}
else if (totalTrainable > 1)
{
bonusMultiplier *= (float)(Math.Log10((double)(totalTrainable + 1)) / Math.Log10(2.0));
}
}
this.Party.MemberRoster.AddXpToTroop(MathF.Round((float)troopPerksXp2 * bonusMultiplier), attackerTroop2);
}
}
@bgoetz This look right for the raise the meek?
Edited: Found a bug lol
Edit: Missed what you meant. One thing I noticed is that you don't get to apply both benefits. I think its possible if you have a companion who has one and you have the other, so the fix would be to not make it a restrictive if/else.
The faster way is to edit TaleWorlds.CampaignSystem.DefaultPerks.InitializePerks()
. For 150f
this is what you'll get:
this.LeadershipRaiseTheMeek.Initialize("{=JGCtv8om}Raise The Meek", "{=emH1yQAs}Medium xp bonus per day to tier 1-2-3 troops.", DefaultSkills.Leadership, this.GetTierCost(1), this.LeadershipCombatTips, SkillEffect.PerkRole.PartyMember, 150f, SkillEffect.PerkRole.None, 0f, SkillEffect.EffectIncrementType.Add);
Perks can have multiple effects. In this case we are changing the primary effect from 30 to 150 (or whatever you want).
Ya I did that, but also wanted the stack bonus you did but for raise the meek. I got it working though :D
As long as I ignore my profession developer brain, this was a super easy and quick way to mod the game!
Just based on these dlls it looks like bannerlord is quite moddable. Mod conflicts looks like they will be a nightmare though lol
P.S Thanks a ton for the info very helpful!
Yeah. They did a fairly good job putting things together. I didn't do Warband modding, so I'm not sure what the official mod tools would be capable of.
To continue with the more troops = more fun idea, I decreased the calculated wage cost by half. I noticed leaders were starting to get a little too poor trying to run around with hundreds of troops.
Inside CharacterObject.TroopWage
:
return MathF.Floor(0.5f * (float)num * (float)num2);
I also increased the number of spawned notables in towns to prevent a shortage of recruitable troops. This one only runs on a new campaign, but I've been doing that pretty much every day anyway.
Inside SpawnUrbanCharacters
// What we're looking at doing is increasing the amount of times `CreateHeroAtOccupation` is called.
// I only increased the ones that didn't have a fixed value, and kept the randomness as it is.
if (settlement.IsTown)
...
// In this case `num` is the target value for the 'Merchant' type. I just gave it a flat +2 increase
int num = 3 + MBRandom.RoundRandomized(valueNormalized * 2f); // Default is 1 + ...
...
else if (settlement.IsVillage)
// Likewise `num3` is the target value for 'RuralNotable'
int num3 = 3 + MBRandom.RandomInt(2); // Default is 1 + ...
Just some stuff I've tinkered with over the past couple weeks. I'm not interested in going through the whole module process since it's only been for personal use, but you might find something interesting in here. If you add this stuff maybe I won't have to manually update the DLLs every time they patch.
SandBox
CreateRandomSettlementIssues() I didn't like how few quests were being generated. I feel like with all the raiding and looting and warring going on villages should be desperate for any sort of help. This makes the early game a bit easier, if you prefer to do quests to start out. I started with a x2 multiplier, but found x3 a little bit more to my liking. That's what I run with now.
desiredIssueCount *= 3;
FindSuitableCompanionsToLeadCaravan() This will search through every available party leader when generating the list of companions during the caravan creation screen. This way you can form a caravan from any city, even if the leader isn't in your party currently. The leader does teleport to the new city, but I didn't really dig into trying to make it more realistic. A side benefit is that this is more performant if you have fewer leaders / companions than troops in your party.
I ripped this from
ExecuteCreateNewParty()
, so you may want to periodically check that for official changes.TaleWorlds.CampaignSystem
MobileParty.DailyTick() Here I tweaked the daily XP gain from the CombatTips perk to increase based on both the number of non-wounded troops in a stack, and the total number of non-wounded troops in the party. It uses logarithmic logic to try and balance out the gain in large parties. I didn't do anything with RaiseTheMeek because I never take that perk
Here's what it looks like with a party of 100 troops. I adjusted CombatTips to be 75 XP / day, so keep that in mind. 'Stack XP' is how much XP is applied to a stack with the specified count, not including the total troop XP. 'Total XP' is the Stack XP but with an additional modifier based on the total number of healthy troops in the party.
Other The only things not laid out in detail above that I think you haven't included yet are:
NumberOfMenOnMapToEatOneFood
,NumberOfMenOnGarrisonToEatOneFood
NumberOfProsperityToEatOneFood
CalculateLearningRate()
.explainedNumber.LimitMin(1f);
GetPartyMemberSizeLimit()
:return num * 2;
HeroShouldGiveEliteTroop()
:return sellerHero.IsRuralNotable && sellerHero.Power >= 75;
ResearchPointsNeedForNewPart()
just change the divisor. Default is 4return (count * count + 12) / 64;
DailyTick
, and the default is a minimum 25% chance. I changed that to 7.5% and decreased the effect the calculated war score has. InsideThinkAboutDeclaringWar()
.if (faction != null && MBRandom.RandomFloat < Math.Min(0.075f, num / 500000f))
DefaultPerks
:LeadershipCombatTips
LeadershipRaiseTheMeek