Taylor1984 14 Posted May 11, 2020 Hi I've searched everywhere for a solution to my problem but so far no luck. I'd like to detect when a weapon gets reloaded, both infantry weapon and vehicle weapon. I guess you could somehow check when the current magazine in the weapon is out of ammo or something, thus an AI would immediately reload? I know how to count the bullets of all magazines for a ordinary weapon and vehicle weapon but not for just the weapon magazine, at least not for a vehicle weapon. needReload does not help since it returns 0 as soon as the vehicle starts reloading its weapon. Edit: _mag = vehicle player currentweaponTurret [0];player ammo _mag Returns the ammo inside the vehicle weapon magazine but that does not help me since as soon as the vehicle starts reloading an empty magazine it returns a full magazine again. Any help would be much appriciated. Cheers Share this post Link to post Share on other sites
gc8 970 Posted May 11, 2020 Check out the https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Reloaded should do it Share this post Link to post Share on other sites
Taylor1984 14 Posted May 11, 2020 6 minutes ago, gc8 said: Check out the https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Reloaded should do it Thanks. Yes, I did not get it to work and also I read somewhere that it fires after the magazine has been reloaded, which is strange because it says in the description otherwise. I'll try some more. Edit: I tried it with a hint and unfortunately the hint displayed after the reloading process was completed. Maybe something within the EH fires at the intial reloading as well but if that is the case I wouldn't know what do do. Perhaps it has something to do with the "_oldMagazine" param? Share this post Link to post Share on other sites
Harzach 2507 Posted May 11, 2020 For clarity, you want to detect when a unit or vehicle begins the process of reloading a weapon? Can you share a little more info as to why you want to do this? Sometimes the solution isn't directly related to the abstract problem. Share this post Link to post Share on other sites
Taylor1984 14 Posted May 11, 2020 2 minutes ago, Harzach said: For clarity, you want to detect when a unit or vehicle begins the process of reloading a weapon? Can you share a little more info as to why you want to do this? Sometimes the solution isn't directly related to the abstract problem. That's right. I'm doing this RTS style mission and when you select a unit detailed information about this unit is being displayed in real time, like: what weapon he is using, ammo count for that weapon, health status, actions. So if the unit for instance is firing the cannon of a vehicle the picture of a cannon is displayed and his action displays "Firing". Share this post Link to post Share on other sites
Harzach 2507 Posted May 11, 2020 For example, it might be easier to do this with a unit, as you could use the animChanged EH, watching for reload animations. Not sure if this is feasible with most vehicles, if for any at all. Share this post Link to post Share on other sites
Taylor1984 14 Posted May 11, 2020 Just now, Harzach said: For example, it might be easier to do this with a unit, as you could use the animChanged EH, watching for reload animations. Not sure if this is feasible with most vehicles, if for any. Yes, I read about that and maybe that's a solution for a unit on foot. For a unit using the weapon of a vehicle it seems more tricky, at least for me who's not that good at scripting. Share this post Link to post Share on other sites
Taylor1984 14 Posted May 11, 2020 I found this thread on the subject and their mention something using magazinesDetail and magazinesAmmoFull as methods of counting ammo in mags but I couldn't get it to work. Share this post Link to post Share on other sites
Harzach 2507 Posted May 11, 2020 25 minutes ago, Taylor1984 said: I couldn't get it to work. Share your code. Share this post Link to post Share on other sites
JB47394 30 Posted February 7, 2021 On 5/11/2020 at 8:04 AM, Harzach said: For clarity, you want to detect when a unit or vehicle begins the process of reloading a weapon? Can you share a little more info as to why you want to do this? Sometimes the solution isn't directly related to the abstract problem. Unrelated to Taylor's work, I'm trying to reload AI when they're dry on their primaryWeapon. The sequence for a unit loading its final magazine is as follows: 1. Unit runs out of ammo in the weapon. "ammo" returns 0. 2. Unit starts reloading animation. "magazines" returns []. 3. Unit stays at "ammo" 0 and "magazines" [] until the reloading animation is completed. 4. Unit completes reloading animation. "ammo" return N. During step 3, the unit appears to be out of ammo because the scripts cannot observe the magazine in its limbo state. I don't know the implications internal to ARMA, but leaving the magazine in "magazines" until the moment that "ammo" changes would be preferred over the current behavior. Note that this isn't an issue in my use case because I have an infinite supply of ammunition to give my units. In an attempt to locate a rigorous solution, I looked at weapon data and saw a reloadTime (which is always 0.15), as well as a reloadAction that references something in CfgGestures, but none of the data seems to match the reload duration. Share this post Link to post Share on other sites