![]() |
Hi, thanks and help!
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 :D 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 |
Re: Hi, thanks and help!
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). |
Re: Hi, thanks and help!
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:
I hope that makes sense ;) 1 of the game modes (Rocket Arena) has infinite ammo so the amount does not go down :( Thanks again |
Re: Hi, thanks and help!
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. |
Re: Hi, thanks and help!
Wow ure quick :D
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 :) |
Re: Hi, thanks and help!
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. :D
|
Re: Hi, thanks and help!
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 :) |
Re: Hi, thanks and help!
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. |
Re: Hi, thanks and help!
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. |
Re: Hi, thanks and help!
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 :D 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 :D 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? |
All times are GMT +2. The time now is 12:25. |
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.