Go ![]() | New ![]() | Find ![]() | Notify ![]() | Tools ![]() | Reply ![]() | |
| Peregrine |
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. | ||
|
| Treasurer |
Tell you what, dude; second best: I'll help you do it. Do you have any code handy, or are you starting from scratch? | |||
|
| Peregrine |
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 | |||
|
| Peregrine |
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; } } | |||
|
| Treasurer |
Originally posted by Druid: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). | |||
|
| Peregrine |
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; } | |||
|
| Treasurer |
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. | |||
|
| Peregrine |
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; } } } } | |||
|
| Peregrine |
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? | |||
|
| Treasurer |
Notice the following from RuneHUD: Either switch out thePlayer.ScoringType with your own; or use, say, ModifyPlayer() in the mutator class to modify the player-pawn's ScoringType. | |||
|
| Peregrine |
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 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. | |||
|
Peregrine![]() |
hey druid sounds great | |||
|
| Peregrine |
It's more or less done, but i dont know how heavy it is to run :/ Also the scoreboards (DM+TDM) are done | |||
|
Peregrine![]() |
quote: | |||
|
| Peregrine |
I have to properly test it still. I saw one small flaw in it today | |||
|
| Peregrine |
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 | |||
|
| Powered by Social Strata |
| Please Wait. Your request is being processed... |
|
© Low Caliber Club 2002-4


