• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.
Yeah, you would have to be extremely lucky for the random_system to contain the fleet you want to destroy. Try limiting the random system to the right one(s)

Code:
random_system = {
   limit = {
     any_ship_in_system = {
       fleet = {
         has_fleet_flag = colony_tankers_fleet
       }
     }
   }
   every_fleet_in_system = {
     limit = {
       has_fleet_flag = colony_tankers_fleet
     }
     destroy_fleet = this # not sure how to ref the fleet here
   }
}
 
Yeah, the issue is going to be the player may not have the fleet in that system. So it'll need to look everywhere for that tag and kill them regardless of location.


BTW, here is the other code to spawn to a system outside the players control but it needs to be tagged obviously :)

Code:
        random_system = {
            limit = { has_star_flag = new_colony_system }
            random_system_planet = {
                limit = { is_star = yes }
                save_event_target_as = probe_spawn
                create_fleet = { name = "Probe" }
                last_created_fleet = {
                    set_owner = root
                    create_ship_design = {
                        design = "DS47"
                        ftl = root
                    }
                    create_ship = {
                        name = "Curiosity"
                        design = last_created_design
                    }
                    set_location = event_target:probe_spawn
                }
            }
        }
 
Solved the issue of not being able to disband the already spawned in ships from the game set up. The big issue was that when a player merged ships they would always merge under the "1st fleet" which wasn't getting tagged as a colony_fleet. It wont matter how they are merged now they should all disband when the Ilus system is colonized :D ...but if the fleets are split it wont work on them.

Code:
        hidden_effect = {
            set_country_flag = take_to_the_starts
           
            random_system = {
                limit = {
                    has_star_flag = old_colony_system
                    any_ship_in_system = {
                        is_ship_class = shipclass_military
                    }
                }
                every_fleet_in_system = {
                    limit = {
                        is_ship_class = shipclass_military
                    }
                set_fleet_flag = colony_fleet
                }
            }
        }
 
The fleet flag probably doesn't carry over to the new fleet when they are split up. Try setting a flag on the individual ships instead like this
Code:
hidden_effect = {
    set_country_flag = take_to_the_starts
  
    random_system = {
        limit = {
            has_star_flag = old_colony_system
            any_ship_in_system = {
                is_ship_class = shipclass_military
            }
        }
        every_fleet_in_system = {
            every_owned_ship = { #Goes through the countrys owned ships
                limit = {
                    is_ship_class = shipclass_military
                    fleet = { is_same_value = PREV } #Makes sure we only pick ships that belong to the fleets from every_fleet_in_system
                }
                set_ship_flag = colony_ship
            }
        }
    }
}
and then look for ships with the colony_ship flag when you want to remove them or do something else with them.
 
I did try to do something like this before but I'm not 100% sure how I look for the ships flags and then destroy the fleets theres no destroy_ship as far as I know?

[TBH the code I was using when trying to do it was probably ages off correct!]