PDA

View Full Version : TUTORIAL: How to change the scoreboard



BattleMode
11-29-2007, 06:24 PM
This may be asking much, but the community could really use even a single page walkthrough of modifying the scoreboards as you did with BattleMod. Good stuff, though, and we'll see how Epic fixes UI handling later on. I will try to do that.

BattleMOD can be found here: http://www.onsrpg.com/ut3mods.php all source code is included a screenshot is there as well. One of the things it does is change the scoreboard to add PPH. I will try to make a step by step on how to do this with probably a few tiny mistakes.

First it is necessary to understand how the PPH gets on the screen.
- A player has a HUD
- The HUD contains a UI Scene
- The UI Scene refers to the scoreboard class
- The scoreboard class puts the text on the screen

So to get the PPH to the screen all those things have to be changed.

STEP 1
First you need to uncook UI_Scenes_Scoreboards.upk with the UT3 editor since this one contains the 5 (!) UI Scenes which need to be changed. Instructions on how to uncook can be found here: http://utforums.epicgames.com/showthread.php?t=585462

STEP 2
I copied the entire uncooked UI_Scenes_Scoreboards.upk and named it UI_Scenes_Scoreboards_BM.upk. Each UI Scene contains multiple panels. E.g. a VCTF UI Scene has a panel for RED and a panel for BLUE players. The panels refer to the scoreboard classes.

STEP 3
You need to create the custom scoreboard panels (e.g. BattleCTFScoreboardPanel as derived from UTCTFScoreboardPanel), compile them and publish them (unpublished doesn't work) BEFORE you start editing the UI_Scenes_Scoreboards_BM.upk. Otherwise you will refer to a non existing class which will make the UT3 Editor crash. You learn to save often very quickly. See my mod for the exact source code for the panels.

STEP 4
The simplest way to change the class the panel refers to is to copy the panel to the clipboard, paste in into notepad, replace the class, delete the original panel, copy the notepad version to the clipboard and paste it back into the UT3 Editor. It's a tad tricky to get the new panel to the exact same position the old one came from. I did this by copying the coordinates to the clipboard before I removed the old one and pasting them back for the new one. You will need to try this to completely understand. An example replacement is to replace UTCTFScoreboardPanel with BattleCTFScoreboardPanel (just like there are multiple UI Scenes there are also multiple scoreboard panels).

STEP 5
Now you need to make custom HUDs refering to the custom UI Scenes. Like BattleCTFHUD derived from UTCTFHUD containing a property like ScoreboardSceneTemplate=Scoreboard_CTF'UI_Scenes_S coreboards_BM.sbCTF' to make it refer to the new scoreboard. Just like you needed a bunch of scoreboard panels and a bunch of UI Scenes, you need a bunch of HUDs.

STEP 6
Now you need to get the game to actually use the HUD. In the ModifyPlayer of the mutator you call things like PC.ClientSetHUD (Class'BattleOnslaughtHUD', Worldinfo.Game.Scoreboardtype); to replace the HUD. Again you need to do this for all those different HUDs for all different gametypes. For details see the source code.

You also need to call UTPC.LoadSettingsFromProfile (True); to make it all work properly, without that the HUD will do funny things. I am not entirely sure but I figure this properly initializes your brand new HUD. It was one of those try everything until it works things.

STEP 7
The funny thing is STEP 1 - STEP 6 only prepared for the real thing. Now you can start hacking nice things into your custom scoreboards (e.g. BattleCTFScoreboardPanel) to do things like adding PPH.

WARNING: There is a bug in UT3 (which I reported and Epic promised to fix: http://utforums.epicgames.com/showthread.php?p=25126917) which prevents proper usage of a autodownloaded custom UI Scene.

VerteX
11-29-2007, 10:07 PM
+1




(all i wanted to say, but it's not long enough)

Catalyst
11-30-2007, 04:28 AM
Thanks! If this had been around yesterday I wouldn't've have had to discover the same painful process myself ;).




STEP 1
First you need to uncook UI_Scenes_Scoreboards.upk with the UT3 editor since this one contains the 5 (!) UI Scenes which need to be changed. Instructions on how to uncook can be found here: http://utforums.epicgames.com/showthread.php?t=585462


I do not believe you have to uncook a package before you can copy components from the UIScene of it. I can quite happily open a cooked UIScene, select a single component, and copy it. I've been doing this from the safe panel component, which pulls all the subcomponents with it.




STEP 3
You need to create the custom scoreboard panels (e.g. BattleCTFScoreboardPanel as derived from UTCTFScoreboardPanel), compile them and publish them (unpublished doesn't work) BEFORE you start editing the UI_Scenes_Scoreboards_BM.upk. Otherwise you will refer to a non existing class which will make the UT3 Editor crash. You learn to save often very quickly. See my mod for the exact source code for the panels.


Are you using the UnrealFrontend to compile? If so, it doesn't pass the -useunpublished flag to "ut3 make" - I found that my code couldn't find the .upk package in unpublished for this reason, but when I added the command line flag in cmd.exe, it worked.

I've also found that abusing the Test defaultproperty can have disasterous results - having changed the number of players to -1, UEd crashed. I've managed to crash it several other times as well, but I guess this is one of those instances where saving often is your saviour ;). It's also worth noting that you have to save the *package*, not the UIScene itself (which you can't do individually).

Again, thanks for the tutorial, it's much appreciated!

BattleMode
11-30-2007, 09:46 AM
Thanks! If this had been around yesterday I wouldn't've have had to discover the same painful process myself ;). You're welcome.


