Adding a trigger to change player civilization

Hello. In the scenario editor, I think it would be really nice if a trigger was added that changes a players civilization. For example, in a nomad type start, all players start with the same civ. The location they settle in can then determine their civ for the rest of the game. I think this could be quite a useful trigger. I’ve been thinking about some of the mechanics, so here they are:

  • Unique Units: All unique units from the previous civ remain available. However, if there is a conflict in location for the unit, the unit from the new civ takes precedence. For example, if player A starts as Italians, they have the Genoese Crossbow as their main unique unit, as well as access to the Condottiero. Through triggers, player A’s civ is now changed to Britons. Because the Longbowman now conflicts with the Genoese Crossbow, the Longbow takes precedence. The Condottiero remains available though, because nothing conflicts with it. It can be manually removed through triggers. In this example, all Genoese Crossbows would still remain on the field in their current state, but they would no longer be trainable without further trigger intervention.
  • Buildings: The architecture style for future buildings changes to match that of the new civ. However, all current buildings remain as they are.
  • Technology: The tech tree changes to match the new civ. However, all currently researched techs also remain. This means, if the player started as Franks and researched Paladin, before being changed to Britons, they will still train Paladins.
  • Civ Bonuses: Civ bonuses change to match the new civ, but don’t remove any units unless they conflict.

I think that covers most cases. What do people think?

Based on how the engine works, this might be almost impossible/require too much work on the part of devs. I wonder if it even would be possible to implement a system where it is possible to swap which color is actively controlled by the player, as that is one avenue to swap civilization.

That is possible. There are triggers to both change player color and change object ownership. They can even change civ names. They just can’t change civs. In effect, this would basically just be enabling all units for the new civ and in the case of conflict disabling the conflicting unit and replacing it, as well as doing the same with the techs.

If you are not interested in modding, you may not understand some of what I am about to say.

What I meant by color was not the actual color but player number. Like if it were possible to start controlling player number 5 instead of player number 1 midway through the game. My motivation for talking about it was because if it were possible, it would give us an easy way of doing what you asked for. But the more I think about it I don’t know which change would be easy to implement.

The problem arises out of how the civs are implemented in the engine. For example, if the game wants to check if a particular player has access to a certain technology, it doesn’t look at the player’s civilization and subsequently its tech tree. Rather it starts off each player with a blank civ and gives each player bonuses and disables techs according to their civilization. After this point the engine doesn’t bother with what is the civilization of that player. Changing the civilization of a game midway would require that we figure out how to undo the effect of those bonuses and then proceed to disable/enable appropriate techs.

Changing civ color, object ownership, civ names etc. is available in the scenario editor because doing all that would require changing the value of a single variable somewhere. Hence they are trivial to implement.

Though I do see a way of implementing such a thing using in a datamod. One can create a custom civilization with a hidden tech that undoes all its bonuses and adds the bonuses of another civ.

They already have a trigger that can enable/disable techs/units. This could then be done that changing civ will then disable all other unique units and replace them, replace all unresearched techs, and change the architecture. I can imagine that being potentially possible, it’s basically just combining a ton of trigger effects into one to simplify it.