InfinityScript HUD Stuff (Getting game HUD)

InfinityScript plugins for dedicated servers.
User avatar
Slvr99
TeknoPrincess
TeknoPrincess
Posts: 270
Joined: Wed Apr 18, 2012 7:53 pm
Location: Florida
Contact:

InfinityScript HUD Stuff (Getting game HUD)

Postby Slvr99 » Fri Jan 15, 2016 7:48 pm

I just thought I'd create a thread dedicated to learning/finding stuff about the game's HUD through InfinityScript. In particular, editing HUD that is already created by GSC. I've experimented a lot with the HUD and have found a few things out, but there's obviously more to find! Here's my findings so far!

Using HudElem.GetHudElem(), you can get HUD that is already created, whether it be from GSC or from InfinityScript. It's the only way you can, since GetField doesn't get most fields that GSC creates. GetHudElem() gets HUD based on it's Entity number, or EntRef. The problem is that you won't know what EntRef a specific HUD is unless you look for it yourself which takes a long time (trust me! =P). Here's the EntRefs I found so far:

    65536 - Objective Text above crosshair
    65537 - hudbig text in center
    65538 - Default text at lower middle
    65539 - hudbig text at lower middle
    65540 - Unused/unknown
    65541 - Objective text at top center(blue glow)
    65542 - Same as previous
    65543 - Unused/unknown
    65544 - Unused/unknown
    65545 - Unused/unknown
    65546 - hudbig text above crosshair aligned to left
    65547 - objective text above crosshair
    65548 - Same as previous
    65549 - hudbig text in center
    65550 and up - unused/unknown

This was all I found so far. Everything here is for Client 0, so it's very possible the values that are marked as unknown are for the other clients. As far as I know, HUD starts at EntRef 65536 and goes all the way up(Doesn't seem to be a limit until giant numbers). I'm aiming to find major hud stuff like the weapon bullets/name, minimap, and scorebars. Feel free to post any findings you have as a reply and I'll be updating this whenever I find new stuff!
XENZ
TeknoDog
TeknoDog
Posts: 46
Joined: Sat Jun 13, 2015 10:01 pm

Re: InfinityScript HUD Stuff (Getting game HUD)

Postby XENZ » Fri Jan 15, 2016 9:56 pm

Nice work man!
Image
User avatar
~Seraphim
TeknoHorse
TeknoHorse
Posts: 1186
Joined: Sun Jan 12, 2014 10:36 pm

Re: InfinityScript HUD Stuff (Getting game HUD)

Postby ~Seraphim » Fri Jan 15, 2016 10:05 pm

Those aren't entrefs. Entrefs as you said are just entity numbers. The game has entities from a maximum of 0 to 2048. ( For MW3 ).
So those parameters aren't entrefs. Probably an index slot.
User avatar
Slvr99
TeknoPrincess
TeknoPrincess
Posts: 270
Joined: Wed Apr 18, 2012 7:53 pm
Location: Florida
Contact:

Re: InfinityScript HUD Stuff (Getting game HUD)

Postby Slvr99 » Fri Jan 15, 2016 11:16 pm

c4271605 wrote:Those aren't entrefs. Entrefs as you said are just entity numbers. The game has entities from a maximum of 0 to 2048. ( For MW3 ).
So those parameters aren't entrefs. Probably an index slot.

Even so, IS refers to them as an EntRef. The argument for GetHudElem is shown as "int EntRef" and getting the Entity field of a HudElem will have an EntRef for it. Either way, you may be right =P
User avatar
~Seraphim
TeknoHorse
TeknoHorse
Posts: 1186
Joined: Sun Jan 12, 2014 10:36 pm

Re: InfinityScript HUD Stuff (Getting game HUD)

Postby ~Seraphim » Wed Jan 20, 2016 2:24 am

Slvr99 wrote:
c4271605 wrote:Those aren't entrefs. Entrefs as you said are just entity numbers. The game has entities from a maximum of 0 to 2048. ( For MW3 ).
So those parameters aren't entrefs. Probably an index slot.

Even so, IS refers to them as an EntRef. The argument for GetHudElem is shown as "int EntRef" and getting the Entity field of a HudElem will have an EntRef for it. Either way, you may be right =P

NTAuthority was high. I assume he meant a reference to the index of the entity in the entity pool.
XENZ
TeknoDog
TeknoDog
Posts: 46
Joined: Sat Jun 13, 2015 10:01 pm

Re: InfinityScript HUD Stuff (Getting game HUD)

Postby XENZ » Wed Jun 22, 2016 11:07 am

When you get Entity Client, Client.ToString() returns [Entity:0:0] for client 0 ([Entity:0:0] to [Entity0:17] are clients, and above are grenades, vehicles...)

and when you get HudElem Test, Test.Entity.ToString() returns " [Entity:1:0] if its a ServerHudelem and [Entity:1:21] for Client0 Huds (not always)

Now when you callHudElem.GetHudElem(0) returns [Entity:0:0] which is client 0, not first ServerHud
HudElem.GetHudElem(1) returns [Entity:0:1] which is client 1

So GetHudElem(entRef) should return [Entity:1:entRef] ???

