Low Caliber Club
Low Caliber Club
    Low Caliber Forum  Hop To Forum Categories  Work in Progress    How to make HUD?

Moderators: Impaler, Mr_Fister
Go
New
Find
Notify
Tools
Reply
  
How to make HUD?
 Login/Join
 
Peregrine
posted
So... I dont seem to get any HUD I make to work in dedicated servers. Can someone paste a mutator that would write "Hello world" to all players? I would be eternally grateful.
 
Posts: 83 | Registered: Sun June 22 2003Reply With QuoteReport This Post
Treasurer
Picture of Unter den Uebrigen
posted Hide Post
Tell you what, dude; second best: I'll help you do it.  Do you have any code handy, or are you starting from scratch?
 
Posts: 1457 | Location: Altadena | Registered: Tue January 07 2003Reply With QuoteReport This Post
Peregrine
posted Hide Post
Ok, my situation is this:

I ripped some of MOTDcolors code so I can get functional HUD. I have made a replication like this:

class BMReplicationInfo expands ReplicationInfo;

Var int BMSavePlayerNumber;
Var string BMSavePlayerpassword;
Var bool PWGOOD;
Var bool HUDUP;
Var string PlayerName;

replication
{
unreliable if(Role == ROLE_Authority)
BMSavePlayerNumber,BMSavePlayerpassword,PWGOOD,PlayerName,HUDUP;
}

I have HUD from MOTDcolor, but I cant make it "interactive". I change values for the replication and they work fine in the actual functional mutator (BMadmin).

In "class BMInfo expands Mutator;" I have codes like this:

simulated event PostRender( canvas Canvas )
{
if (!PWGOOD)
{
DrawSomething(Canvas);
}
else DrawSomethingElse(Canvas);

if( nextHUDMutator != None )
nextHUDMutator.PostRender( Canvas );
}

simulated Function BMReplicationInfo GetBMReplicationInfo(pawn pawn)
{
local BMReplicationInfo VasRInfo, temp;
local int I;
for (i=0; i<ArrayCount(REPLINFO2); i++)
REPLINFO2[i] = None;
temp = none;
i=0;
foreach AllActors(class'BMReplicationInfo', VasRInfo)
{
REPLINFO2[i] = VasRInfo;
i +=1;
If (VasRInfo.owner == pawn)
{
temp = VasRInfo;
}
}

return temp;
}

simulated function Timer()
{
If (!foundREPL)
{
If (getBMReplicationInfo(pawn(Owner)) != NONE)
{
REPLINFO = getBMReplicationInfo(pawn(Owner));
foundREPL=true;
}
}

If (foundREPL)
{
HUDUP=REPLINFO.HUDUP;
PWGOOD = REPLINFO.PWGOOD;
}
}

simulated function Tick(float DeltaTime)
{
Super.Tick(DeltaTime);
If (!init)
nultime +=1;
If (nultime >= 10)
{
nultime =0;
RegisterHUDMutator();
}
}

What this does is that DrawSomething is done, but when I change variable PWGOOD=true elsewhere DrawSomethingElse wont come up. Im hopeless
 
Posts: 83 | Registered: Sun June 22 2003Reply With QuoteReport This Post
Peregrine
posted Hide Post
I have lot of other code in there like in BMInfo:
simulated function RegisterHUDMutator()

in BMReplicationInfo:
function PostBeginPlay ()
{ SetTimer(1.0, true); }
function Timer ()
{
local PlayerReplicationInfo PRI;
If (owner == none)
{
self.destroy();
return;
}
}
 
Posts: 83 | Registered: Sun June 22 2003Reply With QuoteReport This Post
Treasurer
Picture of Unter den Uebrigen
posted Hide Post
Originally posted by Druid:
What this does is that DrawSomething is done, but when I change variable PWGOOD=true elsewhere DrawSomethingElse wont come up.
Render functions are in separate sand boxes from other simulated functions; variable changes within the chain of render functions will stick, but outside they won't be replicated.  Try changing the variable within the render chain and see what happens (i.e. within PostRender and not Timer).
 
Posts: 1457 | Location: Altadena | Registered: Tue January 07 2003Reply With QuoteReport This Post
Peregrine
posted Hide Post
Got all to work but one thing. I call the function below from a funtion that is called from postrender (i.e. this is called from postrender). This dont seem to work when on dedicated server. How can I "bypass" this? It is a functionality to see list of all players and their PlayerIDs. All other things work fine, but this is the reason I decided to make this "GUI" so its quite important I get it to work.

simulated function DrawList(canvas canvas, float ypos, float xpos, float yl)
{
local Pawn PawnList;

for(PawnList = Level.PawnList; PawnList != None; PawnList=PawnList.NextPawn)
{
if(PawnList.bIsPlayer)
{
canvas.setpos(xpos, ypos);
canvas.drawText(PawnList.PlayerReplicationInfo.PlayerID$") "$PawnList.PlayerReplicationInfo.PlayerName);
ypos -= yl;
}
}
}

I tried this but it didnt help:
replication
{
unreliable if(Role < ROLE_Authority)
DrawList;
}
 
