Exemple #1
0
        public static MobileParty SpawnParty(Settlement spawnedSettlement, Clan clan, PartyTemplateObject templateObject, MobileParty.PartyTypeEnum partyType, TextObject partyName = null, PartyTemplateObject templatePrisoners = null, bool IsInheritClan = false)
        {
            //get name and show message.
            TextObject textObject = partyName ?? clan.Name;

            ModDebug.ShowMessage("CustomSpawns: Spawning " + textObject.ToString() + " at " + spawnedSettlement.GatePosition + " in settlement " + spawnedSettlement.Name.ToString(), DebugMessageType.Spawn);

            //create.
            MobileParty mobileParty = MBObjectManager.Instance.CreateObject <MobileParty>(templateObject.StringId + "_" + 1);

            if (templatePrisoners != null)
            {
                mobileParty.InitializeMobileParty(textObject, ConstructTroopRoster(templateObject, mobileParty.Party), ConstructTroopRoster(templatePrisoners, mobileParty.Party), spawnedSettlement.GatePosition, 0);
            }
            else
            {
                mobileParty.InitializeMobileParty(textObject, ConstructTroopRoster(templateObject, mobileParty.Party), new TroopRoster(mobileParty.Party), spawnedSettlement.GatePosition, 0);
            }

            //initialize
            Clan settlementClan = spawnedSettlement.OwnerClan;

            if (IsInheritClan == true)
            {
                Spawner.InitParty(mobileParty, textObject, settlementClan, spawnedSettlement);
            }
            else
            {
                Spawner.InitParty(mobileParty, textObject, clan, spawnedSettlement);
            }

            return(mobileParty);
        }
Exemple #2
0
        public static MobileParty SpawnParty(Settlement spawnedSettlement, Clan clan, PartyTemplateObject templateObject, MobileParty.PartyTypeEnum partyType, TextObject partyName = null)
        {
            //get name and show message.
            TextObject textObject = partyName ?? clan.Name;

            ModDebug.ShowMessage("CustomSpawns: Spawning " + textObject.ToString() + " at " + spawnedSettlement.GatePosition + " in settlement " + spawnedSettlement.Name.ToString());

            //create.
            MobileParty mobileParty = MBObjectManager.Instance.CreateObject <MobileParty>(templateObject.StringId + "_" + 1);

            mobileParty.InitializeMobileParty(textObject, ConstructTroopRoster(templateObject), new TroopRoster(), spawnedSettlement.GatePosition, 0);

            //initialize
            Spawner.InitParty(mobileParty, textObject, clan, spawnedSettlement);

            return(mobileParty);
        }
Exemple #3
0
        public static MobileParty SpawnParty(Settlement spawnedSettlement, Clan clan, PartyTemplateObject templateObject, Track.PartyTypeEnum partyType, TextObject partyName = null)
        {
            try
            {
                //get name and show message.
                TextObject textObject = partyName ?? clan.Name;
                ModDebug.ShowMessage("CustomSpawns: Spawning " + textObject.ToString() + " at " + spawnedSettlement.GatePosition + " in settlement " + spawnedSettlement.Name.ToString(), DebugMessageType.Spawn);

                //create.
                MobileParty mobileParty = MBObjectManager.Instance.CreateObject <MobileParty>(templateObject.StringId + "_" + 1);
                mobileParty.InitializeMobileParty(textObject, ConstructTroopRoster(templateObject, mobileParty.Party), new TroopRoster(mobileParty.Party), spawnedSettlement.GatePosition, 0);

                //initialize
                Spawner.InitParty(mobileParty, textObject, clan, spawnedSettlement);

                return(mobileParty);
            }
            catch (Exception e) {
                ErrorHandler.ShowPureErrorMessage("Possible invalid spawn data. Spawning of party terminated.");
                ErrorHandler.HandleException(e, "party spawning");
                return(null);
            }
        }