.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   The RealBot 'Source' (http://forums.bots-united.com/forumdisplay.php?f=52)
-   -   Buytable SCREWED. (http://forums.bots-united.com/showthread.php?t=2174)

Josh_Borke 16-07-2004 15:43

Re: Buytable SCREWED.
 
would something like this work?

bot_buycode.cpp:270

Code:

if (UTIL_GiveWeaponType (wapen_tabel[i].iId) == SHIELD)
 if (FUNC_BotHasWeapon (pBot, pBot->ipFavoPriWeapon) == true)
  continue;

also, a possible fix for buying a weapon with lower priority than the current weapon:
Code:

if (pBot->iPrimaryWeapon > -1) {  // bot has a weapon
  if (wapen_tabel[pBot->iPrimaryWeapon].priority > wapen_tabel[i].priority) 
 // the weapon is at a higher priority than the one we can buy, don't do anything
          continue;
 // DOES NOT WORK!! need priority of current weapon

i'm not sure how to get the priority for the current weapon though

stefanhendriks 16-07-2004 21:48

Re: Buytable SCREWED.
 
i think your code should work...

Josh_Borke 16-07-2004 23:48

Re: Buytable SCREWED.
 
the first code set should work, the second code set won't because iId != wapen_tabel index. a simple function to create a static array should be easy, ie
Code:

int UTIL_GetWapenIndex (int iId)
 {
        return wapen_ids(iId);
 }
 
 void UTIL_MakeWapenIndex (void)
 {
          int i = 0;
          for (i = 0; i < 32; i++)
                  wapen_ids(wapen_tabel(i).iId) = i;
          return;
 }

or something like that.

HTH. testing the shield code now...

stefanhendriks 16-07-2004 23:57

Re: Buytable SCREWED.
 
There already is code to revert the real ID and the wapen_tabel id ... in the buycode.cpp function afaik.

Josh_Borke 17-07-2004 00:31

Re: Buytable SCREWED.
 
yea, there is, thanks.
bot_buycode.cpp: 210
Code:

  if (pBot->iPrimaryWeapon > -1) {
                                  int index = ListIdWeapon (pBot->iPrimaryWeapon);
                                  if (wapen_tabel[index].priority > wapen_tabel[i].priority)
                                          continue;
                                  }

similarly:, bot_buycode.cpp line 282
Code:

if (pBot->iSecondaryWeapon > -1) {
                                  int index = ListIdWeapon(pBot->iSecondaryWeapon);
                                  if (wapen_tabel[index].priority > wapen_tabel[i].priority)
                                          continue;
                                  }

also, not to be a pest ;)
bot_buycode.cpp line 254
Code:

// Buy favorite weapon
 buy_weapon = pBot->ipFavoSecWeapon;
 
 // should be
 
 // Buy favorite weapon
 buy_weapon = pBot->ipFavoSecWeapon;
 bBuyOther = false;


evy 17-07-2004 22:39

Re: Buytable SCREWED.
 
In the code util.cpp, there are question marks around the weapon name used internally by CS 1.6 for shields, can someone check in reallog.txt if there are lines like:

UTIL_GiveWeaponId: Unknown weapon name xyz

where xyz should be weapon_shield (then the question marks should be removed), else the code should be modified 9_9

You need to use build 3056 which has just been committed on 18th of July...

Thanks

-evy

PS: I have no access to a CS 1.6...

Josh_Borke 18-07-2004 00:42

Re: Buytable SCREWED.
 
i have no Unknown weapon name in my reallog.txt, though they don't run 24/7. bots have bought all the weapons though. HTH

Josh_Borke 22-07-2004 05:53

Re: Buytable SCREWED.
 
i made the changes to my bot_buycode described below and it has drastically reduced/eliminated the buying multiple primaries each round.
it also reduces the buying of a shield if they have a primary weapon

no Unknown weapons yet evy, done aprrox 30 rounds on mindmaze and none yet.

Josh_Borke 23-07-2004 00:50

Re: Buytable SCREWED.
 
sorry for all the double posting

bot_buycode.cpp: line 179

why isn't it
Code:

pBot->buy_primary = false;
    bBuyOther = false;

? so that they actually save for their favorite?

also, for the actual buy'ing section, I don't know if the compiler will optimize it as much as converting it to a switch statement because that's all it basically is. I remember from my compilers class that a switch statement converts to quicker code than if statements :) HTH :) I have such conversion implemented :)
you have line 444 = line 436

perhaps we could put into the personality a buy only pistols option? perhaps it could be a mode ;)

i've been trying to debug the buycode, it doesn't seem to update the iPrimaryWeapon before going into the buycode sometimes
it is updated after the swat teams are created though :/
any idea why that is????:(:'(

stefanhendriks 23-07-2004 13:45

Re: Buytable SCREWED.
 
The original code was meant to buy every round a new primary weapon; or better said, to let the bot rethink about it so it could buy a BETTER weapon when it has the money and such. When the favorite weapon ip is set, the 'thinking' will be stopped automaticly there.

a pistol mode is cool ;)

iPrimaryWeapon is updated every frame in UpdateStatus() of the bot.


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

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