Posts: 83 | Registered: Sun June 22 2003Reply With QuoteReport This Post
Treasurer
Picture of Unter den Uebrigen
posted Hide Post
Level.PawnList isn't replicated inside render functions; you have to populate a list yourself using AllActors (which can be resource consuming).  The trick is: populate your list at a significant event (login, logoout), and not on each render.

PS. You'll notice that the scoreboard accesses a list of PlayerReplicationInfo's; those are replicated.  If PlayerReplicationInfo is all you need, use that instead.
 
Posts: 1457 | Location: Altadena | Registered: Tue January 07 2003Reply With QuoteReport This Post
Peregrine
posted Hide Post
Don't read this, read the post below
--- obsolete ---
I get million "access non"s when doing this:

simulated function DrawList( canvas Canvas, float ypos, float xpos, float yl )
{
local PlayerReplicationInfo PRI;
local int PlayerCount, I;

for (i=0; i<32; i++)
{
if (PlayerPawn(Owner).GameReplicationInfo.PRIArray[i] != None)
{
PRI = PlayerPawn(Owner).GameReplicationInfo.PRIArray[i];
if ( !PRI.bIsSpectator || PRI.bWaitingPlayer )
{
canvas.setpos(xpos, ypos);
canvas.drawText(PRI.PlayerID$") "$PRI.PlayerName);
ypos -= yl;
}
}
}
}

 
Posts: 83 | Registered: Sun June 22 2003Reply With QuoteReport This Post
Peregrine
posted Hide Post
Ok, dont mind that upper post. I should be awarded of stupidity. I had left the
unreliable if... drawList in there so the server tried to replicate it.

The code works fine, thanks for pointing me to the Scoreboard direction.

Now that I'm on fire, is it possible to change the scoreboard via mutator, not defining a new gametype? If so, how to tell the game to use the new scoreboard?
 
Posts: 83 | Registered: Sun June 22 2003Reply With QuoteReport This Post
Treasurer
Picture of Unter den Uebrigen
posted Hide Post
Notice the following from RuneHUD:
if ( thePlayer.bShowScores )
{
	if ( (thePlayer.Scoring == None) && (thePlayer.ScoringType != None) )
		thePlayer.Scoring = Spawn(thePlayer.ScoringType, thePlayer);
	if ( thePlayer.Scoring != None )
	{ 
		thePlayer.Scoring.ShowScores(Canvas);
		return;
	}
}
Either switch out thePlayer.ScoringType with your own; or use, say, ModifyPlayer() in the mutator class to modify the player-pawn's ScoringType.
 
Posts: 1457 | Location: Altadena | Registered: Tue January 07 2003Reply With QuoteReport This Post
Peregrine
posted Hide Post
Just realized that if making a hud, it means people have to download it when entering. And since it has so much admin functionality and it's my first mutator, I fear I left some loophole in there. So making HUD was only a good training for making scoreboard Smile. I probably strip the hud part off and make a separate scoreboard which has PalyerIDs displayed too, and server rules on the footer. I then add kick and ban functions this:
kickid # MOTDline#
so people know why hey are being kicked. I already have an "alive" counter in my player relication class that is toggled with a variable change, resulting counter == 0 --> kick. Now I use it to give players 10s time to enter password for a player witha protected name.

Just clearing my thoughs.
 
Posts: 83 | Registered: Sun June 22 2003Reply With QuoteReport This Post
Peregrine
Picture of ReaperCreeper
AIM: Online Status For ReaperCreeper379
posted Hide Post
hey druid sounds great Thumbs Up when your done with it and it works properly mine putting it up for download on here? Big Grin

Beer Beer Beer
 
Posts: 257 | Location: Wilkes-Barre,Pennsylvania | Registered: Fri August 29 2003Reply With QuoteReport This Post
Peregrine
posted Hide Post
It's more or less done, but i dont know how heavy it is to run :/

Also the scoreboards (DM+TDM) are done
 
Posts: 83 | Registered: Sun June 22 2003Reply With QuoteReport This Post
Peregrine
Picture of ReaperCreeper
AIM: Online Status For ReaperCreeper379
posted Hide Post
quote:
Originally posted by ReaperCreeper:
hey druid sounds great Thumbs Up when your done with it and it works properly mine putting it up for download on here? Big Grin

Beer Beer Beer
 
Posts: 257 | Location: Wilkes-Barre,Pennsylvania | Registered: Fri August 29 2003Reply With QuoteReport This Post
Peregrine
posted Hide Post
I have to properly test it still. I saw one small flaw in it today
 
Posts: 83 | Registered: Sun June 22 2003Reply With QuoteReport This Post
Peregrine
posted Hide Post
My work is done now. i asked SecretLabs permission to publish BMadmin and if I get permission, i will send it to you. But I kinda want to keep it "limited" so I dont want it to end up to any web page, not yet at least. I also asked the same for "Critters Kicker +", and that has extra feature of force teamchange. That can be published Smile
 
Posts: 83 | Registered: Sun June 22 2003Reply With QuoteReport This Post
  Powered by Social Strata  
 

    Low Caliber Forum  Hop To Forum Categories  Work in Progress    How to make HUD?

© Low Caliber Club 2002-4
Gallery | Chat | Archive | Tutorials | Red Carpet

Constitution

Members

Forum

Stats

Wiki