Get spawned party to engage main party [1.1.0]

Users who are viewing this thread

Hello ! After 1.1.0 one of the mods I work on became broken and I managed to fix most of the issues. However the issue that still persists is how can i get a spawned party to engage the main hero party. Pre 1.1.0 this was ease as I just did this:

C#:
spawnedParty.SetMoveEngageParty(MobileParty.MainParty);

But that won't work after the SetMoveEngageParty was moved to the new class MobilePartyAi. If I try to access it the same way I get an error like this:

Code:
Cannot access non-static method 'SetMoveEngageParty' in static context

Anyone solved this yet ?

Here is the entire function the above segment is used:

C#:
private void SpawnBandits(bool shouldFlee)
        {
            try
            {
                //CreateBanditParty is a custom function
                MobileParty banditParty = PartySetup.CreateBanditParty();

                banditParty.MemberRoster.Clear();

                if (shouldFlee)
                {
                    banditParty.Aggressiveness = 0.2f;
                }
                else
                {
                    banditParty.Aggressiveness = 10f;
                    MobilePartyAi.SetMoveEngageParty(MobileParty.MainParty);
                }

                int numberToSpawn = Math.Min((int)(MobileParty.MainParty.MemberRoster.TotalManCount * 0.50f), banditCap);

                PartySetup.AddRandomCultureUnits(banditParty, 10 + numberToSpawn);
            }
            catch (Exception ex)
            {
                MessageBox.Show($"Error while running \"{randomEventData.eventType}\" event :\n\n {ex.Message} \n\n { ex.StackTrace}");
            }
        }
    }
 
Last edited:
Well after a lot of attempts I finally figured it out.

I needed to change this:
C#:
banditParty.SetMoveEngageParty(MobileParty.MainParty);

To this:
C#:
banditParty.Ai.SetMoveEngageParty(MobileParty.MainParty);
 
Back
Top Bottom