Working on a mod could use some help

Was wondering if anyone knew of a way to make the mod tool reset the game from OnGameSetup so pretty much the idea is you can play the game as normal but at anytime you can type a command in the text box or press a hotkey and it will reset the game to the beginning of the match where its pretty much like you just started a game… I’m having issues trying to figure out how to make this possible.

You cannot easily “reset” the game since the map has changed during game: ressources, objects, terrain, etc. These changes cannot be backtraced. So the game has to be started once more with the same parameters. And this re-start can be done by the game menu.

Have you tried the modding discord? Much more information there.

the most basic way to do this would be to run the game in dev mode press CTRL+SHIFT+~ in your skirmish or custom game and simply type reset (or restart, either or. memory of a goldfish here but it’s one of the two!)

or if you want to regenerate an identical map you can copy the map seed and use it in the setup lobby of a fresh game

Also, you can set up a CheatMenu function for it in the .scar file
check out:
CheatMenu_RegisterCheatFunction( Function cheatFunction, String title, Boolean OPT_restartMission )

Adds a function to the Mission Cheat menu, under the title you provide. These should be registered in the Mission_Preset function.

If the restartMission flag is set, when the cheat is activated the mission will be restarted.

Summary

Most of the startup script happens as normal: Mission_SetupVariables, Mission_SetDifficulty, Mission_SetupRestrictions and Mission_Preset are all called as normal, but the supplied function is called INSTEAD OF the regular Mission_Start function.

Source: [E:\cardinal_BuildSystem_staging\engine\assets\engine\scar\missioncheatmenu.scar] (218) 

MissionOMatic_Cheat_Complete_Obj( )

Used to successfully COMPLETE all currently-active objectives

Source: [E:\cardinal_BuildSystem_staging\assets\cardinal\scar\missionomatic\missionomatic.scar] (984) 

MissionOMatic_Cheat_Fail_Obj( )

Used to FAIL all currently-active objectives

Source: [E:\cardinal_BuildSystem_staging\assets\cardinal\scar\missionomatic\missionomatic.scar] (1026) 

MissionOMatic_Cheat_Lose( )

Used to FAIL the entire mission

Source: [E:\cardinal_BuildSystem_staging\assets\cardinal\scar\missionomatic\missionomatic.scar] (955) 

MissionOMatic_Cheat_ViewRecipe( )

Used to view the mission recipe that this mission was generated from

Source: [E:\cardinal_BuildSystem_staging\assets\cardinal\scar\missionomatic\missionomatic.scar] (916) 

MissionOMatic_Cheat_Win( )

Used to WIN the entire mission

Source: [E:\cardinal_BuildSystem_staging\assets\cardinal\scar\missionomatic\missionomatic.

CheatMenu_RegisterCheatFunction( Function cheat_function, String title )

Adds a function to the Mission Cheat menu, under the title you provide. These should be registered in the Mission_Preset function.

When activated, the mission is restarted. Most of the startup script happens as normal: Mission_SetupVariables, Mission_SetDifficulty, Mission_SetupRestrictions and Mission_Preset are all called as normal, but the supplied function is called INSTEAD OF the regular Mission_Start function.

Source: [E:\cardinal_BuildSystem_staging\assets\cardinal\scar\gamesetup.scar] (777)
2 Likes

Thank you for the insight :slight_smile: If I can figure it out and make it simple to do then I will be publishing it so everyone can use it.

1 Like