.:: 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
Need some help with pickup pistols
Old
  (#1)
The Storm
Council Member / E[POD]bot developer
 
The Storm's Avatar
 
Status: Offline
Posts: 1,618
Join Date: Jul 2004
Location: Bulgaria
Default Need some help with pickup pistols - 21-11-2004

I try many thinks and I can't get the bots to pickup weapons correctly.
On my last test if there is a pistol on the ground and bot have primary weapon, he don't switch to pistol and drop his primary weapon and after that he drop the pistol and else.

So can I do the pickup funciton to be a other task like PICKUP_PISTOL and if this is possibly how can I do it.
Sorry for stuped question but you knows that I'm new C++ coder(I now learning C++) and I'm new bot coder.Many thinks!!!
But I realy wont to continue this bot and I hope that all guys in this forums who can help me will help me

But for now don't tell me all that I must do, tell me only some thinks becorse I wont to do it with my ideas.I just wont some help for start and I hope that I will do the other thinks alone.

Last edited by The Storm; 21-11-2004 at 17:44..
  
Reply With Quote
Re: Need some help with pickup pistols
Old
  (#2)
@$3.1415rin
Council Member, Author of JoeBOT
 
@$3.1415rin's Avatar
 
Status: Offline
Posts: 1,381
Join Date: Nov 2003
Location: Germany
Default Re: Need some help with pickup pistols - 21-11-2004

you have to switch to the secondary weapon already some time in advance, because switching weapons is done via messages, therefore it needs time, and the animations maybe, too.


  
Reply With Quote
Re: Need some help with pickup pistols
Old
  (#3)
The Storm
Council Member / E[POD]bot developer
 
The Storm's Avatar
 
Status: Offline
Posts: 1,618
Join Date: Jul 2004
Location: Bulgaria
Default Re: Need some help with pickup pistols - 21-11-2004

But yes I use SelectWeaponbyNumber(pBot, iWeaponNum); to switch to pistol but is not working.
I try only with pistol pickup code and the bots pickup pistols correctly and don't drop his primary weapon.
But when I use pistol pickup code and primary pickup code togeder is not working.
I don't know what is the reason.
  
Reply With Quote
Re: Need some help with pickup pistols
Old
  (#4)
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: Need some help with pickup pistols - 21-11-2004

What Aspirin meant is that there needs to be a delay (at least one frame time) between weapon switching and weapon dropping. If you make your bot issue the "drop" client command right after your SelectWeaponByNumber() function, the bot will not drop the right weapon. You must make your bot select the right weapon, WAIT a few frames, and only then drop it.

Some client commands are not processed by the engine right at the time you issue them, but are buffered so that they are processed at the end of the frame, or at the beginning of the next frame. I suspect that is what's happening with the weapon selection client command.

What you can do, is not allow the bot to send the "drop" client command unless you are CERTAIN that it's holding the right weapon in its hands (by continuously checking its current weapon, for example, or else by catching the weaponselect network message).



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
Re: Need some help with pickup pistols
Old
  (#5)
The Storm
Council Member / E[POD]bot developer
 
The Storm's Avatar
 
Status: Offline
Posts: 1,618
Join Date: Jul 2004
Location: Bulgaria
Default Re: Need some help with pickup pistols - 22-11-2004

OK I try with wait time but again is not working.
I think that the two codes for Secndary and Primari weapon pickup are meset up are togeder.
So I post the code here but I post it clean with no wait times becose maybe there is a mistake in the code.Wait time is not working.

Code:
 		 // Near to Weapon ?
 			else if(f_item_distance<50)
 			{
 			   // Secondary weapon.
 			   int iWeaponNum = 0;
 
 			   for (i = 0; i < 7; i++)
 			   {
 				  if (pBot->pEdict->v.weapons & (1 << cs_weapon_select[i].iId))
 					 iWeaponNum = i;
 			   }
 
 			   if (iWeaponNum > 0)
 			   {
 		    	  if(pBot->current_weapon.iId != cs_weapon_select[iWeaponNum].iId)
 				  {
 		    	  if(pBot->current_weapon.iId != CS_WEAPON_INSWITCH)
 				  SelectWeaponbyNumber(pBot, iWeaponNum);
 				  }
 				  else
 				  FakeClientCommand(pEdict, "drop","", NULL);
 				  if (BotHasShield (pBot)) // If we have the shield...
 				  FakeClientCommand(pEdict, "drop","", NULL); // discard both shield and pistol
 			   }
 			   else
 				   pBot->iNumWeaponPickups++;
 			}
 			else
 			{
 				// Primary weapon.
 				int iWeaponNum = HighestWeaponOfEdict(pEdict);
 		    	if (iWeaponNum > 6 || BotHasPrimaryWeapon(pBot) || BotHasShield (pBot))
 				{
 		    		if(pBot->current_weapon.iId != cs_weapon_select[iWeaponNum].iId)
 					{
 		    		    if(pBot->current_weapon.iId != CS_WEAPON_INSWITCH)
 		    		    	SelectWeaponbyNumber(pBot,iWeaponNum);
 					}
 					else
 		    		    FakeClientCommand(pEdict, "drop","", NULL);
 
 				}
 				else
 					pBot->iNumWeaponPickups++;
 			}
 			break;
Tell me where I mistake.
  
Reply With Quote
Re: Need some help with pickup pistols
Old
  (#6)
@$3.1415rin
Council Member, Author of JoeBOT
 
@$3.1415rin's Avatar
 
Status: Offline
Posts: 1,381
Join Date: Nov 2003
Location: Germany
Default Re: Need some help with pickup pistols - 22-11-2004

is this really supposed to be this way :

PHP Code:
else if(f_item_distance<50)
             {
                
// Secondary weapon.
               
[....]
             }
             else
             {
                 
// Primary weapon.
              
[....]   
             }
             break; 
or was i counting a wrong number of { and } ?


  
Reply With Quote
Re: Need some help with pickup pistols
Old
  (#7)
The Storm
Council Member / E[POD]bot developer
 
The Storm's Avatar
 
Status: Offline
Posts: 1,618
Join Date: Jul 2004
Location: Bulgaria
Default Re: Need some help with pickup pistols - 22-11-2004

What do you mean ???

If I do it like this
PHP Code:
  else if(f_item_distance<50)
              {
                 
// Primary weapon.
                 
[....]
              }
              else
              {
                 
// Secondary weapon.
               
[....]   
              }
              break; 
This way is not working becose if I do that the bots don't pickup pistol never.I don't know what is the reason
</font></font>

Last edited by The Storm; 22-11-2004 at 18:59..
  
Reply With Quote
Re: Need some help with pickup pistols
Old
  (#8)
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: Need some help with pickup pistols - 22-11-2004

aspirin is right, this code can't work

if you want to understand why, indent your code better and look at how the bot decides whether it's a primary or a secondary weapon...



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
Re: Need some help with pickup pistols
Old
  (#9)
The Storm
Council Member / E[POD]bot developer
 
The Storm's Avatar
 
Status: Offline
Posts: 1,618
Join Date: Jul 2004
Location: Bulgaria
Default Re: Need some help with pickup pistols - 22-11-2004

Hmm is there way to make the bots to pickup pistols with other task like PICKUP_PISTOL or something else.
And I can't understand where I wrong in the code.

Last edited by The Storm; 22-11-2004 at 21:33..
  
Reply With Quote
Re: Need some help with pickup pistols
Old
  (#10)
@$3.1415rin
Council Member, Author of JoeBOT
 
@$3.1415rin's Avatar
 
Status: Offline
Posts: 1,381
Join Date: Nov 2003
Location: Germany
Default Re: Need some help with pickup pistols - 27-11-2004

don't despair, some bugs take month to be found, if ever. and I guess noone can really help you here, just based on a few lines of code.

for my post above, what I meant : I meant that the decision if it's a secondary or primary weapon doesnt have anything to do with distance, therefore I asked if that was right


  
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 - 2024, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com