• Please make sure you are familiar with the forum rules. You can find them here: https://forums.tripwireinteractive.com/index.php?threads/forum-rules.2334636/

Code Repurposing HUDs

Evening,

I have most of my hud changes done, but I am struggling with one last piece.

There is a class called ROUISceneAfterActionReport which displays things like the 'round start screen' which displays the gametype name boldly in the middle of the screen above the round start countdown timer.

I need to change some strings on this hud including the gametype name.

Now, I can extend this class so I have a class called FTUISceneAfterActionReport and when I create my int file, it indeed has a section called [FTUISceneAfterActionReport] where I can change the strings as required.

I then searched the RO scripts for classes that would call ROUISceneAfterActionReport. There are a number of calls in ROPlayerController to that class.

I already have my custom PlayerController extended from ROPlayerController and it does get called.

So I took the functions from ROPlayerController that called the class I am overriding and stuffed them into my custom PlayerControllerClass.

I have then tried casting ROUISceneAfterActionReport to FTUISceneAfterActionReport where it's used, but the hud does not display.

In the function ClientShowRoundStartScreen immediately after I try and call OpenScene, I get the following error in my logs:
Code:
[0030.18] Warning: InsertScene called with NULL Scene!

I am wondering if this is something to do with the following line in ROPlayerController DefaultProperties:
Code:
AfterActionReportSceneTemplate=ROUISceneAfterActionReport'ROGameMenus.InGame.ROUIScene_AAR'

I know i'm being thick :eek:
 
Last edited:
Did you create an instance of FTUISceneAfterActionReport? Or are you only casting the ROUISceneAfterActionReport object to FTUISceneAfterActionReport? If the last, then it won't work. You need to make an instance first. Next swap all references to ROUISceneAfterActionReport to your instance of FTUISceneAfterActionReport.
 
Upvote 0
Well you were right that I had not created a new instance of my class.

So I have done that (assuming ive have done that correctly), but the scene is still not getting shown:

Code:
reliable client function ClientShowRoundStartScreen(int TimeDelay)
{
	local UIScene TempScene;

	FTAfterActionReportSceneTemplate = new class'FTUISceneAfterActionReport';

	WorldInfo.GRI.RemainingMinute = TimeDelay;
	WorldInfo.GRI.RemainingTime = TimeDelay;

	ROHUD(MyHUD).HideAllHUDWidgetsTemporarily();


	`Log(">>> DEBUG : ClientShowRoundStartScreen 1", , 'FTPlayerController');

	if ( CurrentAfterActionReportScene != none )
	{
		LocalPlayer(Player).ViewportClient.UIController.SceneClient.CloseScene(CurrentAfterActionReportScene);
		CurrentAfterActionReportScene = none;
	}

	// If we have a Template
	if ( FTAfterActionReportSceneTemplate != none )
	{
		// Open the After Action Report Scene
		LocalPlayer(Player).ViewportClient.UIController.SceneClient.OpenScene(FTAfterActionReportSceneTemplate, , TempScene);
		CurrentAfterActionReportScene = FTUISceneAfterActionReport(TempScene);

		CurrentAfterActionReportScene.ShowRoundStartScreen();
		ClientIgnoreChangingSeatsInput(true);
		ClientIgnoreChangingPositionsInput(true);
	}
}

I think ive been looking at this too long - ive gone cross eyed lol
 
Upvote 0
You probably will need to copy some values of properties from the original instance to your derived instance too.

My advice is to add some extra debug lines in the conditional blocks to see how the flow is. If your instance is for some reason not created, then you won't know without debug info within this block:
Code:
if ( FTAfterActionReportSceneTemplate != none )

Next add some log line into the ShowRoundStartScreen function of your FTUISceneAfterActionReport class. It should appear in the clients log file.

One remark (which has nothing to do with your problem). I suggest not to throw away the old object without knowing that yours is created.
 
Upvote 0
I am now trying to create my class like this in FTPlayerController.ClientShowRoundStartScreen

Code:
FTAfterActionReportSceneTemplate = new class'FTUISceneAfterActionReport';

But when I should see the round start screen/countdown timer, the screen just has no hud and the game does not start.

So I changed it to this:
Code:
FTAfterActionReportSceneTemplate = new class'FTUISceneAfterActionReport';
FTAfterActionReportSceneTemplate=FTUISceneAfterActionReport'ROGameMenus.InGame.ROUIScene_AAR';

Upon compiling, I get an unresolved ref error to the 2nd line but the game does start, but again I get no hud (because of that error).

ROGameMenus.InGame.ROUIScene_AAR a hud element inside one of the game packages which you can see inside the sdk, but in the content browser it has 'ROUISceneAfterActionReport' on it.
 
Last edited:
Upvote 0
This line:

Code:
FTAfterActionReportSceneTemplate=FTUISceneAfterActionReport'ROGameMenus.InGame.ROUIScene_AAR';

Will overwrite this line:

Code:
FTAfterActionReportSceneTemplate = new class'FTUISceneAfterActionReport';

As a result your instance will be inaccessable (cos you lost the ference).

After the new command your object will have all properties set to the defaults. What you still need to do is copy them from the old object to your object or else some vital connections within your object will not be set.
 
Upvote 0
The problem for me seems to be that I simply can not instantiate my FTUISceneAfterActionReport with the required UIScene 'ROGameMenus.InGame.ROUIScene_AAR'

There is a line in the ROPlayerController defaultprops that does exactly this for the class I am extending:
Code:
AfterActionReportSceneTemplate=ROUISceneAfterActionReport'ROGameMenus.InGame.ROUIScene_AAR'

But if I try to add a similar line into my FTPlayerController defaulprops, the compiler throws a wobbly.

All this just to change two strings on the hud! :p

Good way to spend a day off lol
 
Upvote 0
If you only want to change two lines of text, then why not do it the easy way?
As example:
Code:
foreach self.WorldInfo.AllControllers(class'ROPlayerController', contr)
{
    contr.CurrentAfterActionReportScene.TETitleString = "my TE text";
    contr.CurrentAfterActionReportScene.FFTitleString = "my FF text";
}

That was one of the first things I tried, but you can't assign a value to a const (localized string).
 
Upvote 0