.:: Bots United ::.  
filebase forums discord server github wiki web
cubebot epodbot fritzbot gravebot grogbot hpbbot ivpbot jkbotti joebot
meanmod podbotmm racc rcbot realbot sandbot shrikebot soulfathermaps yapb

Go Back   .:: Bots United ::. > Developer's Farm > SDK Programming discussions > Half-Life 2 SDK
Half-Life 2 SDK For developments focused around the Half-Life 2 engine Half-Life 2

Reply
 
Thread Tools
Re: Yay - Bots move to given vector location...
Old
  (#31)
dub
Member
 
dub's Avatar
 
Status: Offline
Posts: 89
Join Date: Aug 2004
Location: UK
Default Re: Yay - Bots move to given vector location... - 12-01-2005

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

Last edited by dub; 12-01-2005 at 19:21..
  
Reply With Quote
Re: Yay - Bots move to given vector location...
Old
  (#32)
stefanhendriks
RealBot Author
 
stefanhendriks's Avatar
 
Status: Offline
Posts: 3,088
Join Date: Nov 2003
Location: Netherlands
Default Re: Yay - Bots move to given vector location... - 12-01-2005

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)...


Author of RealBot, "Arrakis" and "Dune 2 - The Maker" | co-Founder of Bots-United | Fundynamic | Blog | E-Mail me
  
Reply With Quote
Re: Yay - Bots move to given vector location...
Old
  (#33)
dub
Member
 
dub's Avatar
 
Status: Offline
Posts: 89
Join Date: Aug 2004
Location: UK
Default Re: Yay - Bots move to given vector location... - 12-01-2005

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
  
Reply With Quote
Re: Yay - Bots move to given vector location...
Old
  (#34)
stefanhendriks
RealBot Author
 
stefanhendriks's Avatar
 
Status: Offline
Posts: 3,088
Join Date: Nov 2003
Location: Netherlands
Default Re: Yay - Bots move to given vector location... - 12-01-2005

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?


Author of RealBot, "Arrakis" and "Dune 2 - The Maker" | co-Founder of Bots-United | Fundynamic | Blog | E-Mail me
  
Reply With Quote
Re: Yay - Bots move to given vector location...
Old
  (#35)
dub
Member
 
dub's Avatar
 
Status: Offline
Posts: 89
Join Date: Aug 2004
Location: UK
Default Re: Yay - Bots move to given vector location... - 12-01-2005

untested the hack, having problem`s compiling with
CBaseCombatWeapon class included.
  
Reply With Quote
Re: Yay - Bots move to given vector location...
Old
  (#36)
stefanhendriks
RealBot Author
 
stefanhendriks's Avatar
 
Status: Offline
Posts: 3,088
Join Date: Nov 2003
Location: Netherlands
Default Re: Yay - Bots move to given vector location... - 12-01-2005

i was afraid for that


Author of RealBot, "Arrakis" and "Dune 2 - The Maker" | co-Founder of Bots-United | Fundynamic | Blog | E-Mail me
  
Reply With Quote
Re: Yay - Bots move to given vector location...
Old
  (#37)
stefanhendriks
RealBot Author
 
stefanhendriks's Avatar
 
Status: Offline
Posts: 3,088
Join Date: Nov 2003
Location: Netherlands
Default Re: Yay - Bots move to given vector location... - 12-01-2005

About the pBaseEnt->GetFOV

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


Author of RealBot, "Arrakis" and "Dune 2 - The Maker" | co-Founder of Bots-United | Fundynamic | Blog | E-Mail me
  
Reply With Quote
Re: Yay - Bots move to given vector location...
Old
  (#38)
dub
Member
 
dub's Avatar
 
Status: Offline
Posts: 89
Join Date: Aug 2004
Location: UK
Default Re: Yay - Bots move to given vector location... - 12-01-2005

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???.
  
Reply With Quote
Re: Yay - Bots move to given vector location...
Old
  (#39)
SteveC
Member
 
Status: Offline
Posts: 37
Join Date: Jan 2005
Location: UK
Default Re: Yay - Bots move to given vector location... - 12-01-2005

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?
  
Reply With Quote
Re: Yay - Bots move to given vector location...
Old
  (#40)
dub
Member
 
dub's Avatar
 
Status: Offline
Posts: 89
Join Date: Aug 2004
Location: UK
Default Re: Yay - Bots move to given vector location... - 12-01-2005

thanks steve for the tips, much appreciated .
just a quick question, does this mean we can`t use GetFOV () because it`s not declared virtual or in the baseentity header?
  
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com