Thread: UTIL_SelectItem
View Single Post
Re: UTIL_SelectItem
Old
  (#5)
dstruct2k
 
dstruct2k's Avatar
 
Status: Offline
Posts: 225
Join Date: Feb 2004
Default Re: UTIL_SelectItem - 09-06-2004

Alright so what I've done is...

In bot.cpp
Replaced
Code:
 // TODO
// The priority is:
// - primary
// - secondary
// - knife
With:
Code:
   if (FUNC_BotHasWeapon(this, UTIL_GiveWeaponName (iPrimaryWeapon)) &&	 // we have a primary
	   current_weapon.iId != UTIL_GiveWeaponName (iPrimaryWeapon) &&	  // that's not the current, empty gun
			 func_distance(pEdict->v.origin, v_enemy) > 600)		  // and we are not close enough to knife
   {
	UTIL_SelectItem (pEdict, UTIL_GiveWeaponName (iPrimaryWeapon));	  // select the primary
	return;
   }
   else
   {
	if (FUNC_BotHasWeapon(this, UTIL_GiveWeaponName (iSecondaryWeapon)) &&	// we have a secondary
		current_weapon.iId != UTIL_GiveWeaponName (iSecondaryWeapon) &&	 // that's not the current, empty gun
			  func_distance(pEdict->v.origin, v_enemy) > 600)		 // and we are not close enough to knife
	{
	 UTIL_SelectItem (pEdict, UTIL_GiveWeaponName (iSecondaryWeapon));	// select the secondary
	 return;
	}
	else
	{
	 if (FUNC_BotHasWeapon(this, CS_WEAPON_KNIFE) &&		 // we have a knife (for non-knife maps)
		 current_weapon.iId != CS_WEAPON_KNIFE)		  // that's not the current, empty knife (somehow, lol)
	 {
	  UTIL_SelectItem (pEdict, "weapon_knife");		 // slice and dice!
	  return;
	 }
	}
   }

EDIT:
Whoops. It doesn't compile. 9_9 Errors returned:
Code:
Compiling...
bot.cpp
bot.cpp(887) : error C2664: 'FUNC_BotHasWeapon' : cannot convert parameter 2 from 'char *' to 'int'
		This conversion requires a reinterpret_cast, a C-style cast or function-style cast
bot.cpp(888) : error C2446: '!=' : no conversion from 'char *' to 'int'
		This conversion requires a reinterpret_cast, a C-style cast or function-style cast
bot.cpp(888) : error C2040: '!=' : 'int' differs in levels of indirection from 'char *'
bot.cpp(896) : error C2664: 'FUNC_BotHasWeapon' : cannot convert parameter 2 from 'char *' to 'int'
		This conversion requires a reinterpret_cast, a C-style cast or function-style cast
bot.cpp(897) : error C2446: '!=' : no conversion from 'char *' to 'int'
		This conversion requires a reinterpret_cast, a C-style cast or function-style cast
bot.cpp(897) : error C2040: '!=' : 'int' differs in levels of indirection from 'char *'

Last edited by dstruct2k; 09-06-2004 at 02:24..
  
Reply With Quote