Jump to content
Sign in to follow this  
IGG Jaypee

EG spectator close on escape key

Recommended Posts

Hi Guys

 

I,m running the eg spectator when the player is alive through addaction on a laptop model.

 

spectator.sqf:

_spectator_settings = [
player, // The target player object
[],  // Whitelisted sides, empty means all
false,  // Whether AI can be viewed by the spectator
false,  // Whether Free camera mode is available
true,  // Whether 3th Person Perspective camera mode is available
true,   // Whether to show Focus Info stats widget
false,  // Whether or not to show camera buttons widget
true,   // Whether to show controls helper widget
true,   // Whether to show header widget
true    // Whether to show entities / locations lists
];


["Initialize", _spectator_settings] call BIS_fnc_EGSpectator;

I want to be able to close it again through keyboard event.

Hitting escape now will open the main menu.

Using displayAddEventHandler seems the way to go but how do I find the spectator display? If there is another easy way to close the spectator system i'd also gladly hear it.

 

 

Share this post


Link to post
Share on other sites

In a similiar situation i used a missionNamespace variable to exit while loop. Not the best way but it works.

missionNamespace setVariable ["ESCape", 0,false];
while (true) do {
_escape = missionNamespace getVariable "ESCape";
 sleep 1;
if (_escape == 1) exitWith {["Terminate"] call BIS_fnc_EGSpectator};
};

And in the ESC keybind i had

missionNamespace setVariable ["ESCape", 1,false];

Share this post


Link to post
Share on other sites

I want to be able to close it again through keyboard event.

Hitting escape now will open the main menu.

Using displayAddEventHandler seems the way to go but how do I find the spectator display? If there is another easy way to close the spectator system i'd also gladly hear it.

 

Hi there.

Like @Banae mentioned, you can use BIS_fnc_EGSpectator to shut it down, in a similar way how you initialize it.

["Terminate"] call BIS_fnc_EGSpectator;

Share this post


Link to post
Share on other sites

Thanks for the answers guys. Though: I knew that i need to call:

["Terminate"] call BIS_fnc_EGSpectator;

My question is how do I get user input to fire aforementioned piece of script?

Share this post


Link to post
Share on other sites

 

In a similiar situation i used a missionNamespace variable to exit while loop. Not the best way but it works.

missionNamespace setVariable ["ESCape", 0,false];
while (true) do {
_escape = missionNamespace getVariable "ESCape";
 sleep 1;
if (_escape == 1) exitWith {["Terminate"] call BIS_fnc_EGSpectator};
};

And in the ESC keybind i had

missionNamespace setVariable ["ESCape", 1,false];

 

that keybind you are speaking of is that in options-> controls where you set it?

 

Also:

_KeyDown = (findDisplay 46) displayAddEventHandler ["KeyUp", "hint str _this"];

doesn't show any keys when the spectator camera is running. Anyone know what is up with that?

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
Sign in to follow this  

×