I was pretty frustrated that there is no easy way to switch character nation. So i made this little code and though I share it with you guys. I used code from the arcamp mod as a reference. It was super helpfull. Thanks for that.
It allows you to change nation of characters placed in depot (or any other building you choose).
It uses query and character replacing as the way to do it and its contained within one module, so you wont need to jumble your code with it.
'dep2' is the identifier of the building, so you need to change that for your building id, and you need to change the side number from 3 to whichever side you are using too.
And here is the code:
var nation_chosen, my_all_units, my_unit, do_change;
function ChangeNation(var unit_to_change, p_nation);
old_unit := unit_to_change;
uc_nation := p_nation;
uc_side := 3;
unit_to_change := CreateHuman;
every 0$6 trigger isselected(dep2) do
do_change := true;
Case Query('Change') of
nation_chosen := nation_american;
nation_chosen := nation_russian;
nation_chosen := nation_arabian;
do_change = false;
my_all_units = FilterAllUnits([f_side,3]);
for my_unit in all_units do
if(dep2 = IsInUnit(my_unit)) then