Page MenuHomeFeedback Tracker

Arsenal "arsenalOpened" event called after arsenal opened
Reviewed, NormalPublic

Description

When opening the virtual arsenal, the scripted event "arsenalOpened" will execute after the arsenal has already opened, instead of before. This creates issues when wanting to get variable names off assigned objects before they disappear.

Details

Severity
Tweak
Resolution
No Bug
Reproducibility
Always
Operating System
Windows 10 x64
Operating System Version
1809
Category
Virtual Arsenal
Steps To Reproduce
  1. Equip loadout with backpack
  2. Execute the following code in the debug console as local
(backpackContainer player) setVariable ["ArsenalEventTest", "event fired correctly"];
[missionNamespace,
 "arsenalOpened",
 {
    hint str ((backpackContainer player) getVariable ["ArsenalEventTest", "event fired late"];
}] call BIS_fnc_addScriptedEventHandler;
  1. Open BI arsenal
  2. Close BI arsenal and read hint

Event Timeline

BIS_fnc_KK added a subscriber: BIS_fnc_KK.EditedMay 22 2020, 4:53 PM

This event handler is designed to fire after the event. Perhaps you could try to store backpack reference in a mission variable instead of on player as player may be replaced with dummy when arsenal is opened

BIS_fnc_KK changed the task status from New to Reviewed.May 22 2020, 4:53 PM
BIS_fnc_KK changed Resolution from Open to No Bug.
dedmen added a subscriber: dedmen.May 23 2020, 2:44 PM

Arsenal "arsenalOpened" event called after arsenal opened

Uhm yes. The name is "Opened" in past-tense not "Open"

I use CBA's display open EH to do what you want to do https://github.com/michail-nikolaev/task-force-arma-3-radio/blob/master/addons/core/CfgEventHandlers.hpp#L24

Maybe we could add a "arsenalPreOpen" eventhandler as a suitable workaround?

Apologies to revive this, but it may be easier to keep it here than in a new issue.

Maybe we could add a "arsenalPreOpen" eventhandler as a suitable workaround?

This would be great. Currently CBA's Display Open XEH is called after the arsenal is initialized, meaning gear is deleted and replaced. The only workaround is to add override / add an init to one of the first controls which is initialized in order to process any variables associated with the gear before they are removed. Adding an "arsenalPreOpen" event would allow a much easier implementation of this while retaining compatibility between different scripts which currently may try to override the same init.