With four potential allies in the campaign, there is a lot of dialogue duplication. This refactoring attempts to consolidate the text.
Additionally, the ally ID was recorded in the variable ally_name which can be confusing, so rename it to ally_id instead.
This happens if player 4 and another one choose the same color.
(They shouldn't do that to begin with, but they could)
In this case the workaround is also triggered and side 4 gets a new color.
That's fine.
Previously that would have caused side 4's color to change in each scenario,
thus it's now persisted as well.
The workaround is for the case a player chooss choose the same coklor as side 4.
In difference to other files, this one cannot be changed later on during 1.16.
Because it is a Lua event, it is loaded on client side.
By defining the variable wc2_highest_player_side behaviour could still be switched during 1.16.
For the code to work, the scenarios must also be loaded.
Currently, only one of the three is loaded, the other scenario ids won't exist.
To load them, the code in WC_II_scenario.cfg would need to be changed on the hosting side to:
#ifdef CAMPAIGN_WC_3P
{WC2_SCENARIO_NEW scenario "WC_II_3p" {WC_II_CAMPAIGN_NAME_3P} 3}
{WC2_SCENARIO_NEW scenario "WC_II_2p" {WC_II_CAMPAIGN_NAME_2P} 2}
{WC2_SCENARIO_NEW scenario "WC_II_1p" {WC_II_CAMPAIGN_NAME_1P} 1}
#endif
~ Part 2 ~
The player who lost his leader probably does not want to play anymore.
When the level is won, transition to the 3p version.
This could actually be done for all scenarios,
until reaching the 1p.
~ Part 1 ~
That by itself is not yet useful, as the unit will be dead,
and have no recruits in the next level.
As of string freeze. add only an image and no message.
This is the only place, where it mattered, that there is no reserved empty side for side 4.
For the dual role of side 4 being either an AI or a player side, it uses a workaround.
It's fine to give this object also to remaining enemies.
(It's only unneccessary, as they are deleted afterwards.)
Though when side 4 is a human side it is useful.
In 1.14 it was 1 bonus point per player.
In the function 3 bonus points are hardcoded.
Reason is that wc2_player_count is not known in the first scenario.
Change to give 1 bonus per player in later scenarios, and assume 3 players for the first one.