.:: Bots United ::.  
filebase forums discord server github wiki web
cubebot epodbot fritzbot gravebot grogbot hpbbot ivpbot jkbotti joebot
meanmod podbotmm racc rcbot realbot sandbot shrikebot soulfathermaps yapb

Go Back   .:: Bots United ::. > Developer's Farm > General Bot Coding
General Bot Coding See what a pain it is to get those little mechs shooting around

Reply
 
Thread Tools
Hi, thanks and help!
Old
  (#1)
mfrx
Member
 
Status: Offline
Posts: 13
Join Date: Jun 2005
Default Hi, thanks and help! - 30-06-2005

First hi all!

Im attempting to make a bot for DMC so thanks to everyone bc ive got a bot in the game that moves and shoots

Now for the help bit

I need to find out when a weapon is actually fired. Im pretty sure that Im doing something n00b bc Im catching the gFunctionTable.pfnGetWeaponData function which fires np so i know which player it is but the values in the weapon_data_s struct are always 0.

Im using the sdk from this site with metamod.

Am I on the right track? Any suggestions?

O and thx to Rick - I had a look through the RCBot code but couldnt find anything

Cheers
  
Reply With Quote
Re: Hi, thanks and help!
Old
  (#2)
The Storm
Council Member / E[POD]bot developer
 
The Storm's Avatar
 
Status: Online
Posts: 1,620
Join Date: Jul 2004
Location: Bulgaria
Default Re: Hi, thanks and help! - 30-06-2005

I can't understand what do you mean... Maybe you try to say that you don't know how ammo remain in the weapon ? If is that you need to export a message. In EPB I use this one
Code:
// This message is sent whenever ammo ammounts are adjusted (up or down).
// NOTE: Logging reveals that CS uses it very unreliable !
void BotClient_CS_AmmoX(void *p, int bot_index)
{
   static int index;
   static int ammount;
   int ammo_index;

   bot_t *pBot = &bots[bot_index];

   if (state == 0) {
	  index = *(int *) p;	   // ammo index (for type of ammo)
   } else if (state == 1) {
	  ammount = *(int *) p;	 // the ammount of ammo currently available

	  pBot->m_rgAmmo[index] = ammount;  // store it away
	  if (pBot->current_weapon.iId > CS_WEAPON_INSWITCH) {
		 ammo_index = pBot->current_weapon.iId;

#ifdef _DEBUG
		 report_log(LOG_MESSAGE, "BotClient_CS_AmmoX",
				    "Botname=%s iId=%d Amount=%d", pBot->name, ammo_index,
					ammount);
#endif

		 // update the ammo counts for this weapon...
		 pBot->current_weapon.iAmmo1 =
			 pBot->m_rgAmmo[weapon_defs[ammo_index].iAmmo1];
		 pBot->current_weapon.iAmmo2 =
			 pBot->m_rgAmmo[weapon_defs[ammo_index].iAmmo2];
	  }

   }
   state++;
}
I hope that I help.
  
Reply With Quote
Re: Hi, thanks and help!
Old
  (#3)
mfrx
Member
 
Status: Offline
Posts: 13
Join Date: Jun 2005
Default Re: Hi, thanks and help! - 30-06-2005

Sorry, I should have been clearer.

First; the reason I need this is because I am trying to make the bots rocket jump (look down, jump and fire a rocket).

The problem is that a player may only fire a rocket once every 0.8 seconds (approx) so if I need to call the rocket jump function just before it is possible to fire again otherwise the bot may end up looking at the ground for 0.79 seconds

So I need to store the time that they last fired a weapon.

I have tried:
Code:
 
int GetWeaponData( struct edict_s *player, struct weapon_data_s *info )
{
char msg[200];
sprintf(msg, "ID: %d, Idle: %.2f, State: %d, Clip: %d", info->m_iId, info->m_flTimeWeaponIdle, info->m_iWeaponState, info->m_iClip);
clsUtil.WriteToConsole(msg);
}
and assigned that function to gFunctionTable.pfnGetWeaponData but all of the members are 0.

I hope that makes sense

1 of the game modes (Rocket Arena) has infinite ammo so the amount does not go down

Thanks again
  
Reply With Quote
Re: Hi, thanks and help!
Old
  (#4)
The Storm
Council Member / E[POD]bot developer
 
The Storm's Avatar
 
Status: Online
Posts: 1,620
Join Date: Jul 2004
Location: Bulgaria
Default Re: Hi, thanks and help! - 30-06-2005

Maybe you don't need all that stuff.
Try to change the fire delay in bot_fire_delay_t if you are using HPB bot teamplate.
  
Reply With Quote
Re: Hi, thanks and help!
Old
  (#5)
mfrx
Member
 
Status: Offline
Posts: 13
Join Date: Jun 2005
Default Re: Hi, thanks and help! - 30-06-2005

Wow ure quick

No im not using any template - I was feeling brave and wanted to do it all myself

So although I have my own weapon class and I know the delays - I still need to hook into the engine somehow

btw I know the delays because I tried using the pEdict->v.weaponanim to determine firing times but that is somewhat unreliable

I will keep looking
  
Reply With Quote
Re: Hi, thanks and help!
Old
  (#6)
The Storm
Council Member / E[POD]bot developer
 
The Storm's Avatar
 
Status: Online
Posts: 1,620
Join Date: Jul 2004
Location: Bulgaria
Default Re: Hi, thanks and help! - 01-07-2005

Man in this way it will be very hard for you. Download HPB bot source code and look there how to fix the things. And too read the botman readme file.
  
Reply With Quote
Re: Hi, thanks and help!
Old
  (#7)
mfrx
Member
 
Status: Offline
Posts: 13
Join Date: Jun 2005
Default Re: Hi, thanks and help! - 01-07-2005

Yeah should have said, ive already played around for the HPB Bot code for the last month or so and my coding is already ok but I dont know the engine well enough

The bots are already fighting, dodging rockets, predicting enemy movement etc its just this 1 thing (for now hehe)

So thanks anyway
  
Reply With Quote
Re: Hi, thanks and help!
Old
  (#8)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: Hi, thanks and help! - 01-07-2005

You can also keep track of the last time the bot shooted if you compare pEdict->v.button and pEdict->v.oldbutton and see if in the former case IN_ATTACK was set and not in the latter.

Or else, you can try to hook at the gun animation... I don't recall which function that was, but I remember DrEvil did that for FoxBot.



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."
  
Reply With Quote
Re: Hi, thanks and help!
Old
  (#9)
Akz
Creator of GrogBot
 
Akz's Avatar
 
Status: Offline
Posts: 91
Join Date: Jan 2004
Default Re: Hi, thanks and help! - 01-07-2005

Comparing pEdict->v.button and pEdict->v.oldbutton could be used to detect when the attack button was pressed, but it doesn't quarantee that the weapon was fired. Checking the weapon animation should be ok for that purpose though. The variable you're looking for is pEdict->v.weaponanim.

In DMC, the value should be either 0 (idle) or 1 (shooting), because AFAIK there are only 2 animations for each weapon.


GrogBot - A bot for Pirates, Vikings and Knights HL modification.

http://grogbot.bots-united.com
  
Reply With Quote
Re: Hi, thanks and help!
Old
  (#10)
mfrx
Member
 
Status: Offline
Posts: 13
Join Date: Jun 2005
Default Re: Hi, thanks and help! - 02-07-2005

Sleep followed by lots of coffee is good

I found v.weaponanim to be unrealiable (prehaps due to timing differences between the bot.dll and the engine?)

So I re-read botman's readme a few more times and now it makes sense

I've hooked the pfnSetModel func and then check to see what type of model is assigned, then wait until that edict has an owner, then see if it is a bot - thus I can update its time-till-fire.

This may not be the best way to do things but it does work

Thanks again

EDIT: Now everything is working unless the previous weapon was a shotgun or super-shotgun because no model seems to be assigned Does anyone know how bullets are dealt with by the engine - or can you point me to how/where I can find out?

Last edited by mfrx; 02-07-2005 at 02:43..
  
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com