Page MenuHomeFeedback Tracker

[Feature Request] WeaponSlotItemChanged EventHandler
Feedback, NormalPublic

Description

Since SlotItemChanged cannot be used for items in the attachment slots of a weapon, something like WeaponSlotItemChanged could be used to determine when a player changes attachments or loads/unloads a magazine.

(Since loading a magazine already has a specific EventHandler (Reloaded), and magazines change a lot more often than attachments typically will, it may be wise to keep magazines separate and just include an Unloaded type event handler.)

this addEventHandler ["WeaponSlotItemChanged", {
	params ["_unit", "_weapon", "_name", "_slot", "_assigned"];
}];

unit: Object - unit EH assigned to.
weapon: String - class name of the weapon whose slot item changed.
name: String - name of the item (see getSlotItemName).
slot: Number - slot id (see getSlotItemName).
assigned: Boolean - true assign action, false unassign action.

Details

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

Event Timeline

Vespade created this task.Dec 8 2023, 6:58 PM
dedmen set Ref Ticket to AIII-56205.Jan 17 2024, 7:00 PM
dedmen added a subscriber: dedmen.May 15 2024, 2:04 PM

"Since SlotItemChanged cannot be used for items in the attachment slots of a weapon"
Well why not add it to the existing EH?

https://community.bistudio.com/wiki/getSlotItemName

Flashlight is 301, UnderBarrel 302, Muzzle 101, Optics 201
We would just need to pass one extra parameter, the weapon classname?

SlotItemChanged

[B Alpha 1-1:1 (dedmen),"optic_Aco",201,false,"arifle_MX_ACO_pointer_F"]
[B Alpha 1-1:1 (dedmen),"optic_Aco",201,true,"arifle_MX_ACO_pointer_F"]
[B Alpha 1-1:1 (dedmen),"acc_pointer_IR",301,false,"arifle_MX_ACO_pointer_F"]
[B Alpha 1-1:1 (dedmen),"acc_pointer_IR",301,true,"arifle_MX_ACO_pointer_F"]

Magazines are not in there, because they'll be handled by Reloaded EH and https://feedback.bistudio.com/T174935

dedmen changed the task status from New to Feedback.May 15 2024, 4:03 PM
Vespade added a comment.EditedJun 11 2024, 7:53 PM

Having a Weapon Muzzle Config Event version of the SlotItemChanged event handler would allow you to focus on the attachment changes for a specific weapon as opposed to having to listen to every change on the unit in order to find the event you're looking for. This would be extremely useful in cases where weapon classes must change in order to provide new animations that fit with the attachments added, similar to how RHS does their foregrip system.