akkamaddi wrote:Would it be possible to have a system in the epic_systems file that is populated with occupied colony & cargo ships? If so, would it be a trouble to explain how?
At a high level, the main complication here is that at the point when the callbacks in epic_systems.lua are being processed, the stars and planets referenced aren't yet 'real', they're simply tables that describe the stars and planets that will eventually be created at the end of init_all_stars.lua. And because the stars don't yet exist, we can't place ships around them. So, if you want to spawn ships in an epic system, you need to a 2 part strategy; first create some special variable in the table data that's generated in epic_systems.lua file; then check for that variable after init_all_stars.lua has had a chance to create the star system, and trigger a ship spawn there if you find it.
The easiest way to do this is probably to use the existing 'specials' table, which is already being passed from from table template generated in epic_systems.lua to to the true star data (see init_all_stars.lua: 413).
Note that something very much like what you're trying to do here is already being done in the game, anytime we spawn 'monsters', i.e., space pirates or harpies. And, in fact, you could piggyback on that system to trigger your own custom ship spawning rules; take a look at setup_star_specials.lua, and in particular, how the complete_special_setup() works.
So basically, if you create a new special type in epic_systems.lua, you should then be able to hack a new spawning rule into setup_star_specials.lua.
That gets you colony ships filled with a strange alien race. The next step is to make those ships join (or not), whomever finds them. There's already handlers for this sort of behavior as well, that, again, could be piggybacked on. See, for example, harpy_guards.lua, or splinter_colony.lua. (Which are both hooks onto system-specials that could, in theory, be used as templates for building the sort of encounter you're proposing.)Programmer's note: harpy_guards.lua and splinter_colony.lua are both built on the encounter_env.lua 'base class'. Of all the various core components in the game, this is one of the pieces I'm least happy with. The whole system seems like it could really use a good re-factoring pass. The dialog tree specification system, and dialog semantic markup rules, are not nearly as nice as those used in other parts of the game. We want to add a bunch more encounters to the game (both pre, and post DLC) so I may rewrite this base class sooner or later. But if/when I do; I almost certainly won't destroy the old system, too much depends on it. What you'll probably see instead is a new file with a name like 'better_encounter_env' that fills the same role, but provides better helper functions for specifying dialog / dialog trees.