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.
Description
Details
- Severity
- Tweak
- Resolution
- No Bug
- Reproducibility
- Always
- Operating System
- Windows 10 x64
- Operating System Version
- 1809
- Category
- Virtual Arsenal
- Equip loadout with backpack
- 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;
- Open BI arsenal
- Close BI arsenal and read hint
Event Timeline
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
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.