Jump to content
juleshuxley

Checking if a weapon is ready to fire

Recommended Posts

I'm trying to make a minimalist UI. I've had some success but one thing I'm struggling with is recreating the "waiting for the next round" bar. You know, this thing:

barrrrr.png

My UI is constantly getting refreshed in a while loop, so I was hoping I could query if a certain weapon was ready to fire. Functions such as CanFire and WeaponState unfortunately didn't give me what I wanted and are misleadingly named.

So is there a function I've missed that  can query the weapon state i.e ready to fire, not ready to fire?

Failing that, where is the m256's "time taken for next round to be loaded" set? In a config? What attribute am I looking for? Can I use getText to extract it to a variable in my script? If it's listed in seconds somewhere in the config I could use an event handler and BIS_fnc_deltaTime to work out if a weapon is ready to fire or not.

Share this post


Link to post
Share on other sites
7 hours ago, juleshuxley said:

Failing that, where is the m256's "time taken for next round to be loaded" set? In a config?

Yes in config of weapon reloadTime.

  • Like 1

Share this post


Link to post
Share on other sites
_name = getText(configfile >> "CfgWeapons" >> "CUP_optic_LeupoldMk4_20x40_LRT" >> "displayName");

_reloadTime = getText(configfile >> "CfgWeapons" >> "CUP_optic_LeupoldMk4_20x40_LRT" >> "reloadTime");

_name; // "Leupold Mark 4 6.5-20x50mm LR/T"
_reloadTime; // ""

Attempting to retrieve reloadTime results in an empty string?

reload.png

reloadTime is most definitely in the config, unless the indentation or colors mean something?

Update,  just realised displayName is red and unindented I'm guessing that's something to do with it...

Share this post


Link to post
Share on other sites
23 hours ago, juleshuxley said:

Attempting to retrieve reloadTime results in an empty string?

As it is not a string, its a number, so use getNumber instead.

 

23 hours ago, juleshuxley said:

unless the indentation or colors mean something?

Indentation means the member is inherited from its parent, not indented means set in this class. Colors are member type, text, number or array.

  • Thanks 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×