Code: Select all
for (HM = P.myHUD.HUDMutator; HM != None; HM = HM.NextHUDMutator)
{
... do stuff with HUDMutators
}
Code: Select all
foreach P.ChildActors(class'MyHUDMutator',HM)
{
... do stuff with my HUDMutator
}
Code: Select all
for (HM = P.myHUD.HUDMutator; HM != None; HM = HM.NextHUDMutator)
{
... do stuff with HUDMutators
}
Code: Select all
foreach P.ChildActors(class'MyHUDMutator',HM)
{
... do stuff with my HUDMutator
}
I've implemented a system to configure enhanced messages. To do this I've subclassed CriticalEventPlus. LocalMessages normally send information to the HUD, but I want to send the information to the HUDMutator instead. It's a bit hacky, but I can't think of any better ways.anth wrote:What kind of "stuff" are you trying to do with your HUDMutator? Can't you just store a reference to the HUDMutator somewhere rather than trying to find it in your other Actor (I assume that you are trying to find it while executing your other Actor's Tick function, that would indeed hide the HUDMutator from the other Actor).
Code: Select all
class BTME_LocalMessage extends CriticalEventPlus;
static function ClientReceive(PlayerPawn P,
optional int Switch,
optional PlayerReplicationInfo RelatedPRI_1,
optional PlayerReplicationInfo RelatedPRI_2,
optional Object OptionalObject)
{
local Mutator HM;
/* Send BTME_LocalMessages to the BTME_HUDMutator instead of the HUD */
if ( P.myHUD != None )
{
for (HM = P.myHUD.HUDMutator; HM != None; HM = HM.NextHUDMutator)
{
if(HM.IsA('BTME_HUDMutator'))
{
BTME_HUDMutator(HM).LocalizedMessage( Default.Class, Switch, RelatedPRI_1, RelatedPRI_2, OptionalObject );
break;
}
}
}
// other stuff
}
Code: Select all
class BTME_HUDMutator extends Mutator;
simulated function PostBeginPlay()
{
Super.PostBeginPlay();
SetTimer(1.0,true);
}
simulated function Timer()
{
// other stuff
ForceMutatorOrder();
Super.Timer();
}
simulated function ForceMutatorOrder()
{
local Mutator HM, PrevHM;
if (MyHUD==None || MyHUD.HUDMutator==self) return;
for(HM=MyHUD.HUDMutator; HM!=None && HM!=self; HM=HM.NextHUDMutator) PrevHM=HM;
if(HM==self) PrevHM.NextHUDMutator = NextHUDMutator;
self.NextHUDMutator = MyHUD.HUDMutator;
MyHUD.HUDMutator = self;
SetTimer(0.0,false);
}
It's just silly that UTPure changes the HUD and even cripples the HUDMutator-list. So keeping things compatible is never actually trivial in my opinion. I'm registering the HUDMutator using a SpawnNotifyer. This works and the PostRender-function is also executed on the client as expected.anth wrote:It can indeed be frustrating to make Rendering related mods work with Pure, especially if you don't do it right from the first time. If you're used to working with Pure however, keeping your code compatible with it is trivial. The idea is that you cannot execute rendering or input related code on the client side _unless_ it is authorized by the server. For example: you cannot spawn a hudmutator using a modmenu mod but you _can_ spawn a hudmutator on the server and register it using a replicated function.