.:: 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 > General Bot Coding
General Bot Coding See what a pain it is to get those little mechs shooting around

Reply
 
Thread Tools
UTIL_GetClass Question
Old
  (#1)
Tea
Guest
 
Status:
Posts: n/a
Default UTIL_GetClass Question - 15-05-2004

Code:
int bot_class = UTIL_GetClass(pEdict);
Now the bot should knew which class they are, but any command should I use to let the bot tell me which class they have just detected ? Something like :

Code:
FakeClientCommand(pEdict,"say",bot_class ???,0);
Thank you very much.
  
Reply With Quote
Re: UTIL_GetClass Question
Old
  (#2)
Cpl. Shrike
ShrikeBot Coder/Moderator
 
Cpl. Shrike's Avatar
 
Status: Offline
Posts: 550
Join Date: Mar 2004
Location: The Netherlands
Default Re: UTIL_GetClass Question - 15-05-2004

I dont' get yr question ??
Do you want to shoose another class.
or print what class the bot has on screen ??
  
Reply With Quote
Re: UTIL_GetClass Question
Old
  (#3)
Tea
Guest
 
Status:
Posts: n/a
Default Re: UTIL_GetClass Question - 15-05-2004

Hi, yes, I want to print which class did the bot has on screen. Actually I knew the bot_class should be (bot_class==1) since I have ask him to join class 1, and they did joined the class 1.

But when I use

Code:
 
edict_t *pEdict = pBot->pEdict;
int bot_class = UTIL_GetClass(pEdict);
 
	if (bot_class==1)
	 {
	 FakeClientCommand(pEdict,"say","SWITCH WEAPON",NULL);
	 FakeClientCommand(pEdict, "weapon_garand", NULL, NULL);
	 }
The bot did not change weapon and didn't said "switch weapon", so I want to know which class did they delected.

But when I removed "if (bot_class==1)" the bot can change weapon, that mean he is not bot_class==1 !! but I knew only bot_class==1 can use "weapon_garand" o_O

Last edited by Tea; 15-05-2004 at 01:38..
  
Reply With Quote
Re: UTIL_GetClass Question
Old
  (#4)
botman
Super Moderator
 
Status: Offline
Posts: 280
Join Date: Jan 2004
Location: Plano, TX
Default Re: UTIL_GetClass Question - 15-05-2004

Did you modify the UTIL_GetClass() function to support the MOD you are working on?

The default UTIL_GetClass() only supports FrontLine Force, since that was the only MOD that the HPB bot needed to know any class information about. If you didn't add code for your MOD, it will return 0.

botman
  
Reply With Quote
Re: UTIL_GetClass Question
Old
  (#5)
Whistler
Summoner
 
Whistler's Avatar
 
Status: Offline
Posts: 1,499
Join Date: Feb 2004
Location: Mist Village
Default Re: UTIL_GetClass Question - 15-05-2004

btw what the MOD is that ?

To get the player class, you can check the player model like the code to get the team in Counter-Strike in the UTIL_GetTeam() function.
  
Reply With Quote
Re: UTIL_GetClass Question
Old
  (#6)
botman
Super Moderator
 
Status: Offline
Posts: 280
Join Date: Jan 2004
Location: Plano, TX
Default Re: UTIL_GetClass Question - 15-05-2004

Well, since it has "weapon_garand", I would assume it's Day of Defeat (with the M1 Garand rifle).

botman
  
Reply With Quote
Re: UTIL_GetClass Question
Old
  (#7)
Tea
Guest
 
Status:
Posts: n/a
Default Re: UTIL_GetClass Question - 15-05-2004

Yes, it is DoD, actually I want the bot can reset to primary weapon after they kill the enemy if they switch to knife or pistol before, anyway I think I won't check the class anymore since I forgot now dod can drop and pickup weapon just like CS, so even class 1 can use class 2 weapon, now I just use the following code to reset weapon:

Code:
 
	if ((mod_id == DOD_DLL) && (!WeaponIsPrimary( pBot )))
	{  
	 if (bot_team==0)
	 {
	  FakeClientCommand(pEdict, "weapon_garand", NULL, NULL);
	  FakeClientCommand(pEdict, "weapon_m1carbine", NULL, NULL);
	  FakeClientCommand(pEdict, "weapon_thompson", NULL, NULL);
	  FakeClientCommand(pEdict, "weapon_greasegun", NULL, NULL);
	  ........... 
	  ...........
	  ...........
Although I know it is not very good because it work like try and error but it work really good after I test it, and I didn't have a better idea at this moment. What do you guys think of this ?
  
Reply With Quote
Re: UTIL_GetClass Question
Old
  (#8)
Cpl. Shrike
ShrikeBot Coder/Moderator
 
Cpl. Shrike's Avatar
 
Status: Offline
Posts: 550
Join Date: Mar 2004
Location: The Netherlands
Default Re: UTIL_GetClass Question - 15-05-2004

Well that's a tricky solution.

Yr just issuing fakeclient commands on weapons the bot don't have.
It can only have on primary weapon.

Better make a check on which weapon it's carrying and select that weapon it has and if it even has a pri weapon.
  
Reply With Quote
Re: UTIL_GetClass Question
Old
  (#9)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: UTIL_GetClass Question - 17-05-2004

It's not a that ugly solution.
Let's not forget a bot is server-side ; it won't take long to the game DLL to figure out that the bot doesn't own that weapon and then drop the client command.

Consider all these haxor weapon scripts people seem to love in Counter-Strike and DoD. THAT is ugly. THAT takes bandwidth. THAT is sending bursts of ClientCommands in a trial'n'error way over the wire. I feel MUCH more concerned by these sucker scripts than Tea's method. Tea's method is just bunny in wonderland compared to all the other player weapon scripts out there.



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."
  
Reply With Quote
Reply


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

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