View Single Post
doesn't this prevent them from buying grenades?
Old
  (#1)
bluebyte
Guest
 
Status:
Posts: n/a
Default doesn't this prevent them from buying grenades? - 26-05-2004

I have R2.1 of sPlOrYgOn's dll. In bot.cpp we have (between lines 3346 and 3414) :
Code:
 
// Needs an Item ?
else if (pBot->iBuyCount < 7)
{
	 // Care first about buying Armor
	 if (pBot->iBuyCount == 4)
	 {
		 if ((pBot->pEdict->v.armorvalue == 0) && (pBot->bot_money > 650))
		 {
			if (pBot->bot_money > 1000)
			{
			 if (g_bIsOldCS15)
				 FakeClientCommand (pEdict, "buy;menuselect 8;menuselect 2\n");
			 else
				 FakeClientCommand (pEdict, "vesthelm\n");
			}
			else
			{
			 if (g_bIsOldCS15)
				 FakeClientCommand (pEdict, "buy;menuselect 8;menuselect 1\n");
			 else
				 FakeClientCommand (pEdict, "vest\n");
			}
		 }
	 }
	 // Buy Grenade or Defuse Kit
	 else
	 {
		 if (pBot->bot_money > 300)
		 {
			// If Defusion Map & Counter buy Defusion Kit
			if ((g_iMapType & MAP_DE) && (pBot->bot_team == TEAM_CS_COUNTER) && !pBot->b_has_defuse_kit)
			{
			 if (g_bIsOldCS15)
				 FakeClientCommand (pEdict, "buy;menuselect 8;menuselect 6\n");
			 else
				 FakeClientCommand (pEdict, "defuser\n");
			}
			// Else buy Grenade
			else
			{
			 int iGrenadeType = RANDOM_LONG (1, 100);
			 // Focus on HE Grenades
			 if (iGrenadeType < 70)
			 {
				 if (g_bIsOldCS15)
					 FakeClientCommand (pEdict, "buy;menuselect 8;menuselect 4\n");
				 else
					 FakeClientCommand (pEdict, "hegren\n");
			 }
			 else if (iGrenadeType < 90)
			 {
				 if (g_bIsOldCS15)
					 FakeClientCommand (pEdict, "buy;menuselect 8;menuselect 5\n");
				 else
					 FakeClientCommand (pEdict, "sgren\n");
			 }
			 else if (iGrenadeType < 100)
			 {
				 if (g_bIsOldCS15)
					 FakeClientCommand (pEdict, "buy;menuselect 8;menuselect 3\n");
				 else
					 FakeClientCommand (pEdict, "flash\n");
			 }
			}
		 }
	 }
If I not wrong, the bot is allowed to buy a grenade only if it doesn't buy an armor or a defuse kit. Shouldn't we remove these elses:
Code:
	 // Buy Grenade or Defuse Kit
	 else
	 {
and
Code:
 
			// Else buy Grenade
			else
			{
and then place the block

Code:
 
 
			 int iGrenadeType = RANDOM_LONG (1, 100);
			 // Focus on HE Grenades
			 if (iGrenadeType < 70)
			 {
				 if (g_bIsOldCS15)
					 FakeClientCommand (pEdict, "buy;menuselect 8;menuselect 4\n");
				 else
					 FakeClientCommand (pEdict, "hegren\n");
			 }
			 else if (iGrenadeType < 90)
			 {
				 if (g_bIsOldCS15)
					 FakeClientCommand (pEdict, "buy;menuselect 8;menuselect 5\n");
				 else
					 FakeClientCommand (pEdict, "sgren\n");
			 }
			 else if (iGrenadeType < 100)
			 {
				 if (g_bIsOldCS15)
					 FakeClientCommand (pEdict, "buy;menuselect 8;menuselect 3\n");
				 else
					 FakeClientCommand (pEdict, "flash\n");
			 }
just after this:
Code:
		 if (pBot->bot_money > 300)
		 {
and change 300 with for instance, 600?

this way it should first buy a grenade and then (if we place a second money-checking part) a defusal kit.

Would this be the reason why they so seldom(or never) buy (therefore use) grenades?

Last edited by bluebyte; 26-05-2004 at 22:51..
  
Reply With Quote