Jump to content
driftingnitro

Player as Camera Script

Recommended Posts

I've been trying to find a way to implement Splendid Camera as a player slot. Since I don't want people to have the config menu available for all players during a mission, I'm trying to find a method to limit these options to a 'camera man' type unit that just spawns and then uses this(these) camera(s).

I would like to implement it as an action similar to this:

player addAction ["Camera", "camera.sqs"];

I know that BIS_fnc_camera is what i need to access but I'm not really sure how. Do I need to make an SQF file of my own and reference the BIS_fnc_camera?

I tried this and it just makes the game time freeze:

player addAction ["Camera", [] execVM "a3\functions_f\Debug\fn_camera.sqf"]

Edited by DriftingNitro

Share this post


Link to post
Share on other sites

Try:

player addAction ["Camera", "[] call BIS_fnc_camera"]

The reason for my change is that fn_camera.sqf is a script that's going to be compiled by RV and added to the function library.

Most likely the reason it crashed, though, is because addAction uses either a string or code ( { } ) for it's second parameter. When that statement was compiled it probably saw this, "a3\functions_f\Debug\fn_camera.sqf", and said "This is weird and I don't like it".

Edited by DreadedEntity
spelling error

Share this post


Link to post
Share on other sites

Thanks a bunch it worked perfect! I only have one issue remaining. I wanted to have the unit invincible but unable to use weapons. I tried to do this by making a loop that keeps removing weapons every 3 seconds. However it doesn't even initially remove them. I took this from a script for forcing AI vehicle lights on as an example for the loop.

null=[] spawn { while {true} do { removeallweapons this; sleep 3};};
this allowDamage false; 
player addAction ["Recorder", "camera.sqs"];
player addAction ["Camera", "[] call BIS_fnc_camera"]

Share this post


Link to post
Share on other sites

It didn't work because spawn is like a function or a script, you need to give it the information before you can use it inside:

0 = this spawn { while {true} do { removeallweapons _this; sleep 3};}; //any parameters go to the script using the magic variable _this

Also, don't use "null" for a variable, because although it is a reserved word in other languages, becoming a dumping ground, in this one it's not. It is a valid variable name and can be defined/redefined with no problem. However, you certainly are allowed to use a number, which cannot be redefined, thus having no adverse effects.

Hope that helps

Share this post


Link to post
Share on other sites

This works great, but unfortunately not working for multiplayer missions. Lets say i was to name the unit "CameraMan". Now would i need to reference the unit in the init.sqf? or maybe another .sqf file?

0 = this spawn { while {true} do { removeallweapons _this; sleep 3};}; 
this allowDamage false; 
player addAction ["Recorder", "camera.sqs"]; 
player addAction ["Camera", "[] call BIS_fnc_camera"]

Now how would I implement this into a multiplayer mission.

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

×