.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   General Bot Coding (http://forums.bots-united.com/forumdisplay.php?f=24)
-   -   How to make some change in buying (http://forums.bots-united.com/showthread.php?t=3138)

The Storm 05-12-2004 15:57

How to make some change in buying
 
For E[POD]bot to get the bots to buy granede I must write
Code:

  FakeClientCommand(pEdict, "menuselect","8", NULL);
  FakeClientCommand(pEdict, "menuselect","4", NULL);

But if tape
Code:

  FakeClientCommand(pEdict, "buy;menuselect 8;menuselect 4", NULL, NULL);
The bots don't buy granede ???:(
How can I fix this.

This is not problem for Counter-Strike 1.6 becose now the bots buy weapon with shortcuts and in the shortcut is taped
Code:

  FakeClientCommand(pEdict, "buy;menuselect 4;menuselect 3", NULL, NULL);
For that reason the bots in Counter-Strike 1.5 can't buy weapons but in Counter-Strike 1.6 there is no problem becose there the bots don't use buy;menuselect, they directly use the name of weapon to buy it.

For that reason I wont to fix this.

stefanhendriks 05-12-2004 16:32

Re: How to make some change in buying
 
i don't understand the problem? You mean in CS 1.5 they do not buy weapons and in CS 1.6 they do?

Or, the bots don't buy weapons for some reason?

Pierre-Marie Baty 05-12-2004 17:27

Re: How to make some change in buying
 
this is normal because you must consider that client commands are sent individually.
If a real client can send client commands in a burst separated by semicolons (e.g, "buy;menuselect A;menuselect B"), it's because his client DLL separates each command and calls the client command function THREE TIMES. Once for "buy", another time for "menuselect A", another time for "menuselect B".
The FakeClientCommand() function you are using does not permit to do that. One or two years ago I wrote a different version of FakeClientCommand() coupled with pfnCmd_Argc, Argv and Args, that implements this behaviour and enables bots to send client commands in the same way humans do (i.e, with semicolons to separate each). It is implemented in POD-bot 2.6mm, if you want to give it a look.

The Storm 05-12-2004 20:25

Re: How to make some change in buying
 
Thanks I now will look in PODbot 2.6mm.


Edit : After 3 hours in working the functioon is changed to the FakeClientComman from PODbot 2.6mm.
Thanks a lot of to PMB.
Now I have a lot of work to change all FakeClientCommand in the bots, so maybe after some day I will tell you is the bots now buy weapon coorect for Counter-Strike 1.5.
I put comments in the new code whit your name PMB :).
Thanks again.

Rifleman 06-12-2004 06:08

Re: How to make some change in buying
 
if you want to do it easily , add a function like :

Code:

void Buy (edict_t *pEdict, char *cmd, char *cmd2)
{
  FakeClientCommand(pEdict, "buy", NULL, NULL);
  FakeClientCommand(pEdict, "menuselect", cmd, NULL);
  FakeClientCommand(pEdict, "menuselect", cmd2, NULL);
}

Then , when you want the bot to buy something like grenade ,

Buy (pEdict, "8", "4");

The Storm 06-12-2004 20:28

Re: How to make some change in buying
 
OK all FakeClientCommand in bot.cpp are changed.
Now the bots buy weapon correctly in CS 1.5 and CS 1.6 with no problem.
Again thanks to PMB ;).


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

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