Firstly, you need to create the UI screen that you want to show. You can check out any of the files in DATA\UI or CORE\UI for examples. A simple on to start with is DATA\UI\BattlePop0.txt which is a simple textbox and OK button. You can ignore and omit the animation chunks (anything with a # as the first symbol) for now.

I would recommend using layer 7 for your custom UI control. Each layer is used by different controls, 7 is free in battle.

Once you have your screen, placed in the DATA\UI folder of your custom campaign, you can add a script line to show it in battle. This would be called at the very start, and one way to do this would be to add something of the form:

if( GetTurn() == -1 )
{
     ShowUIScreen("MyUIScreenObject", "", "") ;
}

in the StartTurn function of the mission script.

You now can show your UI control. But how to get the button actions etc? You will need a script connected to the UI control. First add a line of the form

SCRIPT MyUIControlScript.bsf

to the root object of your UI control in the UI TXT file. Then create the bsf file in the same folder as your UI file. You will need to add a function called

FUNCTION UI_OBJ_HANDLE(data, event, id)

to catch button presses etc. You can check out the BSF files in the PLUGIN folder for examples on how to do so, but you will be using the IsUIObject function to determine the button pressed. You can also add a UI_OBJ_INIT function to the script if you wish, this is called when the UI object is loaded.

modding_ui_control.txt · Last modified: 2020/11/01 00:59 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license: Public Domain
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki