.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   General Bot Coding (http://forums.bots-united.com/forumdisplay.php?f=24)
-   -   Need some help for shield support (http://forums.bots-united.com/showthread.php?t=2820)

The Storm 20-10-2004 20:12

Need some help for shield support
 
Please someone to tell me where I wrong.
Quote:

{CS_WEAPON_SHIELDGUN, "weapon_shield","models/w_shield.mdl", 0.0, 2200.0, 0.0, 1200.0,
TRUE, TRUE, 2.3,650,
1,1,1,8,8,5,5,TRUE},
The bots don't won to buy shield and thats it.
Someone to help me please.

Pierre-Marie Baty 20-10-2004 21:57

Re: Need some help for shield support
 
There are other POD-bot offsprings here that can handle the CS 1.6 shield, both of which are open source.

Look in the source code of the following bots :
- POD-bot 2.6mm
- YaPB

OT: did you work out the metamod issue already ?

The Storm 20-10-2004 22:32

Re: Need some help for shield support
 
Quote:

Originally Posted by Pierre-Marie Baty
OT: did you work out the metamod issue already ?

No, I must firs clean all of the bugs on the bots before add new thinks.

Whistler 21-10-2004 12:24

Re: Need some help for shield support
 
the "CS_WEAPON_SHIELDGUN (1 << 2)" weapon ID actually doesn't exist. I just added it to make them buy the shield.

The Storm 21-10-2004 18:04

Re: Need some help for shield support
 
Quote:

Originally Posted by Whistler
the "CS_WEAPON_SHIELDGUN (1 << 2)" weapon ID actually doesn't exist. I just added it to make them buy the shield.

I Don't know were to add this line.
In to bot.h????
Or to anoder file??????

Pierre-Marie Baty 21-10-2004 22:50

Re: Need some help for shield support
 
Look where the other CS_WEAPON_xxx are defined...

The Storm 22-10-2004 00:07

Re: Need some help for shield support
 
Quote:

Originally Posted by Pierre-Marie Baty
Look where the other CS_WEAPON_xxx are defined...

I discover that I were allready do that in Bot_Weapons.h

// weapon ID values for Counter-Strike
#define CS_WEAPON_P228 1
#define CS_WEAPON_SHIELDGUN 2
#define CS_WEAPON_SCOUT 3
#define CS_WEAPON_HEGRENADE 4
#define CS_WEAPON_XM1014 5
#define CS_WEAPON_C4 6
#define CS_WEAPON_MAC10 7
#define CS_WEAPON_AUG 8
#define CS_WEAPON_SMOKEGRENADE 9
#define CS_WEAPON_ELITE 10
#define CS_WEAPON_FIVESEVEN 11
#define CS_WEAPON_UMP45 12
#define CS_WEAPON_SG550 13
#define CS_WEAPON_GALIL 14
#define CS_WEAPON_FAMAS 15
#define CS_WEAPON_USP 16
#define CS_WEAPON_GLOCK18 17
#define CS_WEAPON_AWP 18
#define CS_WEAPON_MP5NAVY 19
#define CS_WEAPON_M249 20
#define CS_WEAPON_M3 21
#define CS_WEAPON_M4A1 22
#define CS_WEAPON_TMP 23
#define CS_WEAPON_G3SG1 24
#define CS_WEAPON_FLASHBANG 25
#define CS_WEAPON_DEAGLE 26
#define CS_WEAPON_SG552 27
#define CS_WEAPON_AK47 28
#define CS_WEAPON_KNIFE 29
#define CS_WEAPON_P90 30

but the bots don't buy shiel again.
Some other ideas

Pierre-Marie Baty 22-10-2004 04:11

Re: Need some help for shield support
 
well, check your buy code, then ??

The Storm 27-10-2004 00:24

Re: Need some help for shield support
 
Oh I get all shield usage code form YAPB and the bots pickup shield, use the shield correctly but they can't buy shield.
I can't fix this problem from 4 days.
Buy code is ok.The bots must buy shield becorce he is defined in bot weapons and in bot_combat.cpp and added as 25 ID in weapon config file but bots can't buy shield.
All other bugs are fixed.
Please help me.

Huntkillaz 27-10-2004 00:53

Re: Need some help for shield support
 
Quote:

Originally Posted by THE_STORM
Oh I get all shield usage code form YAPB and the bots pickup shield, use the shield correctly but they can't buy shield.
I can't fix this problem from 4 days.
Buy code is ok.The bots must buy shield becorce he is defined in bot weapons and in bot_combat.cpp and added as 25 ID in weapon config file but bots can't buy shield.
All other bugs are fixed.
Please help me.

try pb mm source

Pierre-Marie Baty 27-10-2004 01:37

Re: Need some help for shield support
 
Make your bots display what menu/submenu they are browsing when they buy stuff, so that you can know what they are buying. Of course do that with just 1 bot, not the whole team :)

The Storm 27-10-2004 11:05

Re: Need some help for shield support
 
Quote:

Originally Posted by Pierre-Marie Baty
Make your bots display what menu/submenu they are browsing when they buy stuff, so that you can know what they are buying. Of course do that with just 1 bot, not the whole team :)

