Jump to content
Sign in to follow this  
Somoo

Camera defined but script returning camera undefined

Recommended Posts

I have no idea why this is returning undefined when the local variable is defined in the beginning...  Also can I execute this script with [] execVM ''movie.sqf' and then change all the comment lines to "//"?  I used to use C++ a long time ago...

 

Script is named movie.sqf and is called by a player object in the intro mission, in its initialization [] exec 'movie.sqf'

 

comment creating the camera
_camera = "camera" camCreate [0,0,0];
_camera = cameraEffect ["Internal","back"];

comment First Town shot 1
comment "7:59:56"
_camera camPrepareTarget [79725.52,69842.55,-53003.29];
_camera camPreparePos [17094.00,12853.57,196.39];
_camera camPrepareFOV 0.700;
_camera camCommitPrepared 0;

 

comment Testing text to show with camera shot.  2 is the layerName

2 cutText ["hello", "BLACK IN", 5];

comment First Town shot 2
comment "8:00:26"
waituntil [CamCommitted _camera];
_camera camPrepareTarget [-40110.32,74663.16,-53153.27];
_camera camPreparePos [17656.16,12923.88,187.99];
_camera camPrepareFOV 0.700;
_camera camCommitPrepared 5;

comment Second Town shot 1
comment "8:10:01"
waituntil [CamCommitted _camera];
_camera camPrepareTarget [-16932.93,93873.49,-51854.81];
_camera camPreparePos [16901.25,15391.02,50.24];
_camera camPrepareFOV 0.700;
_camera camCommitPrepared 5;

comment Second Town shot 2
comment "8:11:36"
waituntil [CamCommitted _camera];
_camera camPrepareTarget [-59899.50,-21901.39,-51860.80];
_camera camPreparePos [16975.53,15526.53,85.56];
_camera camPrepareFOV 0.700;
_camera camCommitPrepared 5;

comment Airfield Shot 1
comment "8:34:11"
waituntil [CamCommitted _camera];
_camera camPrepareTarget [-52177.98,-51170.37,-27093.76];
_camera camPreparePos [15596.15,17275.54,198.93];
_camera camPrepareFOV 0.700;
_camera camCommitPrepared 5;

comment Airfield Shot 2
comment "8:35:32"
waituntil [CamCommitted _camera];
_camera camPrepareTarget [76018.16,-56610.74,-27241.64];
_camera camPreparePos [14231.29,17067.23,203.10];
_camera camPrepareFOV 0.700;
_camera camCommitPrepared 5;

comment Third Town Shot 1
comment "8:41:07"
waituntil [CamCommitted _camera];
_camera camPrepareTarget [26101.99,-66991.84,-53729.01];
_camera camPreparePos [12251.52,16027.06,230.16];
_camera camPrepareFOV 0.700;
_camera camCommitPrepared 5;

comment Third Town Shot 2
comment "8:59:52"
waituntil [CamCommitted _camera];
_camera camPrepareTarget [36499.64,103810.88,-38133.16];
_camera camPreparePos [12204.57,15132.74,243.54];
_camera camPrepareFOV 0.700;
_camera camCommitPrepared 5;

comment Fourth Town Shot 1
comment "9:00:23"
waituntil [CamCommitted _camera];
_camera camPrepareTarget [55905.19,-66228.55,-38304.55];
_camera camPreparePos [12240.17,15006.19,245.78];
_camera camPrepareFOV 0.700;
_camera camCommitPrepared 5;

comment Fourth Town Shot 2
comment "9:00:56"
waituntil [CamCommitted _camera];
_camera camPrepareTarget [71533.55,-55741.11,-38345.58];
_camera camPreparePos [12108.46,14806.93,241.51];
_camera camPrepareFOV 0.700;
_camera camCommitPrepared 5;

comment Fifth Town Shot 1
comment "9:02:07"
waituntil [CamCommitted _camera];
_camera camPrepareTarget [16127.70,-81817.60,-33060.99];
_camera camPreparePos [9110.91,12273.77,101.28];
_camera camPrepareFOV 0.700;
_camera camCommitPrepared 5;

comment Fifth Town Shot 2
comment "9:02:47"
waituntil [CamCommitted _camera];
_camera camPrepareTarget [49571.91,-72867.36,-33049.85];
_camera camPreparePos [8859.06,12267.63,82.21];
_camera camPrepareFOV 0.700;
_camera camCommitPrepared 5;

