Page MenuHomeFeedback Tracker

[Feature Request] Unloaded EventHandler
Feedback, NormalPublic

Description

Instead of firing whenever a weapon's magazine is replaced like Reloaded does, this proposed Unloaded event handler would only occur when the magazine is removed without being replaced. This could be a result of a player removing the magazine manually from within the inventory, and potentially via scripting command such as removePrimaryWeaponItem.

this addEventHandler ["Unloaded", {
params ["_unit", "_weapon", "_muzzle", "_oldMagazine"];
}];

unit: Object - unit or vehicle to which EH is assigned
weapon: String - weapon that got unloaded
muzzle: String - weapon's muzzle that got unloaded
oldMagazine: Array - old magazine info

Details

Severity
Feature
Resolution
Open
Reproducibility
N/A
Operating System
Windows 10 x64
Category
Config

Event Timeline

Vespade created this task.Aug 25 2023, 8:50 PM
dedmen set Ref Ticket to AIII-56205.May 15 2024, 2:54 PM
dedmen changed the task status from New to Feedback.EditedMay 15 2024, 3:58 PM
dedmen added a subscriber: dedmen.

"MagazineUnloaded"
[B Alpha 1-1:3 (dedmen),"arifle_MXC_F","arifle_MXC_F",["30Rnd_65x39_caseless_mag",30,1.00003e+07,0]]
[B Alpha 1-1:3 (dedmen),"hgun_P07_F","hgun_P07_F",["16Rnd_9x21_Mag",16,1.00003e+07,0]]

I only tested player taking magazine out of their gun.
Not tested anything multiplayer, nor other ways to remove the magazine.

Reload does not trigger MagazineUnloaded.
MagazineUnloaded checks if "replaceMagazine" has the new magazine be a null.
Also doesn't fire if you somehow unload a gun that was already unloaded.

I noticed it didn't work right with vehicles and removeMagazinesTurret.
I fixed that now. But I don't have time to properly fix all possible ways of removing magazines.
And also not sure if it might not double trigger the EH in some case.

Good luck testing :3

It seems that this eventhandler is currently not able to be given to a weapon class like reloaded or fired can. Here is what I was testing:

class EventHandlers: EventHandlers
{
    magazineUnloaded = "hint str _this;";
};
dedmen added a comment.Aug 6 2024, 3:31 PM

Checked the code, it is definitely loading it like the other events.
If you can give me a example config to try it I can try, but from what I can see it should be working fine.