This is impossible becorse the bots have one table with ID numbers of the weapons(how much money cost the weapon and with who buy; menuselect they can buy this weapons).They just buy better weapons if they have enough money, but I don't know how to say to the bots that the CS_WEAPON_SHIELDGUN is a good weapon.
Light Ninja is created a table that say to the bots that some weapon is good, I added CS_WEAPON_SHIELDGUN in this table but the bots don't buy shield again.
Other ideas???

Whistler 27-10-2004 11:17

Re: Need some help for shield support
 
just consider this CS_WEAPON_SHIELDGUN as a primary weapon :)

Pierre-Marie Baty 27-10-2004 13:13

Re: Need some help for shield support
 
post this table here, and the function that uses it.

The Storm 27-10-2004 18:09

Re: Need some help for shield support
 
So there is the table

bot_weapon_select_t cs_weapon_select[NUM_WEAPONS+1] = {
// Knife
{CS_WEAPON_KNIFE, "weapon_knife","models/w_knife.mdl",0.0, 50.0, 0.0, 0.0,
TRUE, TRUE, 0.0, 0, 0, -1, -1, 0, 0, 0, 0,FALSE},
// Pistols
// 1280
{CS_WEAPON_USP, "weapon_usp","models/w_usp.mdl", 0.0, 4096.0, 0.0, 1200.0,
TRUE, FALSE, 2.8, 500, 1, -1, -1, 1, 1, 2, 2,FALSE},
// 1536
{CS_WEAPON_GLOCK18, "weapon_glock18","models/w_glock18.mdl",0.0, 2048.0, 0.0, 1200.0,
TRUE, FALSE, 2.3, 400, 1, -1, -1, 1, 2, 1, 1,FALSE},
// 1024
{CS_WEAPON_DEAGLE, "weapon_deagle","models/w_deagle.mdl",0.0, 4096.0, 0.0, 1200.0,
TRUE, FALSE, 2.3, 650, 1, 2, 2, 1, 3, 4, 4,TRUE},
// 1024
{CS_WEAPON_P228, "weapon_p228","models/w_p228.mdl",0.0, 4096.0, 0.0, 1200.0,
TRUE, FALSE, 2.8, 600, 1, 2, 2, 1, 4, 3, 3,FALSE},
// new for CS 7.0
// 1280
{CS_WEAPON_ELITE, "weapon_elite","models/w_elite.mdl",0.0, 4096.0, 0.0, 1200.0,
TRUE, FALSE, 4.6, 1000, 1, 0, 0, 1, 5, 5, 5,FALSE},
// new for CS 1.0
{CS_WEAPON_FIVESEVEN, "weapon_fiveseven","models/w_fiveseven.mdl", 0.0, 4096.0, 0.0, 1200.0,
TRUE, FALSE, 3.17, 750, 1, 1, 1, 1, 6, 5, 5,FALSE},
// Shotguns
// 1024
{CS_WEAPON_M3, "weapon_m3","models/w_m3.mdl",0.0,2048.0, 0.0, 1200.0,
TRUE, FALSE, 1.1, 1700, 1, 2, -1, 2, 1, 1, 1,FALSE},
// 1024
{CS_WEAPON_XM1014, "weapon_xm1014","models/w_xm1014.mdl",0.0,2048.0, 0.0, 1200.0,
TRUE, FALSE, 0.9, 3000, 1, 2, -1, 2, 2, 2, 2,FALSE},
// Sub Machine Guns
// 1536
{CS_WEAPON_MP5NAVY, "weapon_mp5navy","models/w_mp5.mdl",0.0,2048.0, 0.0, 1200.0,
TRUE, TRUE, 2.74, 1500, 1, 2, 1, 3, 1, 2, 2,FALSE},
{CS_WEAPON_TMP, "weapon_tmp","models/w_tmp.mdl",0.0,2048.0, 0.0, 1200.0,
TRUE, TRUE, 2.2, 1250, 1, 1, 1, 3, 2, 1, 1,FALSE},
// 1536
{CS_WEAPON_P90, "weapon_p90","models/w_p90.mdl", 0.0,2048.0, 0.0, 1200.0,
TRUE, TRUE, 3.5, 2350, 1, 2, 1, 3, 3, 4, 4,FALSE},
// 1536
{CS_WEAPON_MAC10, "weapon_mac10","models/w_mac10.mdl", 0.0,2048.0, 0.0, 1200.0,
TRUE, TRUE, 3.3, 1400, 1, 0, 0, 3, 4, 1, 1,FALSE},
// new for CS 1.0
{CS_WEAPON_UMP45, "weapon_ump45","models/w_ump45.mdl",0.0,2048.0, 0.0, 1200.0,
TRUE, TRUE, 4.15, 1700, 1, 2, 2, 3, 5, 3, 3,FALSE},
// Rifles
// 2048
{CS_WEAPON_AK47, "weapon_ak47","models/w_ak47.mdl", 0.0, 4096.0, 0.0, 1200.0,
TRUE, TRUE, 2.6, 2500, 1, 0, 0, 4, 1, 2, 2,TRUE},
{CS_WEAPON_SG552, "weapon_sg552","models/w_sg552.mdl",0.0, 4096.0, 0.0, 1200.0,
TRUE, TRUE, 4.0, 3500, 1, 0, -1, 4, 2, 4, 4,TRUE},
{CS_WEAPON_M4A1, "weapon_m4a1","models/w_m4a1.mdl", 0.0, 4096.0, 0.0, 1200.0,
TRUE, TRUE, 3.2, 3100, 1, 1, 1, 4, 3, 3, 3,TRUE},
{CS_WEAPON_AUG, "weapon_aug","models/w_aug.mdl",0.0, 4096.0, 0.0, 1200.0,
TRUE, TRUE, 3.5, 3500, 1, 1, 1, 4, 4, 4, 4,TRUE},
// Sniper Rifles
// 1024
{CS_WEAPON_SCOUT, "weapon_scout","models/w_scout.mdl", 300.0, 2048.0, 0.0, 1200.0,
TRUE, FALSE, 2.2, 2750, 1, 2, 0, 4, 5, 3, 2, TRUE},
// 1280
{CS_WEAPON_AWP, "weapon_awp","models/w_awp.mdl",0.0, 4096.0, 0.0, 1200.0,
TRUE, FALSE, 2.6, 4750, 1, 2, 0, 4, 6, 5, 6,TRUE},
// 1024
{CS_WEAPON_G3SG1, "weapon_g3sg1","models/w_g3sg1.mdl",300.0, 4096.0, 0.0, 1200.0,
TRUE, FALSE, 4.9, 5000, 1, 0, 2, 4, 7, 6, 6,TRUE},
{CS_WEAPON_SG550, "weapon_sg550","models/w_sg550.mdl",300.0, 4096.0, 0.0, 1200.0,
TRUE, FALSE, 4.128, 4200, 1, 1, 1, 4, 8, 5, 5,TRUE},
// Machine Guns
{CS_WEAPON_M249, "weapon_m249","models/w_m249.mdl",0.0,2048.0, 0.0, 1200.0,
TRUE, TRUE, 4.85, 5750, 1, 2, 1, 5, 1, 1, 1,TRUE},
{CS_WEAPON_FAMAS, "weapon_famas","models/w_famas.mdl", 0.0, 4096.0, 0.0, 1200.0,
TRUE, TRUE, 3.2, 2250, 1, 1, 1, 4, -1, 1, 1,TRUE},
{CS_WEAPON_GALIL, "weapon_galil","models/w_galil.mdl", 0.0, 4096.0, 0.0, 1200.0,
TRUE, TRUE, 3.2, 2000, 1, 0, 0, 4, -1, 1, 1,TRUE},
{CS_WEAPON_SHIELDGUN, "weapon_shield","models/w_shield.mdl", 0.0, 0.0, 0.0, 0.0,
TRUE, FALSE, 0.0, 2200, 0, 1, 1, 8, -1, 8, 8,FALSE},
//terminator
{0, "","", 0.0, 0.0, 0.0, 0.0, TRUE, FALSE, 0.0,0,0,0,0,0}
};

Whistler how to consider CS_WEAPON_SHIELDGUN as a primary weapon.
Sorry for stupid qestion but I'm a new in bots coding.

Pierre-Marie Baty 27-10-2004 19:36

Re: Need some help for shield support
 
Could you use the [code] tags ? Else it's difficult to read. Please also post the declaration of the table (the struct members) so that we get an idea of who does what, and post the function(s) that call this table. So far we see numbers but we don't really see their purpose.

The Storm 27-10-2004 20:08

Re: Need some help for shield support
 
Quote:

Originally Posted by Pierre-Marie Baty
Could you use the [code] tags ? Else it's difficult to read. Please also post the declaration of the table (the struct members) so that we get an idea of who does what, and post the function(s) that call this table. So far we see numbers but we don't really see their purpose.

{CS_WEAPON_SHIELDGUN, "weapon_shield","models/w_shield.mdl", 0.0, 0.0, 0.0, 0.0,
TRUE, FALSE, 0.0, 2200, 0, 1, 1, 8, -1, 8, 8,FALSE},

So 2200 is money that cost the weapon,
The numbers 8,-1, 8, 8 are the buy numbers.
-1 is added for anoder function from Whistler that check if we are running CS 1.5 to igrone this weapon.
Anoder numbers I don't know for what are there.
Light Ninja don't send me any titorials so I can't fix this.
I think that Whistler know for whats are this numbers becorce he added to the bots CS_WEAPON_FAMAS and CS_WEAPON_GALIL.
So if you PMB can't help me I will wait for help from Whistler.

MusicMan 27-10-2004 22:34

Re: Need some help for shield support
 
Code:

bot_weapon_select_t cs_weapon_select[NUM_WEAPONS+1] = {
// Knife
{CS_WEAPON_KNIFE, "weapon_knife","models/w_knife.mdl",0.0, 50.0, 0.0, 0.0,
TRUE, TRUE, 0.0, 0, 0, -1, -1, 0, 0, 0, 0,FALSE},
// Pistols
// 1280
{CS_WEAPON_USP, "weapon_usp","models/w_usp.mdl", 0.0, 4096.0, 0.0, 1200.0,
TRUE, FALSE, 2.8, 500, 1, -1, -1, 1, 1, 2, 2,FALSE},
// 1536
{CS_WEAPON_GLOCK18, "weapon_glock18","models/w_glock18.mdl",0.0, 2048.0, 0.0, 1200.0,
TRUE, FALSE, 2.3, 400, 1, -1, -1, 1, 2, 1, 1,FALSE},
// 1024
{CS_WEAPON_DEAGLE, "weapon_deagle","models/w_deagle.mdl",0.0, 4096.0, 0.0, 1200.0,
TRUE, FALSE, 2.3, 650, 1, 2, 2, 1, 3, 4, 4,TRUE},
// 1024
{CS_WEAPON_P228, "weapon_p228","models/w_p228.mdl",0.0, 4096.0, 0.0, 1200.0,
TRUE, FALSE, 2.8, 600, 1, 2, 2, 1, 4, 3, 3,FALSE},
// new for CS 7.0
// 1280
{CS_WEAPON_ELITE, "weapon_elite","models/w_elite.mdl",0.0, 4096.0, 0.0, 1200.0,
TRUE, FALSE, 4.6, 1000, 1, 0, 0, 1, 5, 5, 5,FALSE},
// new for CS 1.0
{CS_WEAPON_FIVESEVEN, "weapon_fiveseven","models/w_fiveseven.mdl", 0.0, 4096.0, 0.0, 1200.0,
TRUE, FALSE, 3.17, 750, 1, 1, 1, 1, 6, 5, 5,FALSE},
// Shotguns
// 1024
{CS_WEAPON_M3, "weapon_m3","models/w_m3.mdl",0.0,2048.0, 0.0, 1200.0,
TRUE, FALSE, 1.1, 1700, 1, 2, -1, 2, 1, 1, 1,FALSE},
// 1024
{CS_WEAPON_XM1014, "weapon_xm1014","models/w_xm1014.mdl",0.0,2048.0, 0.0, 1200.0,
TRUE, FALSE, 0.9, 3000, 1, 2, -1, 2, 2, 2, 2,FALSE},
// Sub Machine Guns
// 1536
{CS_WEAPON_MP5NAVY, "weapon_mp5navy","models/w_mp5.mdl",0.0,2048.0, 0.0, 1200.0,
TRUE, TRUE, 2.74, 1500, 1, 2, 1, 3, 1, 2, 2,FALSE},
{CS_WEAPON_TMP, "weapon_tmp","models/w_tmp.mdl",0.0,2048.0, 0.0, 1200.0,
TRUE, TRUE, 2.2, 1250, 1, 1, 1, 3, 2, 1, 1,FALSE},
// 1536
{CS_WEAPON_P90, "weapon_p90","models/w_p90.mdl", 0.0,2048.0, 0.0, 1200.0,
TRUE, TRUE, 3.5, 2350, 1, 2, 1, 3, 3, 4, 4,FALSE},
// 1536
{CS_WEAPON_MAC10, "weapon_mac10","models/w_mac10.mdl", 0.0,2048.0, 0.0, 1200.0,
TRUE, TRUE, 3.3, 1400, 1, 0, 0, 3, 4, 1, 1,FALSE},
// new for CS 1.0
{CS_WEAPON_UMP45, "weapon_ump45","models/w_ump45.mdl",0.0,2048.0, 0.0, 1200.0,
TRUE, TRUE, 4.15, 1700, 1, 2, 2, 3, 5, 3, 3,FALSE},
// Rifles
// 2048
{CS_WEAPON_AK47, "weapon_ak47","models/w_ak47.mdl", 0.0, 4096.0, 0.0, 1200.0,
TRUE, TRUE, 2.6, 2500, 1, 0, 0, 4, 1, 2, 2,TRUE},
{CS_WEAPON_SG552, "weapon_sg552","models/w_sg552.mdl",0.0, 4096.0, 0.0, 1200.0,
TRUE, TRUE, 4.0, 3500, 1, 0, -1, 4, 2, 4, 4,TRUE},
{CS_WEAPON_M4A1, "weapon_m4a1","models/w_m4a1.mdl", 0.0, 4096.0, 0.0, 1200.0,
TRUE, TRUE, 3.2, 3100, 1, 1, 1, 4, 3, 3, 3,TRUE},
{CS_WEAPON_AUG, "weapon_aug","models/w_aug.mdl",0.0, 4096.0, 0.0, 1200.0,
TRUE, TRUE, 3.5, 3500, 1, 1, 1, 4, 4, 4, 4,TRUE},
// Sniper Rifles
// 1024
{CS_WEAPON_SCOUT, "weapon_scout","models/w_scout.mdl", 300.0, 2048.0, 0.0, 1200.0,
TRUE, FALSE, 2.2, 2750, 1, 2, 0, 4, 5, 3, 2, TRUE},
// 1280
{CS_WEAPON_AWP, "weapon_awp","models/w_awp.mdl",0.0, 4096.0, 0.0, 1200.0,
TRUE, FALSE, 2.6, 4750, 1, 2, 0, 4, 6, 5, 6,TRUE},
// 1024
{CS_WEAPON_G3SG1, "weapon_g3sg1","models/w_g3sg1.mdl",300.0, 4096.0, 0.0, 1200.0,
TRUE, FALSE, 4.9, 5000, 1, 0, 2, 4, 7, 6, 6,TRUE},
{CS_WEAPON_SG550, "weapon_sg550","models/w_sg550.mdl",300.0, 4096.0, 0.0, 1200.0,
TRUE, FALSE, 4.128, 4200, 1, 1, 1, 4, 8, 5, 5,TRUE},
// Machine Guns
{CS_WEAPON_M249, "weapon_m249","models/w_m249.mdl",0.0,2048.0, 0.0, 1200.0,
TRUE, TRUE, 4.85, 5750, 1, 2, 1, 5, 1, 1, 1,TRUE},
{CS_WEAPON_FAMAS, "weapon_famas","models/w_famas.mdl", 0.0, 4096.0, 0.0, 1200.0,
TRUE, TRUE, 3.2, 2250, 1, 1, 1, 4, -1, 1, 1,TRUE},
{CS_WEAPON_GALIL, "weapon_galil","models/w_galil.mdl", 0.0, 4096.0, 0.0, 1200.0,
TRUE, TRUE, 3.2, 2000, 1, 0, 0, 4, -1, 1, 1,TRUE},
{CS_WEAPON_SHIELDGUN, "weapon_shield","models/w_shield.mdl", 0.0, 0.0, 0.0, 0.0,
TRUE, FALSE, 0.0, 2200, 0, 1, 1, 8, -1, 8, 8,FALSE},
//terminator
{0, "","", 0.0, 0.0, 0.0, 0.0, TRUE, FALSE, 0.0,0,0,0,0,0}
};

