.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   General Bot Coding (http://forums.bots-united.com/forumdisplay.php?f=24)
-   -   crowbars and botman's "bot 10" (http://forums.bots-united.com/showthread.php?t=3316)

Lord_Draco 02-01-2005 04:55

crowbars and botman's "bot 10"
 
Hi, I haven't got a clue about bots but I have put the bot code from botman's "bot 10" in my MOD. I need to make the bots use the crowbar across all skill levels(the 3 lowest ones dont use it at all) but can't figure out how to make it do that. I think it's in this part of bot_combat.cpp

Code:

  // if bot is carrying the crowbar...
      if (pev->weapons & (1<
      {
        // if close to enemy, and skill level is 1, 2 or 3, use the crowbar
        if (((distance <= 40) && (weapon_choice == 0)) ||
        (weapon_choice == WEAPON_CROWBAR))
        {
                  new_weapon = weapon_ptr[WEAPON_CROWBAR];
 
                  // check if the bot isn't already using this item...
                  if (m_pActiveItem != new_weapon)
                          SelectItem("weapon_crowbar");  // select the crowbar
 
                  pev->button |= IN_ATTACK;  // use primary attack (whack! whack!)
 
                  // set next time to "shoot"
                  f_shoot_time = gpGlobals->time + 0.3 +
                  RANDOM_FLOAT(primary_fire_delay[WEAPON_CROWBAR][bot_skill][0],
                  primary_fire_delay[WEAPON_CROWBAR][bot_skill][1]);
                  return TRUE;
          } 
      }

what I don't understand is, where is the skill checked?

botman 02-01-2005 15:52

Re: crowbars and botman's "bot 10"
 
The code you posted doesn't contain anything that checks the skill level. Here is the original code from bot10 in bot_combat.cpp...
Code:

  // if close to enemy, and skill level is 1, 2 or 3, use the crowbar
  if (((distance <= 40) && (bot_skill <= 2) && (weapon_choice == 0)) ||
          (weapon_choice == WEAPON_CROWBAR))
  {

The check for (bot_skilll <= 2) restricts this weapon to bots with skill=0, 1, or 2, removing this check...
Code:

  // if close to enemy, use the crowbar
  if (((distance <= 40) && (weapon_choice == 0)) ||
          (weapon_choice == WEAPON_CROWBAR))
  {

...would allow any skill level bot to use the crowbar.

botman

Lord_Draco 03-01-2005 11:14

Re: crowbars and botman's "bot 10"
 
Strange, that change is alrready in the code and it seems that all skill levels don't use crowbar. Because my MOD spawns players with only the crowbar I am just going to make them ignore targets untill they find a crowbar. Thanks for your reply Botman:)


All times are GMT +2. The time now is 09:30.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.