.:: 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 ::. > Cyborg Factory > RealBot > The RealBot 'Source'
The RealBot 'Source' Discuss things about the source code. You can here point out bugs, share ideas and code. Assign to become an 'official team member' and so on!

Reply
 
Thread Tools
Re: Buytable SCREWED.
Old
  (#21)
Josh_Borke
Member
 
Status: Offline
Posts: 152
Join Date: Jun 2004
Default Re: Buytable SCREWED. - 16-07-2004

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

Last edited by Josh_Borke; 16-07-2004 at 16:08..
  
Reply With Quote
Re: Buytable SCREWED.
Old
  (#22)
stefanhendriks
RealBot Author
 
stefanhendriks's Avatar
 
Status: Offline
Posts: 3,088
Join Date: Nov 2003
Location: Netherlands
Default Re: Buytable SCREWED. - 16-07-2004

i think your code should work...


Author of RealBot, "Arrakis" and "Dune 2 - The Maker" | co-Founder of Bots-United | Fundynamic | Blog | E-Mail me
  
Reply With Quote
Re: Buytable SCREWED.
Old
  (#23)
Josh_Borke
Member
 
Status: Offline
Posts: 152
Join Date: Jun 2004
Default Re: Buytable SCREWED. - 16-07-2004

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...
  
Reply With Quote
Re: Buytable SCREWED.
Old
  (#24)
stefanhendriks
RealBot Author
 
stefanhendriks's Avatar
 
Status: Offline
Posts: 3,088
Join Date: Nov 2003
Location: Netherlands
Default Re: Buytable SCREWED. - 16-07-2004

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


Author of RealBot, "Arrakis" and "Dune 2 - The Maker" | co-Founder of Bots-United | Fundynamic | Blog | E-Mail me
  
Reply With Quote
Re: Buytable SCREWED.
Old
  (#25)
Josh_Borke
Member
 
Status: Offline
Posts: 152
Join Date: Jun 2004
Default Re: Buytable SCREWED. - 17-07-2004

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;

Last edited by Josh_Borke; 17-07-2004 at 05:17..
  
Reply With Quote
Re: Buytable SCREWED.
Old
  (#26)
evy
Guest
 
Status:
Posts: n/a
Default Re: Buytable SCREWED. - 17-07-2004

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

Last edited by evy; 18-07-2004 at 09:34..
  
Reply With Quote
Re: Buytable SCREWED.
Old
  (#27)
Josh_Borke
Member
 
Status: Offline
Posts: 152
Join Date: Jun 2004
Default Re: Buytable SCREWED. - 18-07-2004

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
  
Reply With Quote
Re: Buytable SCREWED.
Old
  (#28)
Josh_Borke
Member
 
Status: Offline
Posts: 152
Join Date: Jun 2004
Default Re: Buytable SCREWED. - 22-07-2004

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.
  
Reply With Quote
Re: Buytable SCREWED.
Old
  (#29)
Josh_Borke
Member
 
Status: Offline
Posts: 152
Join Date: Jun 2004
Default Re: Buytable SCREWED. - 23-07-2004

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????:'(

Last edited by Josh_Borke; 23-07-2004 at 03:55..
  
Reply With Quote
Re: Buytable SCREWED.
Old
  (#30)
stefanhendriks
RealBot Author
 
stefanhendriks's Avatar
 
Status: Offline
Posts: 3,088
Join Date: Nov 2003
Location: Netherlands
Default Re: Buytable SCREWED. - 23-07-2004

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.


Author of RealBot, "Arrakis" and "Dune 2 - The Maker" | co-Founder of Bots-United | Fundynamic | Blog | E-Mail me
  
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 - 2025, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com