Jump to content
Sign in to follow this  
Graz

Iskindof, Force 1st Person in mission file

Recommended Posts

I've got a script to force first person if you are in a helicopter.

The trouble is Helicopters spawn throughout the mission and AI helicopter can be stolen by players.

I'm unsure how to run this script effectively, it's in the dircetory .pbo/scripts/force_firstperson.sqf

Two questions

1. How can I get this script to run on all players constantly throughout the mission

2. Will it repeat (Ie the get in a helicopter and get out, will the script run when they get in another helicopter??)

//force first_person.sqf

while {vehicle player isKindOf "Helicopter} do {

if(cameraView == "EXTERNAL" || cameraView == "GROUP") then {

vehicle player switchCamera "INTERNAL";

};

sleep 0.1;

};

This script was found here (Thanks Bon) : http://forums.bistudio.com/showthread.php?115454-force-1st-person&highlight=force+1st+person

Edited by Graz

Share this post


Link to post
Share on other sites

this might work

while {true} do {

if((cameraView == "EXTERNAL" || cameraView == "GROUP") && (vehicle player isKindOf "Helicopter)) then {
vehicle player switchCamera "INTERNAL";
};

sleep 0.1;
};

put this in the unit init

_nvm = [] execVM "scripts/force_firstperson.sqf";

Edited by Lifted86

Share this post


Link to post
Share on other sites

There, I fixed a small typo :p

while {true} do {

if((cameraView == "EXTERNAL" || cameraView == "GROUP") && (vehicle player isKindOf "Helicopter")) then {
vehicle player switchCamera "INTERNAL";
};

sleep 0.1;
};

Share this post


Link to post
Share on other sites

Awesome, unfortunately putting it in the vehicle init line doesn't seem to be an option as there is vehicle's spawned mid mission. I'm uncomfortable cracking open someone elses mod to place init lines either.

The code is awesome, is there anywhere else I can use it apart from the vehicle init?

Share this post


Link to post
Share on other sites

You shouldn't put it in the vehicle init. Put it in the init.sqf

if (!isDedicated) then 
{
0 spawn 
{
	while {true} do 
	{
		if((cameraView == "EXTERNAL" || cameraView == "GROUP") && (vehicle player isKindOf "Helicopter")) then 
		{
			vehicle player switchCamera "INTERNAL";
		};
	sleep 0.1;
	};
};
};

Share this post


Link to post
Share on other sites

works perfectly.

Thanks again Cuel

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  

×