Jump to content
iV - Ghost

Arsenal: Exit before open

Recommended Posts

Is it possible to prevent opening virtual arsenal by using the ArsenalPreOpen eventhandler?

I don't want to close display if arsenal is open.



Use scripted eventhandler:

[missionNamespace, "arsenalPreOpen", {

	_this spawn {
		params ["_display"];
		["Arsenal"] call iV_fnc_checkCondition;    // Loop
}] call BIS_fnc_addScriptedEventHandler;



Close display:

(uiNamespace getVariable ["RscDisplayArsenal", displayNull]) closeDisplay 1;


Share this post

Link to post
Share on other sites

no, unfortunaltely it's not possible.
"arsenalPreOpen" is called right before the script creates arsenal display and cannot be interrupted.
you have to wait until player opens arsenal and immediately close it.

[missionNamespace, "arsenalOpened",
private _shouldClose = ["Arsenal"] call iV_fnc_checkCondition;
if (_shouldClose) then {
(uiNamespace getVariable ["RscDisplayArsenal", displayNull]) closeDisplay 2;
}] call BIS_fnc_addScriptedEventHandler;

I'm not sure how you create arsenal in your mission but if you create Arsenal with "AmmoboxInit" you can consider adding variable to condition that would allow you to restrict or allow arsenal during the mission.

ArsenalAllowed = TRUE;//Boolean to enable or disable arsenal, define it before calling BIS_fnc_arsenal-needs to be publicVariabled in multiplayer with every change
["AmmoboxInit", [ammobox, true, { _this distance _target  < 10 AND ArsenalAllowed}]] call BIS_fnc_arsenal;

this way you can prevent opening arsenal and at the same time you will not close arsenal for players that have it already opened.

  • Like 2

Share this post

Link to post
Share on other sites

Yes I'm creating my arsenal with "AmmoboxInit".

Having missed the possibility for the condition.

Will give it a try. Thx

Share this post

Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in

Sign In Now