johnnyboy 3792 Posted June 12, 2019 31 minutes ago, Larrow said: Use magazinesAmmoFull instead, and just look for the mag that is in the units current muzzle that is being used to fire? Very slick my Meat Hula Hoop consuming friend. Thanks alot! Thanks much to @ZaellixA and @Dedmen also. I think I'm opting for Larrow's solution as it may be more reliable than relying on string elements present for every magazine. 2 1 Share this post Link to post Share on other sites
ZaellixA 383 Posted June 12, 2019 Well, apparently there is a really easy way to do it. Thanks to @LarrowI found out that you can actually use weaponState to get the current ammo count. The last element of the returned variables is the ammoCount. So in the same way Larrow showed above you can _myUnit addEventHandler["FiredMan", { _unit = _this select 0; // Get the unit who fired _numOfBullets = (weaponState _unit) select 4; // Get the amount of bullets left in the magazine if(_numOfBullets isEqualTo 0) then { systemChat "Reloading..."; // Start screaming } else { systemChat "Still plenty to shoot..."; // Keep shooting }; }]; Thanks Larrow for pointing to the right direction. 2 1 Share this post Link to post Share on other sites
johnnyboy 3792 Posted June 12, 2019 18 minutes ago, ZaellixA said: Well, apparently there is a really easy way to do it. Thanks to @LarrowI found out that you can actually use weaponState to get the current ammo count. The last element of the returned variables is the ammoCount. So in the same way Larrow showed above you can Even cleaner. Now I'm opting for this one lol. Great job by all. 1 Share this post Link to post Share on other sites
GEORGE FLOROS GR 4207 Posted June 13, 2019 On 6/12/2019 at 6:24 PM, Larrow said: addEventHandler [ "FiredMan", { 1 Share this post Link to post Share on other sites
johnnyboy 3792 Posted July 27, 2022 In case anyone ever needs this again, there is a cleaner way now to check if a unit is currently reloading via the gestureState command: gestureState _unit = player; if (gestureState _unit find "reload" >= 0) then {hint "unit is reloading"}; 4 Share this post Link to post Share on other sites
ZaellixA 383 Posted August 1, 2022 But, when and how are you gonna check? Is a reload guaranteed when the magazine goes empty, 'cause in this case this could very well be used in the FiredMan event handler shown above. Otherwise I can't really see an easy way to use it apart from constantly checking if the unit is reloading. Do you have something specific in mind??? 1 Share this post Link to post Share on other sites
johnnyboy 3792 Posted August 1, 2022 3 hours ago, ZaellixA said: But, when and how are you gonna check? Is a reload guaranteed when the magazine goes empty, 'cause in this case this could very well be used in the FiredMan event handler shown above. Otherwise I can't really see an easy way to use it apart from constantly checking if the unit is reloading. Do you have something specific in mind??? Good point. The firedMan example above is still very valid. My current use case is different. I'm scripting player giving hand signals to AI and if player starts a reload, then immediately does the hand signal gesture, then the reload gesture animation is stopped, and player's weapon is not reloaded. This is annoying and dangerous in combat. So just before giving hand signal, I check for player currentGesture contains "reload", and skip the hand signal if he is reloading. 1 Share this post Link to post Share on other sites
killzone_kid 1330 Posted August 6, 2022 On 7/27/2022 at 5:51 PM, johnnyboy said: In case anyone ever needs this again, there is a cleaner way now to check if a unit is currently reloading via the gestureState command: gestureState _unit = player; if (gestureState _unit find "reload" >= 0) then {hint "unit is reloading"}; Have you seen https://community.bistudio.com/wiki/weaponState ? 3 Share this post Link to post Share on other sites
Harzach 2517 Posted August 6, 2022 13 minutes ago, killzone_kid said: Have you seen https://community.bistudio.com/wiki/weaponState ? Ahh, that's what he was using previously, but that was three years ago, before the command was updated. Quote 2.06 roundReloadPhase: Number - current ammo round reload phase (see weaponReloadingTime) 2.06 magazineReloadPhase: Number - current magazine reload phase from 1 to 0, 0 - reload complete. > 0 - reload in progress Nifty! 2 Share this post Link to post Share on other sites