I do not believe you have to uncook a package before you can copy components from the UIScene of it. I can quite happily open a cooked UIScene, select a single component, and copy it. I've been doing this from the safe panel component, which pulls all the subcomponents with it. I wanted (and needed) copies of the entire UI Scenes, not just of the panels inside the UI Scenes. So far I have not been able to find a way to transfer an entire UI Scene from one upk to another upk, so I decided to copy the entire upk instead (and therefore needed to uncook it). I have been able to export an entire UI Scene to some text file, but have not been able to find an import for entire UI Scenes, it's either not there or I have been looking in the wrong places.

BattleMode
12-08-2007, 03:15 AM
Is there some way to request a sticky for tutorials?

Taboen
12-14-2007, 11:09 AM
STEP 1
First you need to uncook UI_Scenes_Scoreboards.upk with the UT3 editor since this one contains the 5 (!) UI Scenes which need to be changed. Instructions on how to uncook can be found here: http://utforums.epicgames.com/showthread.php?t=585462

Open with UE editor right? And where do I find UI_Scenes_Scoreboards.upk?

agentq_71
12-15-2007, 09:30 AM
Is there some way to request a sticky for tutorials?
I have no idea, but this thread definitely should be stickied.

agentq_71
12-20-2007, 11:38 PM
I don't know why they made it such a bear to create custom scoreboards.

I think in most cases (mine included), a mod author just wants to subclass one of the stock UTScoreBoardPanels and draw custom scores onto the lower area of the existing UI_Scene. This is basically how it worked in all previous versions of UT.

I think that it's crazy that they've created this system where you have to make a copy of a whole package just to change some text that's written on the screen. Not only is it a lot more work for the mod author but it creates an unnecessary download for users connecting to servers running the mods.

Even if you look at the stock team gametypes, all of the UI_Scenes are freaking identical. In fact, most of the code in the corresponding UTScoreboardPanel classes is also identical!

The right way to do this would have been to provide a way to just derive a new class from the UTScoreboardPanel associated with the ScoreboardSceneTemplate that you select.

BattleMode
12-21-2007, 02:27 AM
I don't know why they made it such a bear to create custom scoreboards. I couldn't agree more. The biggest problem is not just how hard it is to change the scoreboard, but that you can not have multiple mutators running together which do that.

There should indeed be some chain of classes allowing you to add some simple text to the scoreboard. Preferably something that works with all 4 different ways it has to show information (took me some time to figure out how to show RPG levels no matter what mode the scoreboard was in, needed 15 methods to achieve it).

Lotus
12-21-2007, 10:25 AM
As an update to this article, you do NOT need to replace the hud in order to change the scoreboardclass.

You can simply create an intance of your scoreboard scoreboard and change the reference at runtime.

Here is example code where I replaced the tdm scoreboard:



if(PC.myHud.class == class'UTTeamHud')
{
UTHud(PC.myHud).ScoreBoardSceneTemplate = UTUIScene_Scoreboard(DynamicLoadObject("MyScoreboardPackage.MyScoreboardClass", class'UTUIScene_ScoreBoard'));
}


Where PC is the local playercontroller.

r1esG0
12-21-2007, 07:05 PM
hmm, i have been playing your mutator a lot on instant action and i didnt see the scoreboard change nor the mana indicator, i though i was broken, but the character gain more life with the levels

later i put a multipleyer lan with bots and a saw everithing,

are you working to make this mod usable in instant action? :)

BattleMode
12-21-2007, 07:23 PM
hmm, i have been playing your mutator a lot on instant action and i didnt see the scoreboard change nor the mana indicator, i though i was broken, but the character gain more life with the levels

later i put a multipleyer lan with bots and a saw everithing,

are you working to make this mod usable in instant action? :) It sounds like you are using BattleRPG P1, which does not support instant action. BattleRPG P2 supports instant action. You can find it at: http://www.onsrpg.com/ut3mods.php

genthly
10-30-2008, 12:40 AM
Hey, a bit offtopic maybe but it's hard to find an answer anywhere.
Maybe you know something about this.
I got multiple uiscene/huds (some are simple text an others are actual huds)
the problem is, when the texts show up, the hud is getting half-transparent,and when the text dissapear its going back to normal...

I hope somebody knows how to fix that, i'd be a verry happy man :D
*sorry for my poor english if i'm not clear enough ;)