View Single Post
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