.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   General Bot Coding (http://forums.bots-united.com/forumdisplay.php?f=24)
-   -   UTIL_GetClass Question (http://forums.bots-united.com/showthread.php?t=1666)

Tea 15-05-2004 00:15

UTIL_GetClass Question
 
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.

Cpl. Shrike 15-05-2004 00:20

Re: UTIL_GetClass Question
 
I dont' get yr question ??
Do you want to shoose another class.
or print what class the bot has on screen ??

Tea 15-05-2004 00:33

Re: UTIL_GetClass Question
 
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

botman 15-05-2004 01:23

Re: UTIL_GetClass Question
 
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

Whistler 15-05-2004 03:54

Re: UTIL_GetClass Question
 
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.

botman 15-05-2004 15:28

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

botman

Tea 15-05-2004 16:29

Re: UTIL_GetClass Question
 
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 ?

Cpl. Shrike 15-05-2004 18:47

Re: UTIL_GetClass Question
 
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.

Pierre-Marie Baty 16-05-2004 23:21

Re: UTIL_GetClass Question
 
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.


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

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