Creating a spawn intro cut-scene?

lazyink

Valued Member!
Staff member
I was wondering if anyone knew how to create a pan and zoom to player effect, with the camera, when a player spawns in?

thanks folks...
 

lport3

New Member
camera_init.sqf
Code:
waitUntil {!isNil ("dayzLoginRecord")};
 
//intro move
showCinemaBorder true;
camUseNVG false;
 
_camera = "camera" camCreate [(position player select 0)-100*sin (round(random 359)), (position player select 1)-100*cos (round(random 359)),(position player select 2)+60];
_camera cameraEffect ["internal","back"];
 
_camera camSetFOV 2.000;
_camera camCommit 0;
waitUntil {camCommitted _camera};
 
_camera camSetTarget vehicle player;
_camera camSetRelPos [0,0,0];
_camera camCommit 8;
waitUntil {camCommitted _camera};
 
_camera cameraEffect ["terminate","back"];
camDestroy _camera;
mpmission init.sqf
Code:
if (!isDedicated) then {
    //Conduct map operations
    0 fadeSound 0;
    waitUntil {!isNil "dayz_loadScreenMsg"};
    dayz_loadScreenMsg = (localize "STR_AUTHENTICATING");
   
    //Run the player monitor
    _id = player addEventHandler ["Respawn", {_id = [] spawn player_death; _nul = [] execVM "camera_init.sqf";}];
    _playerMonitor =    [] execVM "\z\addons\dayz_code\system\player_monitor.sqf";
    _nul = [] execVM "camera_init.sqf";
 
camera_init.sqf
Code:
waitUntil {!isNil ("dayzLoginRecord")};
 
//intro move
showCinemaBorder true;
camUseNVG false;
 
_camera = "camera" camCreate [(position player select 0)-100*sin (round(random 359)), (position player select 1)-100*cos (round(random 359)),(position player select 2)+60];
_camera cameraEffect ["internal","back"];
 
_camera camSetFOV 2.000;
_camera camCommit 0;
waitUntil {camCommitted _camera};
 
_camera camSetTarget vehicle player;
_camera camSetRelPos [0,0,0];
_camera camCommit 8;
waitUntil {camCommitted _camera};
 
_camera cameraEffect ["terminate","back"];
camDestroy _camera;
mpmission init.sqf
Code:
if (!isDedicated) then {
    //Conduct map operations
    0 fadeSound 0;
    waitUntil {!isNil "dayz_loadScreenMsg"};
    dayz_loadScreenMsg = (localize "STR_AUTHENTICATING");
 
    //Run the player monitor
    _id = player addEventHandler ["Respawn", {_id = [] spawn player_death; _nul = [] execVM "camera_init.sqf";}];
    _playerMonitor =    [] execVM "\z\addons\dayz_code\system\player_monitor.sqf";
    _nul = [] execVM "camera_init.sqf";
I'm looking for the same thing. Not that into replacing things though. Would you mind explaining further Iport3?
 
If I understand correctly - Make a file in your missions folder named camera_init.sqf with the above in it.

Insert the 2nd stuff into your INIT.sqf
 

lazyink

Valued Member!
Staff member
One last thing.

The script seems to be working for some players but not for others (me being one of the others). Is it disabled under certain graphics settings?

Thanks
 

Fr1nk

Valued Member!
Was late when I tried this, but I couldn't get it to work either. It also clobbered my debug monitor. Only spent 5 minutes working on it though, might have better luck today.
 
camera_init.sqf
Code:
waitUntil {!isNil ("dayzLoginRecord")};
 
//intro move
showCinemaBorder true;
camUseNVG false;
 
_camera = "camera" camCreate [(position player select 0)-100*sin (round(random 359)), (position player select 1)-100*cos (round(random 359)),(position player select 2)+60];
_camera cameraEffect ["internal","back"];
 
_camera camSetFOV 2.000;
_camera camCommit 0;
waitUntil {camCommitted _camera};
 
_camera camSetTarget vehicle player;
_camera camSetRelPos [0,0,0];
_camera camCommit 8;
waitUntil {camCommitted _camera};
 
_camera cameraEffect ["terminate","back"];
camDestroy _camera;
mpmission init.sqf
Code:
if (!isDedicated) then {
    //Conduct map operations
    0 fadeSound 0;
    waitUntil {!isNil "dayz_loadScreenMsg"};
    dayz_loadScreenMsg = (localize "STR_AUTHENTICATING");
 
    //Run the player monitor
    _id = player addEventHandler ["Respawn", {_id = [] spawn player_death; _nul = [] execVM "camera_init.sqf";}];
    _playerMonitor =    [] execVM "\z\addons\dayz_code\system\player_monitor.sqf";
    _nul = [] execVM "camera_init.sqf";

you forgot the }; on the end bro
 

CommanderRetra

Moderator
Staff member
Love to use this script although be great if you fixed up the code so that the camera worked for every one all the time not every now and then. Great script though :)
 

ALKINDA

Valued Member!
seems by observation the script only runs once and when the server restarts it will do it once again upon login. so can we figure out how to exec this every logout?
 

AlienX

Valued Member!
Hello all,

I saw this and instantly wanted it - however it was bad to see that it didnt work upon next login until the server is rebooted.

However, i have fixed this now, and also i have made some small changes to the script.

This is how its setup on my mission:

1) create a folder called Camera inside your mission folder
2) create a file called loginCamera.sqf and paste the following code into it:
Code:
private [ "_camera", "_welcomeMessage", "_camDistance" ];
_welcomeMessage = format["Welcome to AlienX's UK130 Server %1, Enjoy your stay!",format["%1", name player]];
_camDistance = 60;
 
