Unofficial Patch IES System - Use UP1.6 Features in Custom Scenarios and Singleplayer Games

Modding, Map Editor, IES Scripting and Other Tutorials
Post Reply
User avatar
Dr.MonaLisa
High Representative
Posts: 8707
Joined: 17 Jun 2010, 11:21
Location: Poland
Has thanked: 49 times
Been thanked: 108 times

Unofficial Patch IES System - Use UP1.6 Features in Custom Scenarios and Singleplayer Games

Post by Dr.MonaLisa »

Unofficial Patch IES System - Use & Control UP1.6 Features in Custom Scenarios and Singleplayer Games

Since Unofficial Patch 1.6 version 1.6.0.009 (March 2024), it's possible to use the new Unofficial Patch IES system. This allows you to extend the existing IES scripts to also control some of the Unofficial Patch features that can make your scenarios even better.
The method of working is pretty simple. We use the two of existing IES functions:

PrintMessage("@UnofficialPatchIES ...");
PrintMessageFromPlayer("@UnofficialPatchIES ...", 1);


It doesn't matter which one of these two function you choose, because the command will not be displayed in the chat window (as long as the syntax you use is correct). In case you have a syntax error in your command, the UP1.6 will display an error with details in a message box.

The command is separated on the following parts:

PrintMessage("@UnofficialPatchIES Thread FunctionGroup Function() FunctionArguments")

@UnofficialPatchIES = This is just the control text that tells UP15_GameHelper.dll to continue parsing the command. It is always the same.

Thread = This argument decides which game thread should be used to execute the command, it can be one of the following:
* ThisThread = Use the main game thread that called the PrintMessage() or PrintMessageFromPlayer() function. It's generally the same thread that does everything else in EE2.
* GameHelperThread = Use the UP15_GameHelper.dll Watchdog thread which works on a different CPU (processor) core. This allows you to execute some more intensive tasks without impacting the main game thread performance. Specifying GameHelperThread allows you to use that separated thread instead of the overloaded game one. Unfortunately, due to the structure of how the game works, sometimes it's impossible to use the GameHelperThread for certain features, because calling these functions from a different thread would result in game crash. This is why it's always recommended to first test if the function works with ThisThread, and try the GameHelperThread secondarily.

FunctionGroup = This argument decides which feature / task we are going to do. Each FunctionGroup has several function calls available.

Function() = This is the function that will be executed. It is always written as it is. We do not put remaining arguments inside the brackets.

FunctionArguments = These are the function arguments. The syntax is different for each function, so it's important to always follow the documentation below.


As example, the final command might look like this:
PrintMessage("@UnofficialPatchIES GameHelperThread SoundRemap Add() ui_game_win=up15cs_lol_victory,ui_game_lose=up15cs_lol_defeat")

Available Unofficial Patch IES Function Groups:

1. TimeOfDay - Time of Day Control

This allows you to dynamically control the time of day in your scenario. Available functions & arguments:

PrintMessage("@UnofficialPatchIES ThisThread TimeOfDay Set() Dawn/Afternoon/Sunset/Night/CycleCustom/Cycle2/Cycle5/Cycle10/Cycle15")
This allows you to instantly switch to the ONE of the times of days listed above. It supports the permanent time of days as well as the cycle mode.

PrintMessage("@UnofficialPatchIES ThisThread TimeOfDay PauseCycleTime() true/false")
When you call this function with argument "true", the cyclic time of day will be paused. You can call this function with the "false" argument to resume it.

