Jump to content
Sign in to follow this  
FartParty

Using Kegety's spectator script with respawns?

Recommended Posts

I'm working on a mission that uses kegety's spectator script

currently, when you are killed, you respawn in what i call respawn prison. in there, you find a sign that explains what this is, and takes you to the spectator screen, both on addactions

this all works perfectly fine, apart from a few errors from the script (probably outdated)

but after that, you cannot exit the script.

The idea is that the killed players are not allowed to respawn until the rest of their team reaches a certain checkpoint, hence the respawn prison

but now, when the players are respawned, they are stuck in the spectator mode and can't leave

how can i terminate the script when the script user is farther than 100 meters from the signpost?

Share this post


Link to post
Share on other sites

try this, in specta.sqf

find the line.....line number 325 in the version i have

While { VM_SpectatorCamerasEnabled } do {

and put this after it

if(alive player)exitwith{};

it's a hard question to answer because you have several conditions,

team reaches a certain checkpoint...

when the players are respawned....

user is farther than 100 meters from the signpost...

you should exit the spec script but it might not be when you want to.

Edited by Squeeze

Share this post


Link to post
Share on other sites

that wouldn't exactly work, as the player is alive the entire time the script is running

he is killed, respawns, and chooses "spectate" from an object at his spawn

then when he is teleported away, the spectate script should be ended

Share this post


Link to post
Share on other sites

then put in front of it

_playerPosition = getPos player;

While { VM_SpectatorCamerasEnabled } do {

if(((getPos player) distance playerPosition) > 100)exitwith{};

hopefully the prison is 100 meters or more away from the teleport position

Share this post


Link to post
Share on other sites

eh, thanks, but no luck

you're still stuck in spectate mode forever

thanks though, i'm learning a lot

Share this post


Link to post
Share on other sites

i just push escape with the version i have, check the bottom of the specta.sqf script, I changed mine to this, i think it loops otherwise

};
StartLoadingScreen ["EXITING SPECTATOR MODE..."];
_debugPlayer groupchat format ["EXITING SPECTATOR MODE", VM_SpectatorCamerasEnabled];
VM_SpectatorCamerasEnabled = False;
// Dialog closed with esc key
titleText["","BLACK IN", 0.5];

// Destroy cameras, markers, particlesources, etc.
_debugPlayer groupchat format ["Destroying Cameras", VM_SpectatorCamerasEnabled];
camDestroy KEGscam_target;
camDestroy KEGscam_missile;
camDestroy KEGscam_fullmap;
//deletevehicle KEGscam_target;
//deletevehicle KEGscam_missile;
//deletevehicle KEGscam_fullmap;
{camDestroy _x} foreach KEGs_cameras;
{deletemarkerlocal _x} foreach _markers;	 
_debugPlayer groupchat format ["Cleaning up", VM_SpectatorCamerasEnabled];
deletevehicle _t;
deletevehicle KEGs_dummy;
// camUseNVG false;
// KEGsTags = false;
//onMapSingleClick "";
{deletevehicle (_x select 1)} foreach KEGsTagSources;
KEGsTagSources = [];

// Remove eventhandlers TODO: does this work properly?
{
_fh = _x getVariable "KEGsEHfired";
//_kh = _x getVariable "KEGsEHkilled";
if(typeName _fh == "SCALAR") then {_x removeEventHandler["fired", _fh]};
//if(typeName _kh == "SCALAR") then {_x removeEventHandler["killed", _kh]};
} foreach _ehVehicles;


//_debugPlayer groupchat format ["ENTERING ButterFly Mode", VM_SpectatorCamerasEnabled];
//// Create a butterfly for player to fly with
//_bpos = [(((vehicle KEGs_target)modelToWorld [0,0,0])  select 0)-5+random 10, (((vehicle KEGs_target) modelToWorld [0,0,0])  select 1)-5+random 10, 1];
//// _bird = "ButterFlySpectator"createVehicle _bpos; //custom ButterFly for improved flight.
//_bird = "SeaGull" createvehicle _bpos;
//_bird setvelocity[0,0,5];
//_bird setpos _bpos;
//_bird switchCamera "INTERNAL";
//
//_bird cameraEffect["terminate","FRONT"];
//_bird camCommand "manual on";
//
//camUseNVG false; setAperture -1; //  Reset NVGs
EndLoadingScreen;	
//KEGsBird = _bird;
//onMapSingleClick "KEGsBird setpos [_pos select 0, _pos select 1, 2];KEGsBird setvelocity[0,0,5];";
//
//cutText["\n\n\n\n\nLand on ground to return to spectating\nClick at map to jump to location","PLAIN DOWN", 0.75];
//
//// Wait until landed, delete bird & restart script
//waitUntil{(_bird modelToWorld [0,0,0]) select 2 < 0.05 and speed _bird < 1};
//onMapSingleClick "";
//
//sleep(0.5);
//if !( f_var_debugMode == 1 ) then {
//	titleText["","BLACK OUT", 0.5];
//	sleep(1);
//};
//
//
_player switchCamera "INTERNAL";
_player cameraEffect["terminate","FRONT"];
//deletevehicle _bird;
//if !( f_var_debugMode == 1 ) then {
//	[_player, _killer, "noWait"] execVM ("Player\spect\specta.sqf");
//};

Share this post


Link to post
Share on other sites
i just push escape with the version i have, check the bottom of the specta.sqf script, I changed mine to this, i think it loops otherwise

};
StartLoadingScreen ["EXITING SPECTATOR MODE..."];
_debugPlayer groupchat format ["EXITING SPECTATOR MODE", VM_SpectatorCamerasEnabled];
VM_SpectatorCamerasEnabled = False;
// Dialog closed with esc key
titleText["","BLACK IN", 0.5];

