.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   General Bot Coding (http://forums.bots-united.com/forumdisplay.php?f=24)
-   -   Bot avatars in scoreboard (http://forums.bots-united.com/showthread.php?t=8939)

Immortal_BLG 06-08-2011 15:12

Bot avatar in scoreboard
 
Just add this code after pfnCreateFakeClient() call (after bot entity created):
Code:

const unsigned int k_unSteamUserDesktopInstance = 1;
// Steam account types
enum EAccountType
{
        // ...
        k_EAccountTypeIndividual = 1        // single user account
        // ...
};
// Steam universes. Each universe is a self-contained Steam instance.
enum EUniverse
{
        // ...
        k_EUniversePublic = 1
        // ...
};
#pragma warning (push)
#pragma warning (disable: 4201)        // nameless union is nonstandard
// 64 bits total
union SteamID_t        // From CSteamID class....
{
        struct /* Unnamed */
        {
                unsigned int m_unAccountID      : 32;        // unique account identifier
                unsigned int m_unAccountInstance : 20;        // dynamic instance ID (used for multiseat type accounts only)
                unsigned int m_EAccountType      : 4;        // type of account - can't show as EAccountType, due to signed / unsigned difference
                EUniverse    m_EUniverse        : 8;        // universe this account belongs to
        };

        unsigned long long m_unAll64Bits;
} steamID;
#pragma warning (pop)        // no more anonymous unions until next time

const unsigned int SteamAccountIDMaximum (2039734271u);

steamID.m_unAccountID      = 32118129u;        // My ID (for example)//RANDOM_LONG (0u, SteamAccountIDMaximum); - random almost never works....
steamID.m_unAccountInstance = k_unSteamUserDesktopInstance;        // constant
steamID.m_EAccountType      = k_EAccountTypeIndividual;        // constant
steamID.m_EUniverse        = k_EUniversePublic;        // constant
// or steamID.m_unAll64Bits = 76561197992383857ull;        // My ID (full ID must have the form 7656119XXXXXXXXXX)

SET_CLIENT_KEYVALUE (botEntityIndex, GET_INFOKEYBUFFER (botEdict), "*sid", FormatBuffer ("%I64u", steamID.m_unAll64Bits));


The Storm 06-08-2011 17:26

Re: Bot avatar in scoreboard
 
Nice hacking. :)

Question: If I don't have Steam account for the Dedicated server(which is common) what avatar will appear? Perhaps some random if the RANDOM_LONG() hit valid Steam ID?

Immortal_BLG 07-08-2011 03:43

Re: Bot avatar in scoreboard
 
Quote:

Originally Posted by The Storm
Question: If I don't have Steam account for the Dedicated server(which is common) what avatar will appear?

to be honest I do not know all the details (I only test all it on my PC - result: me and bots have white square instead of avatars - on multiple PC's(when dedicated server and client is on different computers) the result is unknown), but I think it should works....
Quote:

Originally Posted by The Storm
Perhaps some random if the RANDOM_LONG() hit valid Steam ID?

For client "*sid" value is just used for avatar and relationship icon which is located to the left of avatar - I think that is all.
About random steam ID: There is too small probability to get a valid steam ID from random value....

The Storm 07-08-2011 14:12

Re: Bot avatar in scoreboard
 
Ok but I can't get one thing... Is the valid steam ID requred to get avatar on a bot? If not what and from where the bot will get it's avatar?

Immortal_BLG 07-08-2011 18:53

Re: Bot avatar in scoreboard
 
Bot has no his own steam ID and of course avatar, his uses ID or some real client and takes his avatar. Clients sees avatar, which is loaded for Steam ID of a bot or client, if bot "*sid" value undefined or invalid, his avatar is empty, in other case bot will get avatar of a real client from his Steam ID.

The Storm 11-08-2011 21:25

Re: Bot avatar in scoreboard
 
Got it now. :)

Immortal_BLG 01-03-2012 04:49

Re: Bot avatar in scoreboard
 
SORRY!!!
I forgot that the class CSteamID has no alignment!
So you need to write before declaration "union SteamID_t":
Code:

#pragma pack (push, 1)
and after declaration:
Code:

#pragma pack (pop)
In general, the declaration of "union SteamID_t" should look like this:
Code:

#pragma pack (push, 1)        // Structures must be packed (byte-aligned)
// 64 bits total
union SteamID_t        // From CSteamID class....
{
        #pragma warning (push)
        #pragma warning (disable: 4201)        // nameless union is nonstandard
                struct /* Unnamed */
                {
                        unsigned int m_unAccountID      : 32;        // unique account identifier
                        unsigned int m_unAccountInstance : 20;        // dynamic instance ID (used for multiseat type accounts only)
                        unsigned int m_EAccountType      : 4;        // type of account - can't show as EAccountType, due to signed / unsigned difference
                        EUniverse    m_EUniverse        : 8;        // universe this account belongs to
                };
        #pragma warning (pop)        // no more anonymous unions until next time

        unsigned long long m_unAll64Bits;
} steamID;
#pragma pack (pop)        // Reset default packing.

P.S. However, in my opinion it is not important....

wbyokomo 02-11-2012 18:18

Re: Bot avatars in scoreboard
 
Wow nice found, should be add into podbot.


All times are GMT +2. The time now is 23:06.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.