Could be asleep, typing random messages instead.

How to get player's current armor count if HUD is glitchy?

For gameplay advice and broader discussion of single-player Unreal including custom maps, mods and mutations that alter the game.

Moderators: Semfry, ividyon

NaPaliShore
Skaarj Warrior Skaarj Warrior
Posts: 78
Joined: 25 Nov 2011, 02:05

Subject: How to get player's current armor count if HUD is glitchy?

Post Posted: 20 Jul 2013, 07:07

Hello,

I have been experimenting with some mutators on a private Coop listen server (in UT using either OldSkool.CoopGame2 or Unrealshare.coopgame with Mr. Loathsomes new UT2U1.UT2U1 mutator) that I play on with just one friend of mine. And we have noticed that sometimes his HUD will stop updating properly to show his latest/current total armor score. For example, he might pick up some armor and no armor score gets displayed in the corner. Or it might show the wrong total for the armor score. (I am the host of the coop game, and he joins the game as a client.) So we were wondering if that info (of the current combined total armor score for a given player) might be stored in a variable that he could retrieve using the GET command in the console?

For example, I can type in the console, "get playerpawn health", and it will return a value of 100 (being the default starting health for players, I guess).

Is there some equivalent command that a player can type in to get their own current armor score (that is, how much more damage all of his various forms of armor can take before he will have no armor left)? Or if not, can he at least retrieve his individual shieldbelt/armor/vest scores, for different categories of armor? (I think there used to be some similar functionality available in UTPure via the "TeamSay" command, using certain variables likes %A for Armor, %H for health, etc. But unfortunately I can't seem to get UTPure working on my machine.)

If there is such a command/variable, then can similar commands/variables be used to retrieve the player's current health, amount of ammo for each gun, amount of each inventory item carried, etc?

Is there a reference guide somewhere that we could consult in order to make a chart of these commands, in order to look up various values, at those moments when the HUD no longer displays them reliably? If not then I guess we'll need to try and figure out what combination of factors is causing his HUD to malfunction, but neither of us is very knowedgable about these matters so I'm not too optimistic that we'd resolve them on our own.

Thanks in advance to anyone who can suggest a quick way to lookup these armor/health etc values for a given player in a coop game that is in progress!

User avatar []KAOS[]Casey
Skaarj Berserker Skaarj Berserker
Posts: 426
Joined: 25 Sep 2008, 07:25

Subject: Re: How to get player's current armor count if HUD is glitchy?

Post Posted: 29 Jul 2013, 06:19

There is no command, you must manually calculate it.

Code: Select all

local Pawn P;
local Inventory inv;
local int ArmorAmount;

for(P = Level.Pawnlist; P!=None; P=P.NextPawn)
{
   if(!P.bIsPlayer)//skip non players. This can also get bot inventory;
      continue;
      
   for( Inv=P.Inventory; Inv!=None; Inv=Inv.Inventory )
   {
      if (Inv.bIsAnArmor)
      {
         ArmorAmount += Inv.Charge;            
      }
   }
   log("Pawn "$P$" Armor = "$ArmorAmount);
}


Code not tested, but should compile.
Last edited by []KAOS[]Casey on 29 Jul 2013, 19:37, edited 1 time in total.

redeye
Banned Banned
Posts: 1393
Joined: 08 Dec 2007, 06:55

Subject: Re: How to get player's current armor count if HUD is glitchy?

Post Posted: 29 Jul 2013, 07:57

Is what I need. (for MH)

like a MakeBotsHate certain class, trigger.
To direct bots
work perfect.

The mapper would need to be aware and be able to turn off the trigger and goto next pawn class with a different trigger..
Last edited by redeye on 29 Jul 2013, 20:28, edited 1 time in total.
Just ban everyone

NaPaliShore
Skaarj Warrior Skaarj Warrior
Posts: 78
Joined: 25 Nov 2011, 02:05

Subject: Re: How to get player's current armor count if HUD is glitchy?

Post Posted: 29 Jul 2013, 10:20

[]KAOS[]Casey wrote:There is no command, you must manually calculate it.

[spoiler]

Code: Select all

local Pawn P;
local Inventory inv;
local int ArmorAmount;

for(P = Level.Pawnlist; P!=None; P=P.NextPawn)
{
   if(!P.bIsPlayer)//skip non players. This can also get bot inventory;
      continue;
      
   for( Inv=P.Inventory; Inv!=None; Inv=Inv.Inventory )
   {
      if (Inv.bIsAnArmor)
      {
         ArmorAmount += Inv.Charge;            
         if (Inv.Charge>0 && Inv.Icon!=None)
         {
            if (!bDrawOne)
            {
               DrawHudIcon(Canvas, Canvas.CurX, Y, Inv);
               DrawIconValue(Canvas, Inv.Charge);                  
            }
            else if (Inv.ArmorAbsorption>CurAbs)
            {
               CurAbs = Inv.ArmorAbsorption;
               BestArmor = Inv;
            }
         }
      }
   }
   log("Pawn "$P$" Armor = "$ArmorAmount);
}
[/spoiler]

Code not tested, but should compile.

Thanks very much, Casey, for taking the time to write this up for me.

I'm afraid I am such a newbie that I'm way over my head, and don't know even how to compile the code or how/where to "use" it - e.g. would I need to go into the editor and put the code into each map I want to play? Or does it get turned into something like a mutator?

All I really know at the moment is how to use various console commands and how to combine a few of them into exec files. I'm sure this will sound humorously naive to those in the know, but I tried pasting the code into an exec file, running it from the console during a game, and then typing "get armoramount" in the console, and of course that did not work. So obviously I have no idea what I am doing.

Given how little I know, I'm not sure if it is worth the time it would take to teach me how to use this code that you have generously provided. So unless it is fairly simple and would not take long to type in a short list of instructions for me to follow, I would not want to take up too much of your valuable time on this and would just like to thank you for the help and the time you have already put in. :)

medor
Skaarj Lord Skaarj Lord
Posts: 171
Joined: 07 Jun 2009, 22:58

Subject: Re: How to get player's current armor count if HUD is glitchy?

Post Posted: 29 Jul 2013, 17:50

Weaponsc, Ammo, Thigpads, Armor , 5HP+25HP 29.5 Sec
99HP, Belt 57-60 Sec
DDamage 2 Minute
[url=https://www.gametracker.com/server_info/77.135.96.69:7777/][img]https://cache.gametracker.com/server_info/77.135.96.69:7777/b_350_20_692108_381007_ffffff_000000.png[/img][/url]

[url=https://www.gametracker.com/server_info/77.135.96.69:5555/][img]https://cache.gametracker.com/server_info/77.135.96.69:5555/b_350_20_692108_381007_ffffff_000000.png[/img][/url]

[url=https://www.gametracker.com/server_info/77.135.96.69:6777/][img]https://cache.gametracker.com/server_info/77.135.96.69:6777/b_350_20_692108_381007_ffffff_000000.png[/img][/url]

[url=https://www.gametracker.com/server_info/77.135.96.69:6666/][img]https://cache.gametracker.com/server_info/77.135.96.69:6666/b_350_20_692108_381007_ffffff_000000.png[/img][/url]

User avatar []KAOS[]Casey
Skaarj Berserker Skaarj Berserker
Posts: 426
Joined: 25 Sep 2008, 07:25

Subject: Re: How to get player's current armor count if HUD is glitchy?

Post Posted: 29 Jul 2013, 19:44

I re-read your post, and it sounds like you're experiencing an inventory chain bug. Are you running any mods for weapons or pickups?

If said mods are not in server packages, and he picks one up, it breaks the chain because his client doesn't know about said mod. This issue is really exacerbated in UT/U1 because when you get a new inventory item, it adds it to the front of the chain rather than the end, so if the first item in the inventory chain is broken, then the rest all break too. 227 fixes this, and some U1 gametypes fix it, but I don't think Loathsomes mutator does since it doesn't replace player pawns.

This is without mentioning that most people have never coded mods for a listen server properly, and I would not be surprised if things are broken just because of that. I'm guilty of not checking for listen a few times because it's so rarely used.

You could try running a dedicated server and both of you connecting that way.

NaPaliShore
Skaarj Warrior Skaarj Warrior
Posts: 78
Joined: 25 Nov 2011, 02:05

Subject: Re: How to get player's current armor count if HUD is glitchy?

Post Posted: 29 Jul 2013, 21:30

[]KAOS[]Casey wrote:I re-read your post, and it sounds like you're experiencing an inventory chain bug. Are you running any mods for weapons or pickups?
If said mods are not in server packages, and he picks one up, it breaks the chain because his client doesn't know about said mod. This issue is really exacerbated in UT/U1 because when you get a new inventory item, it adds it to the front of the chain rather than the end, so if the first item in the inventory chain is broken, then the rest all break too. 227 fixes this, and some U1 gametypes fix it, but I don't think Loathsomes mutator does since it doesn't replace player pawns.

This is without mentioning that most people have never coded mods for a listen server properly, and I would not be surprised if things are broken just because of that. I'm guilty of not checking for listen a few times because it's so rarely used.

You could try running a dedicated server and both of you connecting that way.

Thanks for those tips and suggestions! In the most recent case where we noticed the armor display glitch for the client player, we were playing through ShamuQuest on my listen server with Loathsome's UT2U1 mutator as the only mutator.

Normally when I am using a mod that introduces custom weapons (like the BetaStuff mutator), I do make sure that it is listed in my serverpackages, but I haven't put UT2U1 in my serverpackages, since the ReadMe for the mutator indicated that should not be necessary:

For servers add UT2U1.UT2U1 to your server startup line.

No need for uz file on redirect or a serverpackage line in your UT.ini file for either as both run serverside only.

And in this most recent playthrough of Shamuquest, we didn't use any other mods or mutators besides UT2U1.

However, it could be that something else I've been doing (without really understanding the consequences) might be causing some complications...
Here is the strange procedure I was doing:
The way I've been starting our coop session is to start a regular coop game (in Vortex2) in Oldskool (via the New Singleplayer Game menu in OldSkool, but NOT as a "dedicated" game, since I want it to be a Listen server) and then once the other player has joined the game I use SwitchCoopLevel to switch to the real map we want to play, while also changing the game type and adding Loathsome's mutator, with a command like:
switchcooplevel svalley2?Game=unrealshare.coopgame?Mutator=UT2U1.UT2U1

So I don't know what happens when you start a game in OldSkool and then rely on SwitchCoopLevel to "get rid of" OldSkool by changing the game type and adding Loathsome's mutator. Maybe we end up with a kind of weird hybrid game session that still has some elements of OldSkool but under the unrealshare.coopgame game type and with Loathsome's mutator overriding some of the functions.

So as an experiment I am thinking that maybe I should try disabling OldSkool on my install of UT, and then starting the game from the console directly with:
open svalley2?Game=unrealshare.coopgame?Listen?Mutator=UT2U1.UT2U1?
(I just recently figured out that I can add the "?Listen" argument, and that way I wouldn't need to first start a coop game through OldSkool in order to get my friend to be able to join the game - shows how ignorant I am. But I figured this out after we had finished playing ShamuQuest, and haven't really done much testing yet with doing it the "correct" way.)

I guess I could also try putting UT2U1 in my serverpackages, just in case that would make a difference.

And if neither of these "fixes" works then I will see if I can get two instances of UT running simultaneously on my somewhat old computer - to both run a dedicated server and also connect to it as a player - while still getting playable frame rates.

Thanks again for all of these suggestions! Once I get more powerful computer, I will probably try switching over to 227i (or by then it might be 227j) for most things, but for now I seem to get better frame rates running SP and coop games under UT.

NaPaliShore
Skaarj Warrior Skaarj Warrior
Posts: 78
Joined: 25 Nov 2011, 02:05

Subject: Re: How to get player's current armor count if HUD is glitchy?

Post Posted: 30 Jul 2013, 02:10

NaPaliShore wrote:...I am thinking that maybe I should try disabling OldSkool on my install of UT, and then starting the game from the console directly with:
open svalley2?Game=unrealshare.coopgame?Listen?Mutator=UT2U1.UT2U1?
(I just recently figured out that I can add the "?Listen" argument, and that way I wouldn't need to first start a coop game through OldSkool in order to get my friend to be able to join the game - shows how ignorant I am. But I figured this out after we had finished playing ShamuQuest, and haven't really done much testing yet with doing it the "correct" way.)

I guess I could also try putting UT2U1 in my serverpackages, just in case that would make a difference.

And if neither of these "fixes" works then I will see if I can get two instances of UT running simultaneously on my somewhat old computer - to both run a dedicated server and also connect to it as a player - while still getting playable frame rates.

Thanks again for all of these suggestions! Once I get more powerful computer, I will probably try switching over to 227i (or by then it might be 227j) for most things, but for now I seem to get better frame rates running SP and coop games under UT.

So I did some tests running two copies of UT at once on my computer, one as the "server" and the other as the "host" of a coop game. I tried setting both a listen server and a dedicated server, under both oldskool.coopgame2 and unrealshare.coopgame with the UT2U1 mutator, and then connected as a new player with the other copy of UT. With the listen server I noticed that the HUD would not properly display the inventory items for the "client" player, and would not show any armor when that player picked up an Assault Vest.

But the configuration that did fix these HUD display issues was when I set up a dedicated server, which I launched from a shortcut using the following line:
"C:\UnrealTournament\System\UnrealTournament.exe" Nyleve?Game=unrealshare.coopgame?Mutator=UT2U1.UT2U1 -server -alladmin

With the -alladmin flag, I could enter switchcooplevel commands from the console of the "client", which was great - since when I typed "servertravel" in the console for the dedicated server, it would not preserve the client's weapons and inventory through the level load.

The only downside was that I now get some version of the "skating player" glitch when connecting as a client to the dedicated server - where I'm fine unless I invoke either the "ghost" or "fly" cheat, but after doing ghost/fly I am unable to properly return to "walk" mode... I get stuck in a sort of ghost/fly mode where my toes are dragging on/in the surface of the floor (and I seem to be immune to attacks/projectiles) untill either a new level load or until I type "suicide" in the console and respawn in the game. I tried downloading and installing the "normal"/stock UT texture masterfiles from UnrealTexture.com in the UT install that I was using to host the dedicated server, but that did not resolve the problem.

So at least I have some options now - I can play with a listen server, where the "host" player can still ghost/fly around but the second/client player has a messed up HUD and can't ghost/fly, or I can play with a dedicated server, where the HUD displays properly for both players but neither can ghost/fly properly. So this is progress! I guess the skating player/ghost-fly bug issues is just the price I pay for using the nice S3TC hi-res textures...

p.s.: adding UT2U1 to my serverpackages had no effect on the HUD issues for the client player, on a Listen server...

xRedStar
Skaarj Assassin Skaarj Assassin
Posts: 122
Joined: 13 Jan 2013, 18:56

Subject: Re: How to get player's current armor count if HUD is glitchy?

Post Posted: 02 Aug 2013, 20:39

Some game types like JcoopZ will replace the PlayerPawn with it's own. Like JZPlayerPawn for example, so it is always that very small possibility that you'll have to think about. They also can specify how much health the Player Pawn may default to, so that is another one. But it is also possible that JCoopZ fixes the glitch...

But anyways, if you ever decide to program... all I have to say is... mostly everything you want to work with that is in other classes. In this case, you're working in a mutator... but gathering data from other classes like inventory and playerpawn. You've got to store everything in variables... hint. local Inventory inv;

This gives you the ability to access inventory's variables, functions, events... like this.... inv.health = 1000; or inv.default.health = 1000; But if you can learn that, you'll probably get the hang of everything much easier.

xRedStar
Skaarj Assassin Skaarj Assassin
Posts: 122
Joined: 13 Jan 2013, 18:56

Subject: Re: How to get player's current armor count if HUD is glitchy?

Post Posted: 02 Aug 2013, 20:53

[]KAOS[]Casey wrote:There is no command, you must manually calculate it.

Code: Select all

local Pawn P;
local Inventory inv;
local int ArmorAmount;

for(P = Level.Pawnlist; P!=None; P=P.NextPawn)
{
   if(!P.bIsPlayer)//skip non players. This can also get bot inventory;
      continue;
      
   for( Inv=P.Inventory; Inv!=None; Inv=Inv.Inventory )
   {
      if (Inv.bIsAnArmor)
      {
         ArmorAmount += Inv.Charge;            
      }
   }
   log("Pawn "$P$" Armor = "$ArmorAmount);
}


Code not tested, but should compile.


is it possible to get health or armor from a specific player id... or is that not available with standard coop?

NaPaliShore
Skaarj Warrior Skaarj Warrior
Posts: 78
Joined: 25 Nov 2011, 02:05

Subject: Re: How to get player's current armor count if HUD is glitchy?

Post Posted: 03 Aug 2013, 04:50

xRedStar wrote:Some game types like JcoopZ will replace the PlayerPawn with it's own. Like JZPlayerPawn for example, so it is always that very small possibility that you'll have to think about. They also can specify how much health the Player Pawn may default to, so that is another one. But it is also possible that JCoopZ fixes the glitch...

But anyways, if you ever decide to program... all I have to say is... mostly everything you want to work with that is in other classes. In this case, you're working in a mutator... but gathering data from other classes like inventory and playerpawn. You've got to store everything in variables... hint. local Inventory inv;

This gives you the ability to access inventory's variables, functions, events... like this.... inv.health = 1000; or inv.default.health = 1000; But if you can learn that, you'll probably get the hang of everything much easier.

Thanks for those thoughts! But I was under the impression that JcoopZ only works with Unreal, not UT? Unfortunately my PC is rather old, and the last time I tried to play coop in Unreal 227 (version 227h) my framerates were hovering around 28-30 fps, which was a little slow for my liking. I find that I can pretty consistently get 60fps in Unreal Tournament with OldSkool (or with the unrealshare.coopgame game type combined with Mr. Loathsome's UT2U1 mutator), so I do most of my coop gaming on UT. Eventually, once I save up enough to get a new computer, I'll probably try to transition over to running Unreal 227i with JcoopZ for coop gaming. But for now I think I'm stuck with UT (unless 227i would somehow be less taxing for an old system than 227h, and would get higher frame rates?)...

As for programming/coding for Unreal, I don't think I'll ever make it - just don't have the background or knowledge to even know where/how to start... But I do enjoy messing around with already existing settings, console commands, mods, and mutators!

It may be that my friend and I will just need to start from a fresh/clean install of the game, to fix whatever got broken with the the HUD (possibly the inventory chain)... When we get some more free time, we might try reinstalling from scratch to see if that will fix the problem. (After a brief stretch where the HUD issues seemed to be fixed when I set up a dedicated server, I'm back to where the HUD glitches now show up in both the dedicated coop server and the listen server, so that's a drag...)

NaPaliShore
Skaarj Warrior Skaarj Warrior
Posts: 78
Joined: 25 Nov 2011, 02:05

Subject: Re: How to get player's current armor count if HUD is glitchy?

Post Posted: 03 Aug 2013, 04:58

medor wrote:Weaponsc, Ammo, Thigpads, Armor , 5HP+25HP 29.5 Sec
99HP, Belt 57-60 Sec
DDamage 2 Minute

Sorry, I don't really understand this. Are you saying that even if I did figure out how the coding would work to calculate these stats in real time, it would take 2-3 minutes to generate a report of all the stats? What I don't understand is, in the hud a number is displayed in the corner, for the total armor count for the player. Since that number is being displayed, doesn't it need to exist somewhere as a variable? Or is it just a calculated field? I understand so little that it's probably not worth worrying about, since I may never understand how it works...

medor
Skaarj Lord Skaarj Lord
Posts: 171
Joined: 07 Jun 2009, 22:58

Subject: Re: How to get player's current armor count if HUD is glitchy?

Post Posted: 03 Aug 2013, 08:19

sorry it's just a translation error
I did not understand the meaning of the question
[url=https://www.gametracker.com/server_info/77.135.96.69:7777/][img]https://cache.gametracker.com/server_info/77.135.96.69:7777/b_350_20_692108_381007_ffffff_000000.png[/img][/url]

[url=https://www.gametracker.com/server_info/77.135.96.69:5555/][img]https://cache.gametracker.com/server_info/77.135.96.69:5555/b_350_20_692108_381007_ffffff_000000.png[/img][/url]

[url=https://www.gametracker.com/server_info/77.135.96.69:6777/][img]https://cache.gametracker.com/server_info/77.135.96.69:6777/b_350_20_692108_381007_ffffff_000000.png[/img][/url]

[url=https://www.gametracker.com/server_info/77.135.96.69:6666/][img]https://cache.gametracker.com/server_info/77.135.96.69:6666/b_350_20_692108_381007_ffffff_000000.png[/img][/url]


Who is online

Users browsing this forum: No registered users and 41 guests

Copyright © 2001-2024 UnrealSP.org

Powered by phpBB® Forum Software © phpBB Limited