// Destroy cameras, markers, particlesources, etc.
_debugPlayer groupchat format ["Destroying Cameras", VM_SpectatorCamerasEnabled];
camDestroy KEGscam_target;
camDestroy KEGscam_missile;
camDestroy KEGscam_fullmap;
//deletevehicle KEGscam_target;
//deletevehicle KEGscam_missile;
//deletevehicle KEGscam_fullmap;
{camDestroy _x} foreach KEGs_cameras;
{deletemarkerlocal _x} foreach _markers;	 
_debugPlayer groupchat format ["Cleaning up", VM_SpectatorCamerasEnabled];
deletevehicle _t;
deletevehicle KEGs_dummy;
// camUseNVG false;
// KEGsTags = false;
//onMapSingleClick "";
{deletevehicle (_x select 1)} foreach KEGsTagSources;
KEGsTagSources = [];

// Remove eventhandlers TODO: does this work properly?
{
_fh = _x getVariable "KEGsEHfired";
//_kh = _x getVariable "KEGsEHkilled";
if(typeName _fh == "SCALAR") then {_x removeEventHandler["fired", _fh]};
//if(typeName _kh == "SCALAR") then {_x removeEventHandler["killed", _kh]};
} foreach _ehVehicles;


//_debugPlayer groupchat format ["ENTERING ButterFly Mode", VM_SpectatorCamerasEnabled];
//// Create a butterfly for player to fly with
//_bpos = [(((vehicle KEGs_target)modelToWorld [0,0,0])  select 0)-5+random 10, (((vehicle KEGs_target) modelToWorld [0,0,0])  select 1)-5+random 10, 1];
//// _bird = "ButterFlySpectator"createVehicle _bpos; //custom ButterFly for improved flight.
//_bird = "SeaGull" createvehicle _bpos;
//_bird setvelocity[0,0,5];
//_bird setpos _bpos;
//_bird switchCamera "INTERNAL";
//
//_bird cameraEffect["terminate","FRONT"];
//_bird camCommand "manual on";
//
//camUseNVG false; setAperture -1; //  Reset NVGs
EndLoadingScreen;	
//KEGsBird = _bird;
//onMapSingleClick "KEGsBird setpos [_pos select 0, _pos select 1, 2];KEGsBird setvelocity[0,0,5];";
//
//cutText["\n\n\n\n\nLand on ground to return to spectating\nClick at map to jump to location","PLAIN DOWN", 0.75];
//
//// Wait until landed, delete bird & restart script
//waitUntil{(_bird modelToWorld [0,0,0]) select 2 < 0.05 and speed _bird < 1};
//onMapSingleClick "";
//
//sleep(0.5);
//if !( f_var_debugMode == 1 ) then {
//	titleText["","BLACK OUT", 0.5];
//	sleep(1);
//};
//
//
_player switchCamera "INTERNAL";
_player cameraEffect["terminate","FRONT"];
//deletevehicle _bird;
//if !( f_var_debugMode == 1 ) then {
//	[_player, _killer, "noWait"] execVM ("Player\spect\specta.sqf");
//};

thanks, this works perfectly!

---------- Post added at 23:29 ---------- Previous post was at 23:28 ----------

all i have to do now is find a version if his spec script that doesn't spit errors at me constantly

then i'm done

Share this post


Link to post
Share on other sites

Here you go:

https://dl.dropboxusercontent.com/u/96469595/Spectator/spectator_a3_v1.zip

I've modified the original brilliant Kegety's spectator script to work with A3

Feedback appreciated

Changes:

- Removed a few camera features

- Added a new 'free camera' to replace the hard to handle butterfly camera

- Added NVG and thermal (white and black) night vision modes (toggle using n key)

- Map Marker Updates are enabled by default (toggle using h key)

- Unit Tags are enabled by default (toggle using t key)

Usage:

- unzip file in spectator sub dir of mission folder

- add the following to 'description.ext' file:

#include "spectator\spectating.hpp"

- for manual start call spectator script with:

[player,player,"noWait"] execVM MCC_path + "spectator\specta.sqf";

There are only 3 camera view modes, which can be cycled by mouse menu or c (camera) key

- lock-on: will allow you to focus on a unit and circle around by pressing right mouse button and zoom using mouse wheel

- chase: will chase the selected unit

- free: travel camera around using w,s,a,d,q,z keys, mouse scroll wheel, right mouse to circle, and press Alt key to speed up, and use ctrl key for turbo mode

select unit on map to focus on unit, or to move free cam to that location

m key - toggle map - mini map - no map

h key - while on map stop updating markers in case of low perf

n key - toggle night vision and thermal modes

t key - toggle unit side identification

1,2,3 - direct cam switch

c - cycle camera mode

f1 - help

esc - close spectaor mode

tab - hide hud

Share this post


Link to post
Share on other sites

Looking for samething but without respawns.. And also how to make kegetys script work. I tried using it but it seems doesn't work.

Edited by Fortychambers

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  

×