Page MenuHomeFeedback Tracker

"InventoryOpened" EH does not provide full information on what containers were opened
Closed, ResolvedPublic

Description

When "InventoryOpened" event handler triggers it only provides single container and omits cases where two containers were opened by same time - ground weapon holder and vehicle container nearby. I propose to extend "InventoryOpened" to provide both opened containers in cases where two were opened: [<unit>, <ground>, <crate>]. To retain backwards compatibility I suggest to include two only if there is actually two containers and return old format when there is just one container.

Details

Legacy ID
3905290776
Severity
None
Resolution
Fixed
Reproducibility
N/A
Operating System
Windows 7
Category
Scripting
Steps To Reproduce
  1. Open Editor, select Stratis
  2. Place player unit and add to Init line: player addEventHandler ["InventoryOpened", {systemChat str _this;}];
  3. Place any weapon crate nearby
  4. Start mission, stand right on the crate looking slightly above it so that there would be no "Inventory" action on it
  5. Press I to open Inventory and observe that event handler returned only new weapon holder while inventory screen has both Ground and Crate tabs active.
Additional Information

Additionally in case where two containers were opened "ContainerOpened" event handler should be called on both instead of one like it is right now.

Event Timeline

SaMatra edited Steps To Reproduce. (Show Details)Mar 16 2015, 3:53 PM
SaMatra edited Additional Information. (Show Details)
SaMatra set Category to Scripting.
SaMatra set Reproducibility to N/A.
SaMatra set Severity to None.
SaMatra set Resolution to Open.
SaMatra set Legacy ID to 3905290776.May 8 2016, 11:41 AM
SaMatra edited a custom field.
Lux0r added a comment.May 5 2015, 10:59 AM

I fully agree with SaMatra, this feature is currently missing. It seems to be impossible to protect gear, by limiting the excess to it with the existing event handlers.
The first variant, extending the EH with an additional parameter, is the more comfortable solution, imho. Because it allows to easily handle everything in this single call. If the EH is called several times on the other hand, it might be required to synchronize the results.

Another event handler could also be helpful to detect when a player switches between the weapon holders in the inventory (e.g.: 'Ground' to 'Crate').

Suggestion:

InventorySwitched

  • unit: Object - Object the event handler is assigned to
  • containerOld: Object - The previous selected container or weaponholder
  • containerNew: Object - The new selected container or weaponholder

As a workaround, all nearby containers could be retrieved with nearSupplies command. It is guaranteed that the missing container will be among them. How you then handle it is up to you.

vbawol added a subscriber: vbawol.May 8 2016, 11:41 AM

1+
nearSupplies workaround can be a bit sloppy. Please do extend InventoryOpened EH to return all connected containers.

"InventoryOpened" now returns second connected container

BIS_fnc_KK closed this task as Resolved.Nov 1 2016, 10:38 PM
BIS_fnc_KK changed Resolution from Open to Fixed.
BIS_fnc_KK edited Steps To Reproduce. (Show Details)
BIS_fnc_KK set Operating System to Windows 7.

Still not solved, if you have body near crate and open body inventory, EH returns body and null object, while both body and crate are available in the inventory menu.

Should be fixed since 1.67.139727