View Single Post
Markus_Wyand
Junior Member
Join Date: Aug 2022
Old 08-30-2022 , 21:05   Re: [TF2] Give Bots Weapons (10.10.2021)
Reply With Quote #110

Oh, forget about it, i actually found a work around it to make it work properly.
I just had to experiment and tweak the code a little.
**ORIGINAL BY YOU**:
case TFClass_Soldier:
{
int rnd = GetRandomUInt(0,3);
if(rnd != 0)
{
TF2_RemoveWeaponSlot(client, 0);
}
switch (rnd)
{
case 1:
{
CreateWeapon(client, "tf_weapon_rocketlauncher_directhit", 127, 1);
}
**WHAT I DID**:
case TFClass_Soldier:
{
int rnd = GetRandomUInt(1,3);
{
switch (rnd)
{
case 1:
{
TF2_RemoveWeaponSlot(client, 0);
CreateWeapon(client, "tf_weapon_rocketlauncher", 1; **<-- this supposed to be 18**
}

Basically removed the " if(rnd != 0) ", changed the order of some stuff, forced the bot to pick from 1,3 instead of 0,3 and add the Default Weapon (in this case the rocket launcher [18]) for the bot to choose it.
This way they are forced to pick one of the 3 weapons, and dont go A pose or missing weapons anymore.
Works like a charm. But thanks for answering, didn't expect to get attention since the last reply was 1 year ago...
EDIT: The thing works better but its still flawed :C

Last edited by Markus_Wyand; 08-31-2022 at 18:39.
Markus_Wyand is offline