How did you get that to compile?
'Color' is a struct defined in the 'Object' class, rename your mutator.
In order to do so, export the package as .uc and then recompile it with "ucc.exe -make" after adding your package into the 'EditPackages=' lines in your UnrealTournament.ini
PD:
Have you tried setting bAlwaysRelevant=True, RemoteRole=ROLE_SimulatedProxy (in your mutator), then waiting for clients to automatically receive it with a PostNetBeginPlay() (must be a 'simulated' function) call?
That would avoid constantly creating an Inventory actor that consumes extra bandwidth everytime a client respawns and would save the client from an AllActors() iteration every second.
Also, if some other mod breaks the mutator chain, then have a timer run every second (simulated function as well) from the PostNetBeginPlay() event, you use to PostNetBeginPlay() event to locate the local player ( (PlayerPawn.Player != none) && (PlayerPawn.Player.IsA('ViewPort') ), store it, so you don't search every second.
Edit:
One more thing, calling RegisterHUDMutator might create an endless chain, instead of calling it on the timer, simply run a check through the local player's hud mutator chain
Code: Select all
local bool bResetHud;
bResetHud = true;
For ( H=LocalPlayer.myHud.HUDMutator ; H!=none ; H=H.nextHUDMutator )
{
if ( H==self ) //Assuming this function is called from the mutator itself clientside
{
bResetHud=false;
break;
}
}
if ( bResetHud )
{
nextHudMutator = LocalPlayer.myHud.HUDMutator;
LocalPlayer.myHud.HUDMutator = self;
bHudMutator = true;
}
This one seems like a safer Hud registration method that takes other programmer's blunders into account, besides, it's safe to be call it multiple times.
Edit 2: If the mutator isn't sent to client if you use my method, then subclass 'Actor' directly (bAlwaysRelevant=True, RemoteRole=ROLE_SimulatedProxy , bHidden=True) and make the server version of the mutator add it (NetMode != NM_Client).
That actor will be replicated, then you can use that one to spawn the Hud mutator once.
Edit 3: If you want to keep your method, then instead of running AllActors, simply do this:
Code: Select all
if ( (PlayerPawn(Owner) != none) && (PlayerPawn(Owner).Console != none) )
LocalPlayer = PlayerPawn(Owner);
Edit 4:
Lol, again.
Make sure that when your mutator runs PostRender( canvas), to call PostRender( canvas) on the nextHUDMutator if it exists, because that would otherwise break the HUD mutator render chain.
If you want your graphics to display on top, place the nextHudMutator.PostRender( canvas) at the beginning of your PostRender call.