End Screen Creation – Arma Reforger
Lou Montana (talk | contribs) (Page creation) |
Lou Montana (talk | contribs) m (Text replacement - "\{\{Link\|enfusion.*\.c\|([A-Za-z0-9_]+)\}\}" to "{{Link/Enfusion|armaR|$1}}") |
||
Line 13: | Line 13: | ||
| The end screen is called by means of the <enforce inline>GameMode.EndGameMode()</enforce> method and uses the data provided, combined with the local player data to decide what to display. | | The end screen is called by means of the <enforce inline>GameMode.EndGameMode()</enforce> method and uses the data provided, combined with the local player data to decide what to display. | ||
|- | |- | ||
| {{Link| | | {{Link/Enfusion|armaR|SCR_GameModeEndData}} | ||
| Data | | Data | ||
| Data used in the <enforce inline>EndGameMode</enforce> method combined with wining player(s) and winning faction(s). See the script itself as well as the <enforce inline>SCR_GameModeEndData.Create()</enforce> and <enforce inline>SCR_GameModeEndData.CreateSimple()</enforce> to get more information as to how to call end game. | | Data used in the <enforce inline>EndGameMode</enforce> method combined with wining player(s) and winning faction(s). See the script itself as well as the <enforce inline>SCR_GameModeEndData.Create()</enforce> and <enforce inline>SCR_GameModeEndData.CreateSimple()</enforce> to get more information as to how to call end game. | ||
Line 30: | Line 30: | ||
| These are two standard layouts used in the End Screens in the config. These are spawned within the EndScreen.layout and hold the actual visuals. (It is possible that there are more layouts by the time you are reading this). Use these as an example if you want to display any specific information like: Score or some custom screen. '''Create your own if you want to modify the end screen''' (Keep in mind that changing the basic ones will change it for all game modes). Do take note that some widgets like text widgets and the image will need specific naming, though leaving them out will not cause any issues. | | These are two standard layouts used in the End Screens in the config. These are spawned within the EndScreen.layout and hold the actual visuals. (It is possible that there are more layouts by the time you are reading this). Use these as an example if you want to display any specific information like: Score or some custom screen. '''Create your own if you want to modify the end screen''' (Keep in mind that changing the basic ones will change it for all game modes). Do take note that some widgets like text widgets and the image will need specific naming, though leaving them out will not cause any issues. | ||
|- | |- | ||
| {{Link| | | {{Link/Enfusion|armaR|SCR_GameOverScreenContentUIComponent}} | ||
| Script | | Script | ||
| This is the main widget component found on the EndScreen_Default and EndScreen_NoImage layout. If you want to do something special with the layout then it would be advised to inherit from this component and override the methods. | | This is the main widget component found on the EndScreen_Default and EndScreen_NoImage layout. If you want to do something special with the layout then it would be advised to inherit from this component and override the methods. | ||
Line 50: | Line 50: | ||
! Description | ! Description | ||
|- | |- | ||
| {{Link| | | {{Link/Enfusion|armaR|SCR_BaseGameOverScreenInfo}} | ||
| Basic game over screen to set a title, subtitle, briefing and image. If you create any new End Screens this is the base you will inherent from | | Basic game over screen to set a title, subtitle, briefing and image. If you create any new End Screens this is the base you will inherent from | ||
|- | |- | ||
| {{Link| | | {{Link/Enfusion|armaR|SCR_FactionGameOverScreenInfo}} | ||
| If the end condition contains one or more factions then this allows you to get the faction flag for the image and faction name as parameter in the Subtitle | | If the end condition contains one or more factions then this allows you to get the faction flag for the image and faction name as parameter in the Subtitle | ||
|- | |- | ||
| {{Link| | | {{Link/Enfusion|armaR|SCR_FactionVictoryGameOverScreenInfo}} | ||
| Similar to {{Link| | | Similar to {{Link/Enfusion|armaR|SCR_FactionGameOverScreenInfo}} but also sets the Vignette color to the winning faction | ||
|- | |- | ||
| {{Link| | | {{Link/Enfusion|armaR|SCR_EditorFactionGameOverScreenInfo}} | ||
| Similar to the above but supports multiple winning factions which by default it does not. | | Similar to the above but supports multiple winning factions which by default it does not. | ||
|- | |- | ||
| {{Link| | | {{Link/Enfusion|armaR|SCR_DeathMatchGameOverScreenInfo}} | ||
| Used to get the wining player name(s) and show it as params in the Subtitle. Note that by the time of writing, this is not used. | | Used to get the wining player name(s) and show it as params in the Subtitle. Note that by the time of writing, this is not used. | ||
|}<!-- | |}<!-- | ||
-->Chose any of the above scripts, though if you want to make it fully custom simply create your own or use {{Link| | -->Chose any of the above scripts, though if you want to make it fully custom simply create your own or use {{Link/Enfusion|armaR|SCR_BaseGameOverScreenInfo}} and handle any other logic by inheriting and overriding the {{Link/Enfusion|armaR|SCR_GameOverScreenContentUIComponent}}. | ||
=== Main Variables === | === Main Variables === | ||
Line 76: | Line 76: | ||
|- | |- | ||
| Game Over Content Layout | | Game Over Content Layout | ||
| This is the actual layout spawned within the game over screen. You can use {{Link | | This is the actual layout spawned within the game over screen. You can use {{Link/Enfusion|armaR|SCR_GameOverScreenContentUIComponent}} (or an inherited version). | ||
More information about the layout in the steps below. | More information about the layout in the steps below. | ||
|- | |- | ||
| Game Over Screen Id | | Game Over Screen Id | ||
| The ID of the game over screen. Make sure it is an unique enum which you added to the {{Link| | | The ID of the game over screen. Make sure it is an unique enum which you added to the {{Link/Enfusion|armaR|EGameOverTypes}} enum. | ||
|}<!-- | |}<!-- | ||
-->{{Feature|informative|Some of the End screen types such as {{Link| | -->{{Feature|informative|Some of the End screen types such as {{Link/Enfusion|armaR|SCR_EditorFactionGameOverScreenInfo}} have additional variables (see {{Link|#Optional Variables}} and {{Link|#Optional Game Master Variables}} below). As usual, hover over the description to read what they mean. | ||
=== Optional Variables === | === Optional Variables === | ||
Line 89: | Line 89: | ||
The following are optional parameters which affect various base UI elements. To use this Press the '''Optional Params'''<nowiki/>' {{hl|set class}} button. | The following are optional parameters which affect various base UI elements. To use this Press the '''Optional Params'''<nowiki/>' {{hl|set class}} button. | ||
{{Feature|informative| | {{Feature|informative| | ||
Note that in order to use most of these optional variables, the layout you used as "Game Over Content Layout" will need to have the Text/Image components with the correct name as set in the {{Link| | Note that in order to use most of these optional variables, the layout you used as "Game Over Content Layout" will need to have the Text/Image components with the correct name as set in the {{Link/Enfusion|armaR|SCR_GameOverScreenContentUIComponent}}. | ||
}} | }} | ||
Line 103: | Line 103: | ||
|- | |- | ||
| Image Texture | | Image Texture | ||
| What image will be shown. Note that using {{Link| | | What image will be shown. Note that using {{Link/Enfusion|armaR|SCR_FactionGameOverScreenInfo}} will show the players faction, or in case of {{Link/Enfusion|armaR|SCR_FactionVictoryGameOverScreenInfo}} will show the faction that won. | ||
|- | |- | ||
| Debriefing | | Debriefing | ||
Line 115: | Line 115: | ||
|- | |- | ||
| Subtitle Param | | Subtitle Param | ||
| %1 param shown in Subtitle. This is the player faction's name if using the {{Link| | | %1 param shown in Subtitle. This is the player faction's name if using the {{Link/Enfusion|armaR|SCR_FactionGameOverScreenInfo}} or the winning faction's name if {{Link/Enfusion|armaR|SCR_FactionVictoryGameOverScreenInfo}}. | ||
| | | | ||
|- | |- | ||
Line 122: | Line 122: | ||
|} | |} | ||
{{Feature|informative|In most cases the Title, Subtitle and Debriefing params are actually set by script (such as {{Link| | {{Feature|informative|In most cases the Title, Subtitle and Debriefing params are actually set by script (such as {{Link/Enfusion|armaR|SCR_FactionGameOverScreenInfo}}) instead of being set directly in the config.}} | ||
=== Optional Game Master Variables === | === Optional Game Master Variables === | ||
Line 170: | Line 170: | ||
The End screen layout is the actual layout shown when the end screen is called and '''needs to be set to the 'Game Over Content Layout' variable in the config'''. Most things are already explained in the steps above. Here though you can go in the most details for your custom End Screen. | The End screen layout is the actual layout shown when the end screen is called and '''needs to be set to the 'Game Over Content Layout' variable in the config'''. Most things are already explained in the steps above. Here though you can go in the most details for your custom End Screen. | ||
The following Table will show all the Default widgets which are affected by the config element we set up before. Do not worry though, you can delete the widgets you do not need as the system will check if they exist. Also the widget names are the default names and can be changed in the {{Link| | The following Table will show all the Default widgets which are affected by the config element we set up before. Do not worry though, you can delete the widgets you do not need as the system will check if they exist. Also the widget names are the default names and can be changed in the {{Link/Enfusion|armaR|SCR_GameOverScreenContentUIComponent}} class. | ||
{| class="wikitable" | {| class="wikitable" | ||
Line 204: | Line 204: | ||
=== Layout Component === | === Layout Component === | ||
If you create a new End screen layout then do make sure it has the {{Link| | If you create a new End screen layout then do make sure it has the {{Link/Enfusion|armaR|SCR_GameOverScreenContentUIComponent}} or an inherited version of it. | ||
The {{Link| | The {{Link/Enfusion|armaR|SCR_GameOverScreenContentUIComponent}} is the base component used to initilize the end screen. If you want to make a fully custom end screen simply inherent from this script. Simply override the <enforce inline>InitContent()</enforce> method to initialise the end screen. This method will give you the {{Link/Enfusion|armaR|SCR_GameModeEndData}} as well as all the data set in the config as mentioned above. You can always use <enforce inline>super.InitContent()</enforce> in the method if you want to keep the base functionality. | ||
=== Screen Manager Component === | === Screen Manager Component === | ||
The {{Link| | The {{Link/Enfusion|armaR|SCR_GameOverScreenManagerComponent}} handles things like displaying the right endscreen depending on local player faction and winning faction but you can also handle this within the layout script as well. | ||
You will need to set up the End screen in the {{Link| | You will need to set up the End screen in the {{Link/Enfusion|armaR|SCR_GameOverScreenManagerComponent}} specifically in the <enforce inline>GetGameOverType()</enforce> method. It is a bit convoluted as the GameOverData and the Game Over Screens are not very compatible in some causes. It mostly is about factions (or winning player Id) and if the local player should get the victory or defeat game end screen. | ||
Either use the existing code as a guide or use the code below to ignore this section altogether: | Either use the existing code as a guide or use the code below to ignore this section altogether: | ||
Line 230: | Line 230: | ||
The last step is to actually make sure to call your end game. | The last step is to actually make sure to call your end game. | ||
Use the <enforce inline>GameMode.EndGameMode()</enforce> to actually end the game. This method takes a new {{Link| | Use the <enforce inline>GameMode.EndGameMode()</enforce> to actually end the game. This method takes a new {{Link/Enfusion|armaR|SCR_GameModeEndData}} which you can create with the <enforce inline>SCR_GameModeEndData.CreateSimple()</enforce> and <enforce inline>SCR_GameModeEndData.Create()</enforce> static methods. | ||
Create Simple method params: | Create Simple method params: | ||
Line 239: | Line 239: | ||
|- | |- | ||
| int reason | | int reason | ||
| The end reason. Generally if using a custom end screen you will be using the {{Link| | | The end reason. Generally if using a custom end screen you will be using the {{Link/Enfusion|armaR|EGameOverTypes}} enum you created as the reason. Check the {{Link/Enfusion|armaR|SCR_GameModeEndData}} class for more in-depth information. | ||
|- | |- | ||
| int winnerId | | int winnerId |
Revision as of 12:04, 5 January 2023
The End Screen (interchangeably called Game Over screen) are screens shown when the game ends. This guide will go through each part and how to set up your own game over screen.
The end screen consists out of various parts:
Element | Type | Description |
---|---|---|
GameMode.EndGameMode() (from SCR_BaseGameMode.c) | Method | The end screen is called by means of the GameMode.EndGameMode() method and uses the data provided, combined with the local player data to decide what to display. |
SCR_GameModeEndData | Data | Data used in the EndGameMode method combined with wining player(s) and winning faction(s). See the script itself as well as the SCR_GameModeEndData.Create() and SCR_GameModeEndData.CreateSimple() to get more information as to how to call end game. |
EndScreen.layout | Layout | This is the base layout which fades in when game over is called. The specific game over widgets are spawned within this layout. |
GameOverScreensConfig.conf | Config | This holds all the gameover screens and is referenced to by various scripts to get the specific information that needs to be shown such as but not limited to: The specific layout spawned within the EndScreen.layout, the localized title, subtitle, briefing, the icon shown, audio played as well as various optional parameters. |
EndScreenContent_Default.layout |
Layout | These are two standard layouts used in the End Screens in the config. These are spawned within the EndScreen.layout and hold the actual visuals. (It is possible that there are more layouts by the time you are reading this). Use these as an example if you want to display any specific information like: Score or some custom screen. Create your own if you want to modify the end screen (Keep in mind that changing the basic ones will change it for all game modes). Do take note that some widgets like text widgets and the image will need specific naming, though leaving them out will not cause any issues. |
SCR_GameOverScreenContentUIComponent | Script | This is the main widget component found on the EndScreen_Default and EndScreen_NoImage layout. If you want to do something special with the layout then it would be advised to inherit from this component and override the methods. |
EGameOverTypes.c | Enum | This hold the enums used as identifiers within the config. Config endscreens mostly use this as an identifier for developers but any editor or custom endscreen will need a specific unique enum. |
Config Modding
Add New End Screen
- Open GameOverScreensConfig.conf
- Press the '+' to start creating a new End Screen. Here you will be presented with a few options.
These are the options by the time of writing this guide:
Class Description SCR_BaseGameOverScreenInfo Basic game over screen to set a title, subtitle, briefing and image. If you create any new End Screens this is the base you will inherent from SCR_FactionGameOverScreenInfo If the end condition contains one or more factions then this allows you to get the faction flag for the image and faction name as parameter in the Subtitle SCR_FactionVictoryGameOverScreenInfo Similar to SCR_FactionGameOverScreenInfo but also sets the Vignette color to the winning faction SCR_EditorFactionGameOverScreenInfo Similar to the above but supports multiple winning factions which by default it does not. SCR_DeathMatchGameOverScreenInfo Used to get the wining player name(s) and show it as params in the Subtitle. Note that by the time of writing, this is not used.
Main Variables
The following variables must be filled in:
Variable | Description |
---|---|
Game Over Content Layout | This is the actual layout spawned within the game over screen. You can use SCR_GameOverScreenContentUIComponent (or an inherited version).
More information about the layout in the steps below. |
Game Over Screen Id | The ID of the game over screen. Make sure it is an unique enum which you added to the EGameOverTypes enum. |
{{Feature|informative|Some of the End screen types such as SCR_EditorFactionGameOverScreenInfo have additional variables (see Optional Variables and Optional Game Master Variables below). As usual, hover over the description to read what they mean.
Optional Variables
The following are optional parameters which affect various base UI elements. To use this Press the Optional Params' set class button.
Variable | Description | |
---|---|---|
Title | This is the localized string for the title. | |
Subtitle | The localized string for the subtitle. | |
Image Texture | What image will be shown. Note that using SCR_FactionGameOverScreenInfo will show the players faction, or in case of SCR_FactionVictoryGameOverScreenInfo will show the faction that won. | |
Debriefing | The localised string for debriefing text | |
Audio One Shot | The audio music one shot that will be played upon the opening of the end screen. | |
Title Param | %1 param shown in Title | |
Subtitle Param | %1 param shown in Subtitle. This is the player faction's name if using the SCR_FactionGameOverScreenInfo or the winning faction's name if SCR_FactionVictoryGameOverScreenInfo. | |
Debriefing Param | %1 for debriefing param |
Optional Game Master Variables
In most cases you would want to make sure your end screen is compatible with Game Master; one thing you need to keep in mind is that there can be more than one winning faction in Game Master.
Similarly to the Optional Variables above press the set class button to add Game Master compatibility. If you leave this null then the game will never allow Game Masters to access this particular End Screen.
Variable | Description |
---|---|
Can Be Set By Game Master | Set to true if you want the Game Master to specifically be able to set this End Screen. You can leave this false, see the 'Mirrored State' variable below for more information. |
Needs Playable Factions | Some End screens such as FactionVictory will need factions to be set, while others like EndSession do not need any factions.
If your end screen checks factions then make sure this is true. Only relevant if 'Can Be Set By Game Master' is true. |
Display Name | This is the localised string name seen by the Game Master when selecting the End Screen. Only relevant if 'Can Be Set By Game Master' is true. |
Description | This is the localized string description the player sees when selecting the End Screen. Only relevant if 'Can Be Set By Game Master' is true. |
Description Param1 and Description Param2 | %1 and %2 of Description. Generally this is set through script rather then in the config. Only relevant if 'Can Be Set By Game Master' is true. |
Mirrored State | In some cases you don't want the Game Master to be able to choose the End Screen directly.
Think of Defeat End Screen if there is already a Victory End Screen. In this cause you set 'Can Be Set By Game Master' true for victory and false for defeat and set the Mirrored state of Victory to Defeat and vice versa. If the Victory End screen is chosen then any faction that is not selected will automatically get the Defeat End Screen. |
Layout
The End screen layout is the actual layout shown when the end screen is called and needs to be set to the 'Game Over Content Layout' variable in the config. Most things are already explained in the steps above. Here though you can go in the most details for your custom End Screen.
The following Table will show all the Default widgets which are affected by the config element we set up before. Do not worry though, you can delete the widgets you do not need as the system will check if they exist. Also the widget names are the default names and can be changed in the SCR_GameOverScreenContentUIComponent class.
Widget Name | Widget Type | Target | Description |
---|---|---|---|
GameOver_Image | ImageWidget | Image Texture | The image shown in the end screen |
GameOver_State | TexWidget | Title | The title shown in the end screen |
GameOver_Condition | TextWidget | Subtitle | The Subtitle Shown in the end screen |
GameOver_Description | TextWidget | Debrief | The Debrief shown in the end screen |
Scripting
Layout Component
If you create a new End screen layout then do make sure it has the SCR_GameOverScreenContentUIComponent or an inherited version of it.
The SCR_GameOverScreenContentUIComponent is the base component used to initilize the end screen. If you want to make a fully custom end screen simply inherent from this script. Simply override the InitContent() method to initialise the end screen. This method will give you the SCR_GameModeEndData as well as all the data set in the config as mentioned above. You can always use super.InitContent() in the method if you want to keep the base functionality.
Screen Manager Component
The SCR_GameOverScreenManagerComponent handles things like displaying the right endscreen depending on local player faction and winning faction but you can also handle this within the layout script as well. You will need to set up the End screen in the SCR_GameOverScreenManagerComponent specifically in the GetGameOverType() method. It is a bit convoluted as the GameOverData and the Game Over Screens are not very compatible in some causes. It mostly is about factions (or winning player Id) and if the local player should get the victory or defeat game end screen.
Either use the existing code as a guide or use the code below to ignore this section altogether:
End the Game
The last step is to actually make sure to call your end game.
Use the GameMode.EndGameMode() to actually end the game. This method takes a new SCR_GameModeEndData which you can create with the SCR_GameModeEndData.CreateSimple() and SCR_GameModeEndData.Create() static methods.
Create Simple method params:
Variable | Description |
---|---|
int reason | The end reason. Generally if using a custom end screen you will be using the EGameOverTypes enum you created as the reason. Check the SCR_GameModeEndData class for more in-depth information. |
int winnerId | The winner player ID. Leave -1 if no winning player |
int winnerFactionId | The winning faction index. Leave -1 if no winning faction |
Create method params:
Variable | Description |
---|---|
int reason | Same as Create Simple |
array<int> winnerIds | An array of winning players. Leave null if no winning players. |
array<int> winnerFactionIds | An array of wining factions. Leave null if no winning factions. |
Example of calling end game in script: