Forums » Community Projects

Need a suggestion - Detecting Cannon discharges

May 29, 2013 PaKettle link
I need a way to determine if a charged cannon has been discharged.
I tried intercepting the shoot commands and I can determine the firing of ammo bassed weapons such as rep guns but no luck on the Charged cannons.
May 30, 2013 draugath link
The only way I can think of to detect if an energy weapon has been fired is to see if there an energy projectile object in space. The good news is that this is easy if you're only tracking it for yourself, but more difficulty if you want to try and detect it from someone else.

Whenever you enter a sector, your ship's local objectID is changed. All of your energy fire from this point forward will have object IDs incrementing from here. The sad part of this whole thing is that successfully targeting anything costs about 20ms.
May 30, 2013 abortretryfail link
Since charge cannons constantly drain the battery, you could just look for a reduction in battery drain rate.
May 30, 2013 PaKettle link
I havent seen any way to determine the battery state in the api either....
Not really sure i want to constantly scan for projectiles.
It would be really usefull if there was a way to determine the actual amount of charge for each cannon
May 30, 2013 Pizzasgood link
"I havent seen any way to determine the battery state in the api either...."

http://www.vo-wiki.com/racecar/index.php?title=API_GetActiveShipEnergy

I haven't personally used this function so I can't vouch for whether it actually works, but I imagine it does.

As for your actual goal - you could go the interception route, and rebind the trigger to your plugin, and then have the plugin initiate and end the actual firing accordingly. That way you always know the state. I'm making the assumption here that plugins can fire weapons. If they can't, you could probably accomplish something similar using aliases.
May 30, 2013 PaKettle link
I thought of doing that since I can issue shoot caommands but that creates a need for the user to do more then simply drop the plug in into the folder. (I havent tried to look up how they are bound and replace them yet.)

Thanks for the energy link - I can at least use that to help determine when its safe to start charging ....