• 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 unrecognized type SpriteWidget

mat69

Grizzled Veteran
Aug 1, 2006
826
0
OK I tried to do a simple (simple is not even simple enough ;) ) mutator for myself.
Yet I have problems in compiling it, the compiler finds an error in one of the classes.

"Unrecognized type 'SpriteWidget' within 'Hud'"

Code:
Class testainteraction extends Interaction;

var Hud.SpriteWidget       testasdf;

[...]

It doesn't recognise "SpriteWidget", but I have no clue - if that is totally newbish you might have an image what simple meant. Changing "Hud" to "HudBase" or "ROHud" does not work either.
 
hm, interactions arent really on the easy side imo ;)

also i think there are some misconceptions in your snippet :)
You cant declare variables of a type that is defined in another code file or package.

If i interprete what you try to do right you will have to extend the ROHud and overwrite the relevant function there. Not sure if you can replace the used HUD directly or if you have to create a new gametype to replace it.

If you would describe what you are trying to do, one could help you bette ;)
 
Upvote 0
I want to add an a texutre on the HUD. I read that there are two ways to do that, one by creating a new HUD yourself and the other by spawning a widget (or how it is called, right now I have no connection to my pc). On the unreal wiki someone said that it should be easiest the way I do it.

Interesting is though that the same code can be compiled for UT2K4.
When I'm at home with some spare time I'll post some more code.
 
Upvote 0
Ok, back home:

Code:
Class testainteraction extends Interaction;
#exec OBJ LOAD FILE=..\Textures\testasdf.utx

var GameReplicationInfo GRI;
var HudBase.SpriteWidget       testasdf; //worked in UT2k4

event Initialized()
{
    //log("Interaction Initialized");
    foreach ViewportOwner.Actor.DynamicActors(class'GameReplicationInfo', GRI)
        If (GRI != None)
            Break;
}



function PostRender( canvas Canvas )
{

HudBase(ViewportOwner.Actor.myHUD).DrawSpriteWidget(Canvas, testasdf); //only HudBase worked in UT2k4

}
[...]

That's what I have, I'll look into creating an own hud (should I extend ROHud?), maybe that will work.
Thanks for your reply!
 
Upvote 0