Jump to content
Sign in to follow this  
Fred1988

Simple Faction endgame trigger?

Recommended Posts

Is there any simple trigger script that can end a scenario with a faction victory?

 

I've used this code to end previous scenarios 

SCR_BaseGameMode gameMode = SCR_BaseGameMode.Cast(GetGame().GetGameMode());

Faction faction = GetGame().GetFactionManager().GetFactionByKey("US");

int usIndex = GetGame().GetFactionManager().GetFactionIndex(faction);

gameMode.EndGameMode(SCR_GameModeEndData.CreateSimple(SCR_GameModeEndData.ENDREASON_EDITOR_FACTION_VICTORY, -1, usIndex));

 

But now the workbench refuses to work with it

 

Skjermbilde-245.png

Skjermbilde-247.png

Share this post


Link to post
Share on other sites
On 8/6/2023 at 8:03 PM, Fred1988 said:

Is there any simple trigger script that can end a scenario with a faction victory?

 

I've used this code to end previous scenarios 

SCR_BaseGameMode gameMode = SCR_BaseGameMode.Cast(GetGame().GetGameMode());

Faction faction = GetGame().GetFactionManager().GetFactionByKey("US");

int usIndex = GetGame().GetFactionManager().GetFactionIndex(faction);

gameMode.EndGameMode(SCR_GameModeEndData.CreateSimple(SCR_GameModeEndData.ENDREASON_EDITOR_FACTION_VICTORY, -1, usIndex));

 

But now the workbench refuses to work with it

 

I had a quick look at this as I was looking at how to do it. On the last line, you cannot use the SCR_GameModeEndData, it has been moved into an enum - see my below code for something that works.

		SCR_BaseGameMode gameMode = SCR_BaseGameMode.Cast(GetGame().GetGameMode());
		Faction faction = GetGame().GetFactionManager().GetFactionByKey("US");
		int usIndex = GetGame().GetFactionManager().GetFactionIndex(faction);
		gameMode.EndGameMode(SCR_GameModeEndData.CreateSimple(EGameOverTypes.COMBATPATROL_VICTORY, -1, usIndex));

Once you type in the EGameOverTypes and then press the "." key, you'll see a list of the available types - I picked COMBATPATROL_VICTORY. I hope this helps you out.

  • Like 1

Share this post


Link to post
Share on other sites
On 8/10/2023 at 8:56 PM, [evo] dan said:

 

I had a quick look at this as I was looking at how to do it. On the last line, you cannot use the SCR_GameModeEndData, it has been moved into an enum - see my below code for something that works.


		SCR_BaseGameMode gameMode = SCR_BaseGameMode.Cast(GetGame().GetGameMode());
		Faction faction = GetGame().GetFactionManager().GetFactionByKey("US");
		int usIndex = GetGame().GetFactionManager().GetFactionIndex(faction);
		gameMode.EndGameMode(SCR_GameModeEndData.CreateSimple(EGameOverTypes.COMBATPATROL_VICTORY, -1, usIndex));

Once you type in the EGameOverTypes and then press the "." key, you'll see a list of the available types - I picked COMBATPATROL_VICTORY. I hope this helps you out.

Thanks! Will test it out now!

Share this post


Link to post
Share on other sites
On 8/10/2023 at 8:56 PM, [evo] dan said:

 

I had a quick look at this as I was looking at how to do it. On the last line, you cannot use the SCR_GameModeEndData, it has been moved into an enum - see my below code for something that works.


		SCR_BaseGameMode gameMode = SCR_BaseGameMode.Cast(GetGame().GetGameMode());
		Faction faction = GetGame().GetFactionManager().GetFactionByKey("US");
		int usIndex = GetGame().GetFactionManager().GetFactionIndex(faction);
		gameMode.EndGameMode(SCR_GameModeEndData.CreateSimple(EGameOverTypes.COMBATPATROL_VICTORY, -1, usIndex));

Once you type in the EGameOverTypes and then press the "." key, you'll see a list of the available types - I picked COMBATPATROL_VICTORY. I hope this helps you out.

Worked perfectly! And thanks for the tip on looking up the different endgame types, thanks to this i've been able to reupload my Counter Strike Reforged mod with a proper deathmatch mode! 

  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×