.:: 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
f_move_speed = 0.0; and IN_ATTACK Problem
Old
  (#1)
Tea
Guest
 
Status:
Posts: n/a
Default f_move_speed = 0.0; and IN_ATTACK Problem - 16-05-2004

Code:
 
	if (pBot->f_duck_time > gpGlobals->time)
	pBot->f_move_speed = 0.0;
	{	
	  pBot->f_duck_time = gpGlobals->time + 1.5;
	  FakeClientCommand(pEdict, "say", "DUCKING", NULL);
	  pEdict->v.button |= IN_ATTACK;   // fire the weapon
	  return TRUE;
	}
Hi is me again, this is part of my shootnow(), If I remove the pBot->f_move_speed = 0.0; everything work fine, but if the pBot->f_move_speed = 0.0; active, the bots only call IN_ATTACK one time, if their enemy won't die in the first shot, than two bot will only facing each other and do nothing, I am sure the shootnow() keep calling in every frame since two bots keep saying DUCKING.

But if the bot can move forward only one little step, they can fire another shot. This also happen to breakable object, if the bot shoot at the window and if he can't break it in the first shoot, he just stand still before the window and do nothing, but if the bot can move forward a little step, then he can fire another shoot, please help.
  
Reply With Quote
Re: f_move_speed = 0.0; and IN_ATTACK Problem
Old
  (#2)
sPlOrYgOn
<-- He did it.
 
sPlOrYgOn's Avatar
 
Status: Offline
Posts: 1,558
Join Date: Jan 2004
Location: Los Angeles, California, USA, North America, Earth, Solar System, Milky Way.
Default Re: f_move_speed = 0.0; and IN_ATTACK Problem - 16-05-2004

thats because the if statement is only for
pBot->f_move_speed = 0.0;
the other stuff will always run.
instead have it
Code:
   if (pBot->f_duck_time > gpGlobals->time)
    {
      pBot->f_move_speed = 0.0;
      pBot->f_duck_time = gpGlobals->time + 1.5;
      FakeClientCommand(pEdict, "say", "DUCKING", NULL);
      pEdict->v.button |= IN_ATTACK;   // fire the weapon
      return TRUE;
    }
  
Reply With Quote
Re: f_move_speed = 0.0; and IN_ATTACK Problem
Old
  (#3)
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: f_move_speed = 0.0; and IN_ATTACK Problem - 16-05-2004

is it normal that with such a code the bot will keep ducking and firing forever ?



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: f_move_speed = 0.0; and IN_ATTACK Problem
Old
  (#4)
stefanhendriks
RealBot Author
 
stefanhendriks's Avatar
 
Status: Offline
Posts: 3,088
Join Date: Nov 2003
Location: Netherlands
Default Re: f_move_speed = 0.0; and IN_ATTACK Problem - 17-05-2004

hehe yes, i see it too now. The code should not say:

pBot->f_duck_time = gpGlobals->time + 1.5;

within the scope, it should just say:

pBot->pEdict->v.button |= IN_DUCK;



Author of RealBot, "Arrakis" and "Dune 2 - The Maker" | co-Founder of Bots-United | Fundynamic | Blog | E-Mail me
  
Reply With Quote
Re: f_move_speed = 0.0; and IN_ATTACK Problem
Old
  (#5)
Tea
Guest
 
Status:
Posts: n/a
Default Re: f_move_speed = 0.0; and IN_ATTACK Problem - 17-05-2004

Actually my code is like this:

Code:
 
	if (pBot->f_duck_time > gpGlobals->time)
	pBot->f_move_speed = 0.0;
 
	if (RANDOM_LONG(1, 100) <= 100) //now 100% because I want to test it
	{	
	 pBot->f_duck_time = gpGlobals->time + 1.5;
	 FakeClientCommand(pEdict, "say", "DUCKING", NULL);
	 pEdict->v.button |= IN_ATTACK; // fire the weapon
	 return TRUE;
	}
Yes, I do want the bot duck for 1.5 sec and keep firing until the enemy die, the problem is the bot only fire one shoot(only call IN_ATTACK one time), but I am sure this code have called every frame since although the bot only fire one time, but they are keep saying DUCKING DUCKING DUCKING.......

If I remove the pBot->f_move_speed = 0.0; function and now the bot will duck but not duck and don't move, they will duck and move forward at the same time, but now they can keep shooting without problem until the enemy die.

Or am I mis-understand how pBot->f_move_speed = 0.0; work? I think it only make the bot don't move but do you mean it will make the bot totally pause ? If yes which command can make the bot only stop move but not pause ?
  
Reply With Quote
Re: f_move_speed = 0.0; and IN_ATTACK Problem
Old
  (#6)
Tea
Guest
 
Status:
Posts: n/a
Default Re: f_move_speed = 0.0; and IN_ATTACK Problem - 20-05-2004

Hmm no one know ? Or botman can you help please ?
  
Reply With Quote
Re: f_move_speed = 0.0; and IN_ATTACK Problem
Old
  (#7)
sPlOrYgOn
<-- He did it.
 
sPlOrYgOn's Avatar
 
Status: Offline
Posts: 1,558
Join Date: Jan 2004
Location: Los Angeles, California, USA, North America, Earth, Solar System, Milky Way.
Default Re: f_move_speed = 0.0; and IN_ATTACK Problem - 20-05-2004

Code:
	if (pBot->f_duck_time < gpGlobals->time)
	{
		if (RANDOM_LONG(1, 100) <= 10)
		{
			pBot->f_move_speed = 0.0;
			pBot->f_duck_time = gpGlobals->time + 1.5;
			FakeClientCommand(pEdict, "say", "DUCKING", NULL);
			pEdict->v.button |= IN_ATTACK; // fire the weapon
			return TRUE;
		}
	}
perhaps you wanted this?

they kept saying DUCKING because you made them say ducking 100% of the time..

Last edited by sPlOrYgOn; 20-05-2004 at 12:38..
  
Reply With Quote
Re: f_move_speed = 0.0; and IN_ATTACK Problem
Old
  (#8)
botman
Super Moderator
 
Status: Offline
Posts: 280
Join Date: Jan 2004
Location: Plano, TX
Default Re: f_move_speed = 0.0; and IN_ATTACK Problem - 20-05-2004

You need to toggle the IN_ATTACK button on and off. If you keep setting it to IN_ATTACK during EVERY frame, it's the same thing as holding the trigger down (which will only fire ONE shot unless you are firing an automatic weapon).

Try something like this...
Code:
if (RANDOM_LONG(1, 100) <= 100) //now 100% because I want to test it
{
	pBot->f_duck_time = gpGlobals->time + 1.5;
	FakeClientCommand(pEdict, "say", "DUCKING", NULL);
	if (RANDOM_LONG(1, 2) == 1)
		pEdict->v.button |= IN_ATTACK; // fire the weapon
	else
		pEdict->v.button = 0;  // stop pressing the button
	return TRUE;
}
This will cause the IN_ATTACK button to rapidly toggle (randomly) on and off. It's the same sort of thing used in the code that respawns an HPB bot when playing deathmatch.

botman
  
Reply With Quote
Re: f_move_speed = 0.0; and IN_ATTACK Problem
Old
  (#9)
Tea
Guest
 
Status:
Posts: n/a
Default Re: f_move_speed = 0.0; and IN_ATTACK Problem - 22-05-2004

OMG it work now ! Botman THANK YOU VERY MUCH !
  
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