BL Coding How can i change AI behavior after you go down in battle?

正在查看此主题的用户

CreamPuff

Recruit
Im tired of my elite units just bursting into a bunch of confused drowning ants that get mopped up by cavalry. So how can i make a mod that will make them either go under someone elses command, or still under the players command if need be. I'll post the mod as well, and thank you by name if youd like.

Im brand new to mod creation so i dont know what to look for exactly, so apologies if this is a dumb question.
 
Hello!
I don't really understand what you want, but maybe this can help you a bit.

I hated when I couldn't control my troops while I was doing a siege battle so I modified the AttackEntityOrderDetachment class in
TaleWorlds.MountAndBlade dll

C#:
// Token: 0x060015A1 RID: 5537 RVA: 0x00057AF4 File Offset: 0x00055CF4
        public void AddAgentAtSlotIndex(Agent agent, int slotIndex)
        {
            // This will prevent to lose control over troops, they will only do siege actions (like the ladder) when you give charge command
            if (agent.Formation.MovementOrder.MovementState != MovementOrder.MovementStateEnum.Charge)
            {
                return;
            }
            this.AddAgent(agent, slotIndex);
            if (agent.Formation != null)
            {
                agent.Formation.DetachUnit(agent, true);
            }
            agent.DetachmentWeight = 1f;
            agent.Detachment = this;
        }

You can also try to find in classes like: Agent, Formation,AI behaviors, etc.
If you want to make troops more "sharper/smarter", well that't not an easy job. You should let the developers fix that, because I know they will, thats for sure! :smile:
 
点赞 0
just to have my units be controllable after i'm downed mid battle. by myself or companions. thanks it does help, but i dont have a dll decompiler, what do you use? i dont need them smarter just controlled.
 
点赞 0
后退
顶部 底部