.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   Half-Life 2 SDK (http://forums.bots-united.com/forumdisplay.php?f=62)
-   -   Yay - Bots move to given vector location... (http://forums.bots-united.com/showthread.php?t=3326)

dub 12-01-2005 11:50

Re: Yay - Bots move to given vector location...
 
small fix to check if a dedicated server;)
Code:

    void CUBBOT_Plugin::ClientActive (edict_t *pEntity)
    {
            if (!engine->IsDedicatedServer () && pHostEdict == NULL)
            {
                    Msg ("PLUGIN: Host edict found and set\n");
                    pHostEdict = pEntity;
            }
    }

has any one found out how to show menu`s yet?

edit few engine notes.
-- class CBasePlayer pBot->pPlayerEnt --
pPlayerEnt->MaxSpeed (); // max speed
pPlayerEnt->IsSuitEquipped (); // armor equipped
pPlayerEnt->ArmorValue (); // armor amount
pPlayerEnt->GetFOV (); & pPlayerEnt->GetDefaultFOV (); // get current, default fov

-- CBaseEntity class pBot->pBaseEntity ---
pBaseEntity->GetMaxHealth (); // max health
pBaseEntity->GetHealth (); // current health
pBaseEntity->GetTeamNumber (); // current team
pBaseEntity->TeamID (); // current team`s name
// CS:S : 1 = Spectator, 2 = Terrorist, 3 = Counter-Terrorist
pBaseEntity->InSameTeam (pBaseEnemy); // is client on the same team
enjoy Dubb;)

stefanhendriks 12-01-2005 13:40

Re: Yay - Bots move to given vector location...
 
great work Dub! Thats something i always wanted to know.

@ pmb, yes i already know you have to do something with that cmd.weaponselect thingy, but how its parsed, thats a clue to me (perhaps an impulse command).

/me digs very quick in the code:

* found this in usercmd.h (snippet)

Code:

// Impulse command issued.
 byte        impulse;               
 // Current weapon id
 int  weaponselect;
 int  weaponsubtype;

means, we can pass through an impulse command. And we can do weaponselect (INT) and weaponsubtype (INT).

Perhaps its the 'menu + submenu' thing. Like, ie, in CS the 4th weapon slot = grenades, and subtype is then a frag/flash/smoke grenade. But this also means you have to keep track of what a bot has because this 'order' changes (depending on what you have bought or not)...

dub 12-01-2005 16:50

Re: Yay - Bots move to given vector location...
 
solution to getting weapon information.

add to the bot_t structure this
Code:

  CBaseCombatCharacter *pBaseCombatChar;
then after the CBaseEntity hack by stevec add this
Code:

  pBot->pBaseCombatChar = pBot->pBaseEntity->MyCombatCharacterPointer ();
to access info about the current weapon all you need to do is this
Code:

  CBaseCombatWeapon *pCurrentWeapon = pBot->pBaseCombatChar->GetActiveWeapon ();
enjoy Dubb;)

stefanhendriks 12-01-2005 17:26

Re: Yay - Bots move to given vector location...
 
hmm yes, still remains an ugly hack :) any files we need to include with the project as well? or is that it? :)

*EDIT:
i think you can change weapons via that way as well right? But, in CSS this would probably be different compared to the HL2 SDK code... did you test this code you posted here?

dub 12-01-2005 17:36

Re: Yay - Bots move to given vector location...
 
untested the hack, having problem`s compiling with
CBaseCombatWeapon class included.

stefanhendriks 12-01-2005 18:48

Re: Yay - Bots move to given vector location...
 
i was afraid for that ;)

stefanhendriks 12-01-2005 18:49

Re: Yay - Bots move to given vector location...
 
About the pBaseEnt->GetFOV

it does nothing but return a floating point if iw as not mistaken... does not help us much yet ;)

dub 12-01-2005 19:36

Re: Yay - Bots move to given vector location...
 
stefan did you manage to compile accessing pPlayerEnt->GetFOV ()?
i keep getting unresolved external compiler error.
Code:

ubbot.obj : error LNK2001: unresolved external symbol "public: int __thiscall CBasePlayer::GetFOV(void)const " (?GetFOV@CBasePlayer@@QBEHXZ)
maybe because it is for the client dll only unsure???:(.

SteveC 12-01-2005 19:39

Re: Yay - Bots move to given vector location...
 
Good work Dub!

For finding out what you can access within the classes you need to check for members which are either fully defined within the header file, or are declared with the virtual state. Then you include the header file only and don't need to worry about the linking to the cpp file. However this technique only works because they have derived the 'working' classes from the ones we can see. E.G. for CS the player class is actually CSPlayer. It's not a hack, but it will fail if a mod doesn't follow valves layout to the letter.

Also, isn't the float that GetFOV() returns related to the angle of the viewing cone, either degrees or possibly radians?

dub 12-01-2005 19:59

Re: Yay - Bots move to given vector location...
 
thanks steve for the tips, much appreciated :D.
just a quick question, does this mean we can`t use GetFOV () because it`s not declared virtual or in the baseentity header?


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

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