❔ Does anyone want to show me how to make a few edits in C#?
Its to fix a few bugs in Mount and Blade Bannerlord
20 Replies
$details
When you ask a question, make sure you include as much detail as possible. Such as code, the issue you are facing, and what you expect the result to be. Upload code here https://paste.mod.gg/ (see $code for more information on how to paste your code)
also if the game doesn't condone modding that's probably too much of a gray area for here
Didn't know we had TaleWorlds Entertainment employees in the server, you guys preparing a new patch?
You can modify this file and see results. A guy around a year ago did a ton of bug fixes, but then he left. A lot of his knowhow has since dissapeared.
I'm afraid you'll need a lot of Bannerlord-specific knowledge to make any changes like that. As in, an understanding of the decompiled code and what not
Your best bet would be asking the modding community for Bannerlord for help, should such a community exist
It goes way beyond the scope of just generic C# help
In any case though, yeah, more details would be needed
Like, what exactly do you want to change?
I have tried asking that community all week long, only a couple people have reached out, and they only gave me general advice. Im trying to fix bugs in the game. One bug is that some troop formations do not act properly. Another thing I would like to fix is the auto follow function. It makes your troops disobey your order and move onto your location if you move more than 50 feet away from them.
yeah that's going to take specialized knowledge of the game
you might get lucky and find someone here but if a discord dedicated to the game can't help then chances are probably low here
I know the exact line where the auto follow is, should I post it?
you can try, but unless it's an obvious localized issue the amount a random person can figure out is limited
I somehow doubt that auto-follow has been programmed with just a single line of code, but sure
}
private void CheckPlayerBeingDetached()
{
foreach (NetworkCommunicator networkPeer in GameNetwork.NetworkPeers)
{
if (networkPeer.IsSynchronized)
{
MissionPeer component = networkPeer.GetComponent<MissionPeer>();
if (this.PlayerDistanceToFormation(component) >= component.CaptainBeingDetachedThreshold)
this.MakePlayerFormationFollowPlayer(component.GetNetworkPeer());
}
}
}
that code means nothing to me, personally
this.MakePlayerFormationFollowPlayer(component.GetNetworkPeer());
there's going to be a lot going on in the background that actually supports whatever the "auto follow" feature is
How do I learn more about the code
poke at it and see what happens
i learned C# by modding space engineers well beyond the officially supported modding API, there's no shortcut when it comes to this kind of thing
if there's no documentation your only real option is to mess around with the decompiled code
assuming that's not against the game's TOS
Hi,
i read the code and I cannot say that i have any knowledge about this. However if you read the code the following happens:
if (this.PlayerDistanceToFormation(component) >= component.CaptainBeingDetachedThreshold) // if distance is bigger or equal treshhold than do the following.
this.MakePlayerFormationFollowPlayer(component.GetNetworkPeer()); // start method to follow.
component ==> is a data object which is used to determen the distance and some data is used to sent it to the method
to follow.
If the following doesnt work the cause can be:
component.CaptainBeingDetachedThreshold ==> is too big
PlayerDistanceToFormation(component) ==> has a wrong value
this.MakePlayerFormationFollowPlayer(component.GetNetworkPeer()); ==> this method doesnt work correctly
to determen the issue you should start trying to capture these values to determen where the issue occurs.
It can also be that e.g. the component size is the same size as the screen. Also these values need to be checked
To really locate where the follow goes wrong, you need to capture / log all the values which determen if follow needs to be triggered. if the trigger occurs, (starting the method in the if function). then there could be an error in MakePlayerFormationFollowPlayer. Or just an example x and y axes reversed.
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.