posted THE_STORM's code with code tags for better readability :)

The Storm 27-10-2004 23:13

Re: Need some help for shield support
 
So will help me someone??? :(

Pierre-Marie Baty 28-10-2004 00:40

Re: Need some help for shield support
 
Well I COULD help you but for that I'd need AT LEAST the struct declaration for this array !!! How do you want me to guess things you don't understand yourself ?
Quote:

Anoder numbers I don't know for what are there.
Great!
Your array is an array of elements having the "bot_weapon_select_t" type. So, where is "bot_weapon_select_t" defined ? 9_9

sPlOrYgOn 28-10-2004 02:25

Re: Need some help for shield support
 
Code:

typedef struct
{
  int iId; // the weapon ID value
  char weapon_name[64]; // name of the weapon when selecting it
  char model_name[64]; // Model Name to separate CS Weapons
  char buy_shortcut[64]; // Buy Shortcut (CS 1.6 specific)
  char buy_command[64]; // Buy Script to get this Weapon (equivalent of the above but for CS 1.5)
  float primary_min_distance; // 0 = no minimum
  float primary_max_distance; // 9999 = no maximum
  float secondary_min_distance; // 0 = no minimum
  float secondary_max_distance; // 9999 = no maximum
  bool  can_use_underwater; // can use this weapon underwater
  bool  primary_fire_hold; // hold down primary fire button to use?
  float primary_charge_delay; // time to charge weapon
  int iPrice; // Price when buying
  int min_primary_ammo;
  int iTeamStandard; // Used by Team (Number) (standard map)
  int iTeamAS; // Used by Team (AS map)
  bool  bShootsThru; // Can shoot thru Walls
} bot_weapon_select_t;

Theres the one from PBMM.. lets hope LN didn't change anything and it should be fine :D
[edit]
What I suggest is just force them to buy shield and make a game with mp_startmoney 16000 or something...
if nothing has changed the function is probably called BotBuyStuff
[/edit]

Pierre-Marie Baty 28-10-2004 14:50

Re: Need some help for shield support
 
nope Splo, that is the one for PB2.6mm, but it's different in the old podbot, I know it for I changed the layout of this table myself, quite a lot.

It must be different in EPODbot. But I don't have the original podbot source on my computer right now, so I can't check.

The Storm 28-10-2004 20:26

Re: Need some help for shield support
 
Whistler can help us.
He make E[POD]bot for CS 1.6, CS_WEAPON_FAMAS and CS_WEAPON GALIL completeble.
I think that he will know for whats are the numbers.
So we must wait for help from him.

sPlOrYgOn 29-10-2004 02:20

Re: Need some help for shield support
 
then how about this one from podbot 2.6...
Code:

typedef struct
{
  int iId;  // the weapon ID value
  char  weapon_name[64];  // name of the weapon when selecting it
  char  model_name[64];        // Model Name to separate CS Weapons
  float primary_min_distance;  // 0 = no minimum
  float primary_max_distance;  // 9999 = no maximum
  float secondary_min_distance; // 0 = no minimum
  float secondary_max_distance; // 9999 = no maximum
  bool  can_use_underwater;    // can use this weapon underwater
  bool  primary_fire_hold;      // hold down primary fire button to use?
  float primary_charge_delay;  // time to charge weapon
  int  iPrice;                                // Price when buying
  int        min_primary_ammo;
  int  iTeamStandard;                        // Used by Team (Number) (standard map)
  int  iTeamAS;                                // Used by Team (AS map)
  int  iBuyGroup;                                // Group in Buy Menu (standard map)
  int  iBuySelect;                        // Select Item in Buy Menu (standard map)
  bool  bShootsThru;                        // Can shoot thru Walls
} bot_weapon_select_t;


The Storm 29-10-2004 10:57

Re: Need some help for shield support
 
sPlOrYgOn this code will not help.
On E[POD]bot the code is same as that code that you are give to me in your last post.

Pierre-Marie Baty 29-10-2004 11:31

Re: Need some help for shield support
 
*sigh* 9_9

that's just what we were asking dude...
do you understand the relation between this declaration and the array you posted, at least ?

Now if you want us to help you would you mind post the bit of code that references this array ? 9_9
Do you understand what we are saying ?

Whistler 29-10-2004 11:31

Re: Need some help for shield support
 
the number seems to be correct, I think there's something wrong with somewhere else in your code

The Storm 29-10-2004 19:10

Re: Need some help for shield support
 
Quote:

Originally Posted by Pierre-Marie Baty
Do you understand what we are saying ?

No! Sorry but I now learning C++ and I'm a new bot coder.
:'(
Can you tell me what part of the code you want becorse I don't understand what do you mean in your last post.
I'm very sorry for this stuped qustions but I'm new.

sPlOrYgOn 30-10-2004 02:23

Re: Need some help for shield support
 
give the code like what I did...
find the structure called "bot_weapon_select_t" in epb and post it here..
within [ code] [ /code] tags..

The Storm 30-10-2004 11:23

Re: Need some help for shield support
 
Quote:

Code:

typedef struct
{
int iId;  // the weapon ID value
  char  weapon_name[64];  // name of the weapon when selecting it
  char  model_name[64]; // Model Name to separate CS Weapons
  float primary_min_distance;  // 0 = no minimum
  float primary_max_distance;  // 9999 = no maximum
  float secondary_min_distance; // 0 = no minimum
  float secondary_max_distance; // 9999 = no maximum
  bool  can_use_underwater;        // can use this weapon underwater
  bool  primary_fire_hold;          // hold down primary fire button to use?
  float primary_charge_delay;  // time to charge weapon
  int  iPrice;        // Price when buying
  int  min_primary_ammo;
  int  iTeamStandard;        // Used by Team (Number) (standard map)
  int  iTeamAS;        // Used by Team (AS map)
  int  iBuyGroup;        // Group in Buy Menu (standard map)
  int  iBuySelect;        // Select Item in Buy Menu (standard map)
  // Whistler: added for Cs 1.6
  int  iNewBuySelectT;
  int  iNewBuySelectCT;
  bool  bShootsThru;        // Can shoot thru Walls
} bot_weapon_select_t;


So there is the code.

Pierre-Marie Baty 30-10-2004 16:44

Re: Need some help for shield support
 
OK ; assuming your buy numbers are correct I see no problem with that array.
Can you post your buy function now ?
Perhaps not the function, but the 15-20 lines that make the bot buy, at least.

The Storm 30-10-2004 19:09

Re: Need some help for shield support
 
Quote:

Code:

void BotBuyStuff(bot_t *pBot)
{
        char szMenuSelect[40];
        edict_t *pEdict = pBot->pEdict;

#ifdef DEBUG
        report_log (LOG_BOTBASE, "BotBuyStuff","Action=%d",pBot->BuyAction);
#endif
        // Needs a Weapon ?
        if((pBot->BuyAction == MSG_CS_BUYWEAPON_SELECT)
                && (pBot->f_buy_time+ RANDOM_LONG(1,6)/10)<gpGlobals->time)
        {
                pBot->BuyAction = MSG_CS_IDLE;
                if(pBot->pSelected_weapon == NULL || pBot->iBuyCount>1)
                {
#ifdef _DEBUG
                        fp=fopen("PODERROR.txt","a"); fprintf(fp, "ERROR no Weapon selected: MSG_CS_BUYWEAPON_GROUPSELECT: %s - iBuyCount=%d\n",pBot->name,pBot->iBuyCount); fclose(fp);
#endif
                        return;
                }
//                fp=fopen("bot.txt","a"); fprintf(fp, "MSG_CS_BUYWEAPON_GROUPSELECT: %s - iBuyCount=%d\n",pBot->name,pBot->iBuyCount); fclose(fp);
                pBot->iBuyCount = 2;
                pBot->f_buy_time=gpGlobals->time;
       
                sprintf(szMenuSelect,"%d",pBot->pSelected_weapon->iBuyGroup);
                FakeClientCommand(pEdict, "menuselect",szMenuSelect, NULL);
                return;
        }

        if((pBot->BuyAction == MSG_CS_WEAPONBUY)
                && (pBot->f_buy_time+(20-pBot->Ph)/5 + RANDOM_LONG(1,6)/5)<gpGlobals->time)
        {
                pBot->BuyAction = MSG_CS_IDLE;
                if((pBot->pSelected_weapon == NULL) || (pBot->iBuyCount != 2))
                {
                        fp=fopen("bot.txt","a"); fprintf(fp, "ERROR no Weapon selected: MSG_CS_BUYWEAPON_PSSRM: %s - iBuyCount=%d\n",pBot->name,pBot->iBuyCount); fclose(fp);
                        return;
                }
//                fp=fopen("bot.txt","a"); fprintf(fp, "MSG_CS_BUYWEAPON_PSSRM: %s - iBuyCount=%d\n",pBot->name,pBot->iBuyCount); fclose(fp);
                pBot->iBuyCount=3;
                pBot->f_buy_time=gpGlobals->time;

//                sprintf(szMenuSelect,"%d",pBot->pSelected_weapon->iBuySelect);
                // Whistler: changed this for CS 1.6
                if (g_bIsVersion16)
                {
                        if (UTIL_GetTeam(pBot->pEdict) == 0) // terrorist
                                sprintf(szMenuSelect,"%d",pBot->pSelected_weapon->iNewBuySelectT);
                        else // CT
                                sprintf(szMenuSelect,"%d",pBot->pSelected_weapon->iNewBuySelectCT);
                }
                else
                        sprintf(szMenuSelect,"%d",pBot->pSelected_weapon->iBuySelect);

                FakeClientCommand(pEdict, "menuselect",szMenuSelect, NULL);
                BotPushMessageQueue(pBot,MSG_CS_BUY);
                return;
        }

        // Needs Ammo ?
        if((pBot->BuyAction==MSG_CS_BUYAMMO)
                && (pBot->f_buy_time+(20-pBot->Ph)/8)<gpGlobals->time)
        {
               
                pBot->BuyAction=MSG_CS_IDLE;
                if(BotHasPrimaryWeapon(pBot)==FALSE) // Pistol ?
                        FakeClientCommand(pEdict, "menuselect","7", NULL);
                else
                        FakeClientCommand(pEdict, "menuselect","6", NULL);
//                fp=fopen("bot.txt","a"); fprintf(fp, "MSG_CS_BUYAMMO: %s - iBuyCount=%d\n",pBot->name,pBot->iBuyCount); fclose(fp);
                pBot->iBuyCount=4;
                pBot->f_buy_time=gpGlobals->time;
                BotPushMessageQueue(pBot,MSG_CS_BUY);
                return;
}


Here is the code.

Pierre-Marie Baty 31-10-2004 00:50

Re: Need some help for shield support
 
I remember there is a problem with the "menuselect n" client commands in CS 1.6. It's not your fault; it's a CS bug. To make sure bots buy effectively what you tell them to buy you should make them buy using the new shortcuts (like "famas", "deagle", etc.) For this I advise you to change a bit your bot_weapon_select_t structure and change these

int iNewBuySelectT;
int iNewBuySelectCT;

into a char array where you will put the buy shortcut to use for each weapon. For example:

char buy_shortcut[32];

You can then replace

FakeClientCommand(pEdict, "menuselect",szMenuSelect, NULL);

with

FakeClientCommand(pEdict, pBot->pSelected_weapon->buy_shortcut, NULL, NULL);

The Storm 31-10-2004 10:03

Re: Need some help for shield support
 
Ok, I do that think but I can't test the bots becorse the C++ compiler give me error masege :
error LNK2001: unresolved external symbol "void __cdecl FakeClientCommand(struct edict_s *,char const *,...)" (?FakeClientCommand@@YAXPAUedict_s@@PBDZZ)

How to fix this problem.

sfx1999 31-10-2004 19:13

Re: Need some help for shield support
 
What compiler are you using?

Also, it looks like you didn't link some object in with your code.

The Storm 31-10-2004 21:42

Re: Need some help for shield support
 
So, I done what you are say PMB but now the bots don't buy anythink. :'(

sPlOrYgOn 31-10-2004 23:50

Re: Need some help for shield support
 
look at pbmm buy code...
you can't use it since it's GPLed but you can get the concept of what it does...

Pierre-Marie Baty 01-11-2004 00:21

Re: Need some help for shield support
 
It looks like you did things wrong. I suspect you made the modifications to the wrong place. Can you post your changes to your original buy function ?

The Storm 01-11-2004 10:55

Re: Need some help for shield support
 
OK, OK I think that I know where is the problem.
The function buy_shortcut must be declared somewere with the weapons that will be in that function, but where and how to declared the function.
P.S. PMB I change only this that you tell me and added in the weapons ID menuselect function.
So where to declare the another part of the function buy_shortcut???
I think that this function must be declared in some .cpp file not only in bot.h.
I think that this is the problem.

Pierre-Marie Baty 01-11-2004 13:09

Re: Need some help for shield support
 
OUCH
I really think you need to take some C classes, friend :)

Lesson #1.

A function is something like

void DoSomething (int parameter1, float parameter2)

or

int DoSomethingElse (Vector parameter1)

in fact it can take any form you want, either it does not return a value - and then the type is "void" - or it returns a value after execution, and then the type is int, float, or any data type you want.
When a function is called in the code, the computer branches the execution right into it, executes the function, and once the function is finished returns to the point from where it was called.

Functions usually end up with the statement "return". When the function has a return type of "void", then "return" does not need to be called. The code will just exit the function as soon as the last closing brace } is reached. On functions that are required to return a value, though, the return value must be explicitly passed as a parameter of the "return" instruction. Example:

return (-1); // this function will return -1

or

return (my_variable); // this function will return the value of my_variable



A data type is an identifier that tells what type of data you are allowed to put in a variable.

Example:

int variable_1; // in this variable you can put integer numbers only (like 1 or 2)
float variable_2; // in this variable you are allowed to put floating-point numbers (like 0.5)
char variable_3; // in this one you can put a character like 'a' or 'b'

It's not that exact. In fact in "char" variables you are also allowed to put integer numbers, like in "int" variables you can put other forms of data, like pointers, etc. All comes down to the size the variable takes in memory. "int" variables eat up 4 bytes, hence 4*8=32 bit of data (32 times 0 and 1s). That's why you are also allowed to store pointers in them, since a pointer is usually 4 bytes large too. On the other hand, "char" variables eat just 1 byte, hence 8 bits. With only 8 bits to describe a number you cannot go above +/-127 (if you keep the last bit to describe the sign, thus the data will be said signed), or 255 (if you eat the whole 8 bits for your number, and then the data will be said unsigned and you will have only positive numbers in it). With so few you cannot store pointers which are big numbers, and usually go way above 255.

You can also arrange your data in arrays. Arrays are just a set of variables of the same type put next to each other in memory. Example:

char variable1[32]; // this is an array of "char" variables

In this one you can put 32 characters, or 32 integer numbers provided each of them does not exceed 127 (since "char" means signed char). You can hence put characters

char variable1[32] = "abcdef"; // like some text (you're not forced to eat up all the 32 slots)

Or integer values

char variable1[32] = {1,45,53,23,123,6,84,22}; // as long as they don't go above 127

Char, int, long, short, float, double, void, are standard C data types. But in his code, a programmer may need to use more complex forms of data. Like, for example, a vector. A vector must be described by 3 real (floating point) numbers, and that obviously cannot fit in one single variable. One could do this:

float x_component;
float y_component;
float z_component;

but that's not very practical. The C language provides much better mechanisms for describing more complex types of data.



A struct (abbreviation for "structure") is when you tell the C compiler: "hey, from now on, I will make use of a new type of data that you don't know yet. It will be named XXXX and it will be composed of : this, that and that."

Example:

typedef struct
{
char variable1; // first member of my struct will be a "char" variable
float variable2; // second member will be a floating point variable
int variable3; // and the third slot will be occupied with an integer number.
} my_struct;

Here you say to the compiler: look, I am telling you of this new data type I am going to use. It's called "my_struct". In it you will find
1st - a char variable
2nd - a float variable
3rd and last - an int variable.

And from then on, in your code, you can use this new struct, the compiler will know about it. For example, at the beginning of a function, you can declare:

my_struct blablablah;

just like you would declare

float variable1;

or any other form of data. Since your struct has been defined, the compiler will know about it. You will then be able to access your struct's members like this:

blablablah.variable1 = 'a'; // put 'a' in the 1st member of my struct
blablablah.variable2 = 0.5; // put 0.5 in the 2nd one (it's a float variable)
blablablah.variable3 = 435264; // and so on.

In the Half-Life SDK, the Vector data type can be seen as a custom struct, having members named x, y and z. You can do:

Vector some_vector; // declare a new vector

some_vector.x = 0.324; // access x component
some_vector.y = 5643.546; // access y component
some_vector.z = 32.3; // access z component

(in fact it's a bit more complex. Vector is not only a struct, it's a class. A class can be seen like a struct, in which you put not only variables, but also functions, like Length() for example.)

Now look at this:
Code:

typedef struct
{
int iId; // the weapon ID value
char weapon_name[64]; // name of the weapon when selecting it
char model_name[64]; // Model Name to separate CS Weapons
float primary_min_distance; // 0 = no minimum
float primary_max_distance; // 9999 = no maximum
float secondary_min_distance; // 0 = no minimum
float secondary_max_distance; // 9999 = no maximum
bool can_use_underwater;        // can use this weapon underwater
bool primary_fire_hold;        // hold down primary fire button to use?
float primary_charge_delay; // time to charge weapon
int iPrice;        // Price when buying
int min_primary_ammo;
int iTeamStandard;        // Used by Team (Number) (standard map)
int iTeamAS;        // Used by Team (AS map)
int iBuyGroup;        // Group in Buy Menu (standard map)
int iBuySelect;        // Select Item in Buy Menu (standard map)
// Whistler: added for Cs 1.6
int iNewBuySelectT;
int iNewBuySelectCT;
bool bShootsThru;        // Can shoot thru Walls
} bot_weapon_select_t;

Question 1. Is that a function or is that a structure ?
A structure, obviously. Its name is bot_weapon_select_t and it has the aforementioned members.
Question 2. What must buy_shortcut be ?
buy_shortcut must be a member of the bot_weapon_select_t structure, so that you can use it in further declarations of bot_weapon_select_t variables.
Question 3. How do you need to define buy_shortcut ?
Simply by adding it to the list with the other members of the bot_weapon_select_t structure.

If you answer these questions right, you will know enough to fix your problem. If you CANNOT answer them right, IMO it's too early for you to take on the development of a bot as complicated as podbot :(

The answer is provided in clear text, btw :)


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

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