PopUp messages
For this I will just show you cavehobbit's masterful popup code, which gives each player a battlefield tour by moving the camera around the map to look at the place referred to in each message. You can see this in action by playing the first couple of turns of the MP Gniew scenario hotseat. Download the 2nd Swedish-Polish war campaign and then create an MP challenge for the Gniew scenario (which will appear in the New Challenge list after you have downloaded it), then accept the challenge yourself. The first time you do this you will get a warning, in case it was a mistake, but if you accept it anyway you can play both sides in the MP game hotseat.
Code: Select all
FUNCTION StartTurn(side)
{
if (GetTurn() == 0)
{
if (GetShowSide() == GetCurrentSide())
{
AddVizCamCenter(21, 58) ;
AddVizFunctionCall("ShowUIScreen","BattlePop0", "Anim1", "IDS_SCENARIO_GNIEW");
}
AddVizDelay(2);
if (GetShowSide() == GetCurrentSide())
{
AddVizCamCenter(53, 55) ;
AddVizFunctionCall("ShowUIScreen","BattlePop0", "Anim1", "IDS_SCENARIO_GNIEW2");
}
AddVizDelay(2);
if (GetShowSide() == GetCurrentSide())
{
AddVizCamCenter(30, 20) ;
AddVizFunctionCall("ShowUIScreen","BattlePop0", "Anim1", "IDS_SCENARIO_GNIEW3");
}
AddVizDelay(2);
}
if (GetTurn() == 1)
{
if (GetShowSide() == GetCurrentSide())
{
AddVizFunctionCall("ShowUIScreen","BattlePop0", "Anim1", "IDS_SCENARIO_GNIEW");
}
AddVizDelay(2);
if (GetShowSide() == GetCurrentSide())
{
AddVizCamCenter(24, 43) ;
AddVizFunctionCall("ShowUIScreen","BattlePop0", "Anim1", "IDS_SCENARIO_GNIEW5");
}
AddVizDelay(2);
if (GetShowSide() == GetCurrentSide())
{
AddVizCamCenter(61, 47) ;
AddVizCamCenter(59, 61) ;
AddVizFunctionCall("ShowUIScreen","BattlePop0", "Anim1", "IDS_SCENARIO_GNIEW7");
}
AddVizDelay(2);
if (GetShowSide() == GetCurrentSide())
{
AddVizCamCenter(47, 60) ;
AddVizFunctionCall("ShowUIScreen","BattlePop0", "Anim1", "IDS_SCENARIO_GNIEW8");
}
AddVizDelay(2);
if (GetShowSide() == GetCurrentSide())
{
AddVizCamCenter(23, 58) ;
AddVizFunctionCall("ShowUIScreen","BattlePop0", "Anim1", "IDS_SCENARIO_GNIEW6");
}
AddVizDelay(2);
}
The text1.txt entries that go with this are as follows:
IDS_SCENARIO_GNIEW_BP0TEXT,"Gniew, Poland, 1626~~This scenario depicts the Battle of Gniew which was fought from September 22 to October 1, 1626. But I've concentrated all fighting into a single battle.~~The battle was part of the Polish-Swedish war of 1626-1629. The town of Gniew was in Swedish hands, but had been besieged by the Poles. When Gustavus Adolphus heard of this he moved his army toward Gniew, a strategically important town for both Sweden and Poland.~~Deployment might not be entirely historical, instead I've deployed the forces in a way to make the battle fun and interesting.~~The battle begins with the Polish besieging the Swedish garrison of Gniew castle. The main Swedish army is arriving from the north, while the Poles are arriving from Northwest. The side winning this battle will be in control of Gniew...",
IDS_SCENARIO_GNIEW2_BP0TEXT,"Scouts report large enemy formations in this area.",
IDS_SCENARIO_GNIEW3_BP0TEXT,"There's a Swedish force joining from the south very soon.",
IDS_SCENARIO_GNIEW5_BP0TEXT,"The Swedish garrison in Gniew have a strong defensive position.",
IDS_SCENARIO_GNIEW6_BP0TEXT,"The Swedish army arrive in this area. But rumour tells there's another Swedish force arriving, from where no one knows...",
IDS_SCENARIO_GNIEW7_BP0TEXT,"When scouts reported that the Swedish army was moving toward Gniew, more Polish units began riding toward Gniew.",
IDS_SCENARIO_GNIEW8_BP0TEXT,"The main Polish army will soon arrive along this road.",
Note that to work correctly with the BattlePop0 popup UI, the tags in text1.txt have to have _BP0TEXT appended to the name used in the code. (That is a Zero not a capital O).
The "AddVizDelay(2)" commands after each popup are necessary to make the code show each popup in turn, rather than skipping to the last one.
The "if (GetShowSide() == GetCurrentSide())" condition stops the popup messages appearing to the other player during the turn replay in MP games.