comment Sixth Town shot 1
comment "9:04:13"
waituntil [CamCommitted _camera];
_camera camPrepareTarget [-58452.14,-36891.79,-59774.79];
_camera camPreparePos [5311.72,11389.89,152.61];
_camera camPrepareFOV 0.700;
_camera camCommitPrepared 5;

comment Sixth Town shot 2
comment "9:05:01"
waituntil [CamCommitted _camera];
_camera camPrepareTarget [-37900.85,-55846.24,-59761.53];
_camera camPreparePos [5191.67,11540.25,179.88];
_camera camPrepareFOV 0.700;
_camera camCommitPrepared 5;

comment Seventh (last) Town shot 1
comment "9:06:27"
waituntil [CamCommitted _camera];
_camera camPrepareTarget [-65054.63,75459.00,-34828.32];
_camera camPreparePos [4149.58,12516.21,299.00];
_camera camPrepareFOV 0.700;
_camera camCommitPrepared 5;

comment Seventh (last) Town shot 2
comment "9:07:02"
waituntil [CamCommitted _camera];
_camera camPrepareTarget [-83915.73,44417.55,-34880.71];
_camera camPreparePos [4097.28,12894.55,233.94];
_camera camPrepareFOV 0.700;
_camera camCommitPrepared 5;

camDestroy _camera;

 

 

Thank you!

Share this post


Link to post
Share on other sites

In SQF you still need the trailing ; at the end of each command.  So yes, change all of your comment lines to one of the following:

// Seventh (last) Town shot 2
// comment "9:07:02"
/*
Seventh (last) Town shot 2
"9:07:02"
*/
comment Seventh (last) Town shot 2;
comment "9:07:02";

Your waitUntil is wrong too.

waituntil {CamCommitted _camera};

Share this post


Link to post
Share on other sites

thank you, trying this now!

Share this post


Link to post
Share on other sites

Put this  ...   [] execVM 'movie.sqf'     ..  in the initialization field and error window popped up "Init;Type Script, Expected Nothing"

 

https://community.bistudio.com/wiki/execVM

 

Wiki page says the syntax is "ececVM filename" so not sure what is giving the error.

 

Also thank you for mention comment in SQF without the VM/compiling is considered a command.  Did not know that.

Share this post


Link to post
Share on other sites

You'd probably want to call that from the initPlayerLocal.sqf instead.

 

So create a new script file called initPlayerLocal.sqf and put this in it;

[] execVM "movie.sqf";

Or if you wanted to run it from the init field you'll need to capture the script handle it's returning, so change your init field to this:

0 = [] execVM "movie.sqf"; 

You could just use the 0 = in both places for consistency sake too. :)  Or something like _handle = [] execVM "movie.sqf"; in the script.

Share this post


Link to post
Share on other sites

You'd probably want to call that from the initPlayerLocal.sqf instead.

 

So create a new script file called initPlayerLocal.sqf and put this in it;

[] execVM "movie.sqf";

Or if you wanted to run it from the init field you'll need to capture the script handle it's returning, so change your init field to this:

0 = [] execVM "movie.sqf"; 

You could just use the 0 = in both places for consistency sake too. :)  Or something like _handle = [] execVM "movie.sqf"; in the script.

 

thank you again!

Share this post


Link to post
Share on other sites

I think the script is starting with no errors, but the view doesn't change from the objects its initializing from.  Do I need to put in a game logic or pass information from the [] so that the view changes to the camera?.  Do I need to add something similar to 0 = [Global_variable] execVM 'movie.sqf'?  I have it set to run during the intro part of the mission, is that effecting it?  I also added a initPlayerLocal.sqf in the mission folder and put in that script [] execVM ' movie.sqf';

 

Also should I be using initPlayerServer.sqf instead if I plan to make it co-op mission or is the local version fine?

 

https://community.bistudio.com/wiki/Event_Scripts

 

https://community.bistudio.com/wiki/Initialization_Order

 

Edit, I made a error in the script to be sure it was, it is as the test error came up.

 

Awesome Arma Community.

http://foxhound.international/arma-3-sqf-cheat-sheet.html

 

for newbie scriptors like me.

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  

×