Jump to content
Jack Ost

[Solved] ArsenalOpened ScriptedEventHandler in Eden Editor

Recommended Posts

Hi all,

 

I have a problem with the "ArsenalOpened" scriptedEventHandler. This EH work in the game but not in Eden Editor. I have a function to declare EH at start.

CfgFunctions from config.cpp :

class arsenal_postInit
{
	postInit=1; //doesn't work for Eden Editor
	preStart = 1; //doesn't work for VirtualArsenal from Menu (and ingame) and Eden Editor
};

arsenal_postInit Function :

if (hasInterface) then {

	[currentNamespace, "arsenalOpened", ACC_fnc_arsenal_Opened] call BIS_fnc_addScriptedEventHandler;
};

What is wrong ? It's a bug ?

Share this post


Link to post
Share on other sites

Why do you postInit it???

Why don't you use missioNameSpace?

 

Just in init.sqf:

[missionNamespace, "arsenalOpened", ACC_fnc_arsenal_Opened] call BIS_fnc_addScriptedEventHandler;

just tried [missionNamespace, "arsenalOpened", {hint "ok"}] call BIS_fnc_addScriptedEventHandler;

 

if ACC_fnc_arsenal_opened is defined and is a code,  this is fine!

imho, the hasinterface condition is useless.
 

  • Like 1

Share this post


Link to post
Share on other sites
2 hours ago, pierremgi said:

Why do you postInit it???

Why don't you use missioNameSpace?

 

Just in init.sqf:

[missionNamespace, "arsenalOpened", ACC_fnc_arsenal_Opened] call BIS_fnc_addScriptedEventHandler;

just tried [missionNamespace, "arsenalOpened", {hint "ok"}] call BIS_fnc_addScriptedEventHandler;

 

if ACC_fnc_arsenal_opened is defined and is a code,  this is fine!

imho, the hasinterface condition is useless.
 

Firstly, thanks for your answer.

 

Why postInit : Because prestart doesn't work at all

Why not missionNameSpace : I used missionNameSpace but for my problem, I thought that there is a special namespace for eden.

 

I try this : [missionNamespace, "arsenalOpened",{cutText ["it's work !","PLAIN",2];}] call BIS_fnc_addScriptedEventHandler;

Result :

- It's work perfectly with "preInit=1;" in the game and in the menu but NOT in eden.

- It's doesn't work at all with "prestart=1;".

 

Why hasinterface useless ? I don't want that my script will be run by the server.

Share this post


Link to post
Share on other sites

I just thought you will make it work  in Eden "preview", not in editor.

And, yes, I know what hasInterface means. It's just because I thought "open arsenal" already meant you have an interface! If not, no clue how do you open it.

 

You could try this , for editor session:


 

add3DENEventHandler ["OnEntityMenu",{
  [] spawn {
    waitUntil {!isNull (uiNamespace getVariable ["RscDisplayArsenal", displayNull])};
   systemChat "tada"
  }
}];

 

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Thank you so much, it's work fine.

 

I need to make some adjustments but the EH works.

  • Like 1

Share this post


Link to post
Share on other sites

if someone want the good init for the EH :

params ["_position", "_entity", "_listPath"];
[_entity] spawn {
    params ["_entity"];
    _wait = missionNamespace getVariable ["ACC_Eden", false];
    if (_wait) exitWith {};
    missionNamespace setVariable ["ACC_Eden", true, false];
    waitUntil {!isNull (uiNamespace getVariable ["RscDisplayArsenal", displayNull])};
    missionNamespace setVariable ["ACC_Eden", false, false];
    _display = uiNamespace getVariable ["RscDisplayArsenal", displayNull];
    sleep 1;
    [_display] call ACC_fnc_arsenal_Opened;
}

_listPath seem to stay allways null but I don't need it.

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

×