waitUntil {!isNil ("dayzLoginRecord")};
 
//intro move
showCinemaBorder true;
camUseNVG false;
 
_camera = "camera" camCreate [(position player select 0)-2, position player select 1,(position player select 2)+_camDistance];
_camera cameraEffect ["internal","back"];
 
_camera camSetFOV 2.000;
_camera camCommit 0;
waitUntil {camCommitted _camera};
 
_camera camSetTarget vehicle player;
_camera camSetRelPos [0,0,2];
_camera camCommit 8;
 
cutText [_welcomeMessage, "PLAIN DOWN"];
 
waitUntil {camCommitted _camera};
 
_camera cameraEffect ["terminate","back"];
camDestroy _camera;
You can modify the _camDistance and _welcomeMessage all you want (This camera flies from above the player down towards his/her position making quite a nice effect)

Save this file.

Now, modify the init.sqf:
Near the top of the file, enter the line: 'dayzLoginRecord = nil;'
Code:
/*   
    INITILIZATION
*/
startLoadingScreen ["","RscDisplayLoadCustom"];
cutText ["","BLACK OUT"];
enableSaving [false, false];
 
//REALLY IMPORTANT VALUES
dayZ_instance = 1;                    //The instance
dayzHiveRequest = [];
initialized = false;
dayz_previousID = 0;
dayzLoginRecord = nil; //New line is here!
 
~~~ Rest of file ~~~
Then at the bottom of the file enter the line: '_nul = [] execVM "camera\loginCamera.sqf";'
Code:
if (!isDedicated) then {
    //Conduct map operations
    0 fadeSound 0;
    waitUntil {!isNil "dayz_loadScreenMsg"};
    dayz_loadScreenMsg = (localize "STR_AUTHENTICATING");
 
    //Run the player monitor
    _id = player addEventHandler ["Respawn", {_id = [] spawn player_death; _nul = [] execVM "camera_init.sqf";}];
    _playerMonitor =    [] execVM "\z\addons\dayz_code\system\player_monitor.sqf";
    _nul = [] execVM "camera\loginCamera.sqf";
};
This works for me, i hope it works for you!

p.s.
The problem was always due to the 'dayzRecordLogin' variable, this seemed to never be reset to nil after the mission was unloaded. - Forcing it to nil allows the camera (and other things that rely on it) to correctly execute when the player has logged in.
 
Hello all,

I saw this and instantly wanted it - however it was bad to see that it didnt work upon next login until the server is rebooted.

However, i have fixed this now, and also i have made some small changes to the script.

This is how its setup on my mission:

1) create a folder called Camera inside your mission folder
2) create a file called loginCamera.sqf and paste the following code into it:
Code:
private [ "_camera", "_welcomeMessage", "_camDistance" ];
_welcomeMessage = format["Welcome to AlienX's UK130 Server %1, Enjoy your stay!",format["%1", name player]];
_camDistance = 60;
 
waitUntil {!isNil ("dayzLoginRecord")};
 
//intro move
showCinemaBorder true;
camUseNVG false;
 
_camera = "camera" camCreate [(position player select 0)-2, position player select 1,(position player select 2)+_camDistance];
_camera cameraEffect ["internal","back"];
 
_camera camSetFOV 2.000;
_camera camCommit 0;
waitUntil {camCommitted _camera};
 
_camera camSetTarget vehicle player;
_camera camSetRelPos [0,0,2];
_camera camCommit 8;
 
cutText [_welcomeMessage, "PLAIN DOWN"];
 
waitUntil {camCommitted _camera};
 
_camera cameraEffect ["terminate","back"];
camDestroy _camera;
You can modify the _camDistance and _welcomeMessage all you want (This camera flies from above the player down towards his/her position making quite a nice effect)

Save this file.

Now, modify the init.sqf:
Near the top of the file, enter the line: 'dayzLoginRecord = nil;'
Code:
/* 
    INITILIZATION
*/
startLoadingScreen ["","RscDisplayLoadCustom"];
cutText ["","BLACK OUT"];
enableSaving [false, false];
 
//REALLY IMPORTANT VALUES
dayZ_instance = 1;                    //The instance
dayzHiveRequest = [];
initialized = false;
dayz_previousID = 0;
dayzLoginRecord = nil; //New line is here!
 
~~~ Rest of file ~~~
Then at the bottom of the file enter the line: '_nul = [] execVM "camera\loginCamera.sqf";'
Code:
if (!isDedicated) then {
    //Conduct map operations
    0 fadeSound 0;
    waitUntil {!isNil "dayz_loadScreenMsg"};
    dayz_loadScreenMsg = (localize "STR_AUTHENTICATING");
 
    //Run the player monitor
    _id = player addEventHandler ["Respawn", {_id = [] spawn player_death; _nul = [] execVM "camera_init.sqf";}];
    _playerMonitor =    [] execVM "\z\addons\dayz_code\system\player_monitor.sqf";
    _nul = [] execVM "camera\loginCamera.sqf";
};
This works for me, i hope it works for you!

p.s.
The problem was always due to the 'dayzRecordLogin' variable, this seemed to never be reset to nil after the mission was unloaded. - Forcing it to nil allows the camera (and other things that rely on it) to correctly execute when the player has logged in.
It worked for me, thanks man!
 
Top