PrintMessage("@UnofficialPatchIES ThisThread TimeOfDay SetCustomCycleTimeSeconds() NumberOfSeconds
This allows you to decide how often the time of day should be changed for the CycleCustom time of day. For example, 15 minutes is equal to 900. After changing this value, it's required to call the Set() function again, with the CycleCustom argument, for example to change the time of day every 10 seconds:
PrintMessage("@UnofficialPatchIES ThisThread TimeOfDay SetCustomCycleTimeSeconds() 10")
PrintMessage("@UnofficialPatchIES ThisThread TimeOfDay Set() CycleCustom")
Please keep in mind that you can create your own time of day cycle function using the IES rules. This way, you could manually call Dawn, Afternoon, Sunset or Night with the frequency selected by yourself. This would for example allow you to have the Night last only for about 2 minutes, while Afternoon 10 minutes.

2. CrownSystem - Changing the status of option "Disable Crowns System and Leaders"

Unofficial Patch 1.5 brought a new feature allowing you to disable the Crowns System and Leaders on the game setup screen (Map -> "Check to DISABLE Crowns System and Leaders in game"). These Unofficial Patch IES functions allow you to live-control the status of this option during the active game (scenario). Available functions:

PrintMessage("@UnofficialPatchIES ThisThread CrownSystem Disable()")
The Disable() function simply disables the Crown System and Leaders in your scenario. Please keep in mind that if any of the Crowns was already awarded, the Disable() function will be in effect after the crown expires.

PrintMessage("@UnofficialPatchIES ThisThread CrownSystem Enable()")
The Enable() function enables the Crown System and Leaders in your scenario. If the Crown System was disabled and several players explored required military, economic and imperial technologies, all crowns will be awarded at the same time, instantly after you call the Enable() function.

3. SoundRemap - Changing sounds for selected events

This allows you to remap in-game sounds for your scenario. For example, you can set a custom "under attack" sound, or the one that plays after winning / losing the game. Available functions & arguments:

PrintMessage("@UnofficialPatchIES ThisThread SoundRemap Add() ui_game_win=up15cs_lol_victory,ui_game_lose=up15cs_lol_defeat")
The usage of the Add() function is quite simple. You can define as many sound remaps as you want, in a single or in multiple Add() function calls. You can find the correct sound database entries in the following files in your game installation folder:
EE2: zips\db_155.zip\db\Audio\dbsoun5.csv
AOS: zips_ee2x\EE2X_db_155.zip\EE2X_db\Audio\dbsoun5.csv
Once you find the sound you want to change, you simply type: "ui_game_win=up15cs_lol_victory". You can add extra sound remaps in a single command by simply separating them with the comma (,).

PrintMessage("@UnofficialPatchIES ThisThread SoundRemap Remove() ui_game_win,ui_game_lose")
In the Remove() function, you can specify the one or multiple sounds (separated with the comma ,) to remove from the remapping table, and restore their original sound.

PrintMessage("@UnofficialPatchIES ThisThread SoundRemap Reset()")
The Reset() function removes the remapping table and restores the original sounds (reverts all the changes you made). This function is also automatically called when a new game starts, in order to prevent issues where scenario sounds are preserved in other games. You might want to repeatedly call the Add() function with the same arguments if you want to prevent a problem where remapped sounds are not used when a player reloads the scenario game save.

PrintMessage("@UnofficialPatchIES ThisThread SoundRemap PreventUnofficialPatchSeasonalSounds() true/false")
When you call the PreventUnofficialPatchSeasonalSounds() function with the "true" argument, Unofficial Patch seasonal sounds will not be used in your scenario. Every year, on a period like Christmas, Dr.MonaLisa enables the special sound pack that works the same way as this Unofficial Patch IES SoundRemap feature. Calling this function with the "true" argument will prevent the seasonal sounds to be played in your scenario. You can resume the seasonal sounds by using the "false" argument. Please note, that this also defaults to "false" when you call the "Reset()" function.


Using Unofficial Patch IES commands in Singleplayer games:

It's possible to use the Unofficial Patch IES commands in Singleplayer games by typing them in the Chat window. Simply press the ENTER button and type one of the commands defined above.

EE2_ScreenShot_2024-03-22_13.55.19.097.jpg
EE2_ScreenShot_2024-03-22_13.55.19.097.jpg (404.26 KiB) Viewed 569 times


Summary

Unofficial Patch IES features might be extended in the future. Please feel free to add suggestions based on the existing UP1.6 features that you would like to trigger with the IES script. We hope that you will enjoy this new addition to the scenario editor.
Best regards,
Dr.MonaLisa
Ministry of Game Affairs
Department of Control and Complains
These users thanked the author Dr.MonaLisa for the post (total 2):
Loewenherz, calsch03

Post Reply

Return to “Tutorials”