------------------------------------------------------------------------------------------------------------
Spawned 5 bot(s).
[Util::Console] client: [Entity:0:4] hud: [Entity:1:61]
[Util::Console] client: [Entity:0:3] hud: [Entity:1:69]
[Util::Console] client: [Entity:0:2] hud: [Entity:1:77]
[Util::Console] client: [Entity:0:1] hud: [Entity:1:85]
[Util::Console] client: [Entity:0:0] hud: [Entity:1:93]
map_restart(true)
[Util::Console] client: [Entity:0:4] hud: [Entity:1:58]
[Util::Console] client: [Entity:0:3] hud: [Entity:1:72]
[Util::Console] client: [Entity:0:2] hud: [Entity:1:83]
[Util::Console] client: [Entity:0:1] hud: [Entity:1:97]
[Util::Console] client: [Entity:0:0] hud: [Entity:1:105]
Image
User avatar
Slvr99
TeknoPrincess
TeknoPrincess
Posts: 270
Joined: Wed Apr 18, 2012 7:53 pm
Location: Florida
Contact:

Re: InfinityScript HUD Stuff (Getting game HUD)

Postby Slvr99 » Wed Jun 22, 2016 12:45 pm

XENZ wrote:When you get Entity Client, Client.ToString() returns [Entity:0:0] for client 0 ([Entity:0:0] to [Entity0:17] are clients, and above are grenades, vehicles...)

and when you get HudElem Test, Test.Entity.ToString() returns " [Entity:1:0] if its a ServerHudelem and [Entity:1:21] for Client0 Huds (not always)

Now when you callHudElem.GetHudElem(0) returns [Entity:0:0] which is client 0, not first ServerHud
HudElem.GetHudElem(1) returns [Entity:0:1] which is client 1

So GetHudElem(entRef) should return [Entity:1:entRef] ???

------------------------------------------------------------------------------------------------------------
Spawned 5 bot(s).
[Util::Console] client: [Entity:0:4] hud: [Entity:1:61]
[Util::Console] client: [Entity:0:3] hud: [Entity:1:69]
[Util::Console] client: [Entity:0:2] hud: [Entity:1:77]
[Util::Console] client: [Entity:0:1] hud: [Entity:1:85]
[Util::Console] client: [Entity:0:0] hud: [Entity:1:93]
map_restart(true)
[Util::Console] client: [Entity:0:4] hud: [Entity:1:58]
[Util::Console] client: [Entity:0:3] hud: [Entity:1:72]
[Util::Console] client: [Entity:0:2] hud: [Entity:1:83]
[Util::Console] client: [Entity:0:1] hud: [Entity:1:97]
[Util::Console] client: [Entity:0:0] hud: [Entity:1:105]

Very nice find there. I might play around with that once I get time. Since it looks like HUD isn't spawned/created in the same sequence every time, it might not be able to easily be edited or used.
User avatar
~Seraphim
TeknoHorse
TeknoHorse
Posts: 1186
Joined: Sun Jan 12, 2014 10:36 pm

Re: InfinityScript HUD Stuff (Getting game HUD)

Postby ~Seraphim » Thu Jun 23, 2016 5:58 am

FYI, An "entref" is composed of two parts. Here's how it actually looks:

Code: Select all

struct scr_entref_t
{
     union
     {
            struct
            {
                   unsigned short _class; // Upper word. This signifies the entity's class.
                   unsigned short _entnum; // Actual reference to one of the 2048 entities in the game.
            };
            unsigned long ref;
     };
}

XENZ
TeknoDog
TeknoDog
Posts: 46
Joined: Sat Jun 13, 2015 10:01 pm

Re: InfinityScript HUD Stuff (Getting game HUD)

Postby XENZ » Thu Jun 23, 2016 9:29 am

c4271605 wrote:FYI, An "entref" is composed of two parts. Here's how it actually looks:

Code: Select all

struct scr_entref_t
{
     union
     {
            struct
            {
                   unsigned short _class; // Upper word. This signifies the entity's class.
                   unsigned short _entnum; // Actual reference to one of the 2048 entities in the game.
            };
            unsigned long ref;
     };
}



So its possible to make GetHudElem() return class 1 instead of class 0 ?

EDIT:

GetHudElem(65535) => [Entity:0:65535]
GetHudElem(65536) => [Entity:1:0]
GetHudElem(65537) => [Entity:1:1]
GetHudElem(65538) => [Entity:1:2]

65536+ use ref ?
Image
XENZ
TeknoDog
TeknoDog
Posts: 46
Joined: Sat Jun 13, 2015 10:01 pm

Re: InfinityScript HUD Stuff (Getting game HUD)

Postby XENZ » Thu Jun 23, 2016 11:02 am

int[] hudnum = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 };
foreach (int entref in hudnum)
{
HudElem test1 = HudElem.GetHudElem(65536 + entref);
test1.SetField("alignx", "center");
test1.SetField("aligny", "middle");
test1.SetField("x", 0f);
test1.SetField("y", 0f);
test1.Alpha = 1f;
Util.Console("HUD " + test1.Entity.ToString() + "-> AlignX:" + test1.GetField<string>("alignx") + " AlignY:" + test1.GetField<string>("aligny") + " X:" + test1.GetField<float>("x") + " Y:" + test1.GetField<float>("x"));
}



All HudElems got move to the center. it works. HIT crosshair, bomb zone letters, Infinityscript huds, UAV carepackage icon....
Image

Return to “InfinityScript”

Who is online

Users browsing this forum: No registered users and 6 guests