Rellikplug 11 Posted December 3, 2015 I would like to use the new spectator to switch a killed player to. I was able to get the spectator o activate upon death but I don't know how to get the spectator to close after the player respawns. Respawn settings in description.ext respawn = base; respawnDelay = 60; responDialog = 0; respawnOnStart = 1; respawnTemplates[] = {"MenuPosition"}; initPlayerLocal.sqf player addEventHandler ["killed", { spec = [] execVM "spectator.sqf"; }]; spectator.sqf "VirtualSpectator_F" createUnit [position player, group player, "spectator=this"]; selectPlayer spectator; spectator switchCamera "EXTERNAL"; [] spawn { waitUntil {inputAction "inGamePause" > 0}; }; deleteVehicle spectator; selectPlayer player; player switchCamera "INTERNAL"; Share this post Link to post Share on other sites
neokika 62 Posted December 4, 2015 Hi there. For this type of case, I would suggest using a more direct access (yet undocumented) to spectator functionality. Because you want the player to be able to spectate when dead, and go back to control when he respawns, you can: player addEventHandler ["Killed", { ["Initialize", [player]] call BIS_fnc_EGSpectator; }]; player addEventHandler ["Respawn", { ["Terminate"] call BIS_fnc_EGSpectator; }]; // The following line, starts the spectator functionality for the player ["Initialize", [player]] call BIS_fnc_EGSpectator; // When you want player to go back into control of his unit, for example, after respawn, you can just terminate the spectator the following way: ["Terminate"] call BIS_fnc_EGSpectator; 1 Share this post Link to post Share on other sites
DmitryJDM 1 Posted December 4, 2015 Hello neokika! description.ext Respawn = 3; respawnDelay = 10; respawnDialog = 0; respawnOnStart = -1; respawnTemplates[] = {"Revive"}; reviveDelay = 15; reviveForceRespawnDelay = 5; reviveBleedOutDelay = 250; onPlayerKilled.sqf /* BIS Save Gear */ [player, [missionNamespace, "inventory_var"]] call BIS_fnc_saveInventory; /* BIS Spectator */ ["Initialize", [player]] call BIS_fnc_EGSpectator; onPlayerRespawn.sqf /* BIS Spectator */ ["Terminate"] call BIS_fnc_EGSpectator; /* BIS Load Gear */ [player, [missionNamespace, "inventory_var"]] call BIS_fnc_loadInventory; Result after death, as soon as the time runs revival. Is it possible to remove a red spot on the screen ? Share this post Link to post Share on other sites
Rellikplug 11 Posted December 5, 2015 Well, the function makes things easier for sure. Thanks for the info. Couple of issues though. When using MenuPosition the respawn menu overrides the spectator UI. After closing the Spectator the player is invulnerable. Share this post Link to post Share on other sites
Rellikplug 11 Posted December 23, 2015 After trying and failing to get this to work with Killed and Respawn event handlers combined with respawnTemplates[] = {"MenuPosition"}; I settled on calling the spectator function with an addAction. Here's what I've come up with. // Written by "Rellikplug" a.k.a "Hill [29th ID]" // Filename: spectator.sqf /* Action added to object this addAction [ "<t color='#00ff00'>Spectator</t>", "spectator.sqf", [], 0, false, true, "", "_this distance _target < 2" ]; */ /* While spectating in first-person the keys 'a', 's', 'd', and 'w' will move the spectating player around so we force the player to sit and keep him sitting to prevent unintended movement. */ if (isDedicated || !hasInterface) exitWith {}; // do not run on dedicated server or headlessclient ["Initialize", [player]] call BIS_fnc_EGSpectator; // Start Spectator player action ["SITDOWN", player]; // make player sit down. cutText ["SPECTATOR\n----------\nPress RELOAD to exit","PLAIN DOWN"]; // Tell player they are spectating hintSilent "SPECTATOR\n----------\nPress RELOAD to exit"; // Tell player they are spectating ["exitSpect", "onEachFrame", { if (stance player != "CROUCH") then { // check if player is still sitting player action ["SITDOWN", player]; // if player is not sitting then sit him back down }; if (inputAction "ReloadMagazine" > 0) exitWith { // Check if "Reload" key is pressed ["Terminate"] call BIS_fnc_EGSpectator; // End Spectator cutText ["","PLAIN DOWN"]; // Clear cutText hintSilent ""; // Clear Hint player allowDammage true; // Make player vulnerable again because BIS forgot player switchCamera "internal"; // Make sure the camera is returned to the player ["exitSpect", "onEachFrame"] call BIS_fnc_removeStackedEventHandler; // Remove the stackedEventHandler as we no longer need it }; }] call BIS_fnc_addStackedEventHandler; sleep 30; if (!isNil {missionNamespace getVariable "BIS_EGSpectator_initialized"}) then { // Check if spectator is active [] spawn { while {!isNil {missionNamespace getVariable "BIS_EGSpectator_initialized"}} do { // While spectator is active show messages cutText ["SPECTATOR\n----------\nPress RELOAD to exit","PLAIN DOWN"]; hintSilent "SPECTATOR\n----------\nPress RELOAD to exit"; sleep 30; // Show message every 30 seconds }; }; }; Share this post Link to post Share on other sites
neokika 62 Posted January 11, 2016 Hello neokika! Result after death, as soon as the time runs revival. Is it possible to remove a red spot on the screen ? /* BIS Save Gear */ [player, [missionNamespace, "inventory_var"]] call BIS_fnc_saveInventory; /* BIS Spectator */ ["Initialize", [player]] call BIS_fnc_EGSpectator; /* Stop revive effects */ [] spawn { sleep 1; if (!isNil { bis_revive_ppColor }) then { bis_revive_ppColor ppEffectCommit 0; bis_revive_ppColor ppEffectEnable false; }; if (!isNil { bis_revive_ppVig }) then { bis_revive_ppVig ppEffectCommit 0; bis_revive_ppVig ppEffectEnable false; }; if (!isNil { bis_revive_ppBlur }) then { bis_revive_ppBlur ppEffectCommit 0; bis_revive_ppBlur ppEffectEnable false; }; }; OnPlayerKilled.sqf This should allow you to hot fix this issue until we make a proper fix to the revive screen effects. Thanks for the report. ;) Share this post Link to post Share on other sites
Rellikplug 11 Posted January 29, 2016 I am trying to initialize the function BIS_fnc_EGspectator in a mission without respawns where respawn = 0; I cannot seem to get it to work. description.ext respawn = 0; respawndelay = 3; onPlayerKilled.sqf ["Initialize", [player]] call BIS_fnc_EGSpectator; I even tried using playerKilled.sqs instead of onPlayerkilled.sqf if (!isnil "BIS_fnc_feedback_allowPP") then {BIS_fnc_feedback_allowPP = false} ["Initialize", [player]] call BIS_fnc_EGSpectator Is it not working because there is nothing to attach the virtual entity to? Share this post Link to post Share on other sites
=242= CPT. Helios 18 Posted May 27, 2016 Is there a way to close the menuposition dialog without respawning? Share this post Link to post Share on other sites