Jump to content

Recommended Posts

Just paste this in notepad name it anything you want .sqf and call it in your init.sqf.  Easy as pie.  Also, easily edited to suit more or less restrictions.

if (!isDedicated) then { //preventing start on server

	waitUntil {!isNull (findDisplay 46)}; //making sure player is spawned

	if (difficultyEnabled "3rdPersonView") then
	{
		while {true} do {

			waitUntil {cameraView == "EXTERNAL" || cameraView == "GROUP"};

			if  (((vehicle player) == player) && (dayz_combat == 1)) then {
				player switchCamera "INTERNAL";
			};
			sleep 0.1;

			if (((vehicle player) != player) && (speed (vehicle player)) >= 30) then {
				(vehicle player) switchCamera "Internal";
			};
			sleep 0.1;
		};
	};

};

So with the current settings Players are forced into first person view if the following conditions are met:

1.) Player is NOT in a vehicle AND is in combat.

2.) Player IS in a vehicle AND said vehicle is moving faster than 30 km/h.

 

This currently does not conflict with parking and maneuvering in tight spaces or the building script in third person view.

 

Original code can be found here: http://forums.bistud...les-helicopters

 

Modified version credit goes to: Halvhjearne

I just get credit for testing and posting it.  :D

Link to comment
Share on other sites

you should rather use the code i posted ...

 

your code checks same thing twice and for unneeded stuff where it can be done simpler ... also it has a wierd dubble sleep inbetween the if statements wich can create some wierd experiences in some cases.

 

besides that, this can be quite easy changed to only activate on certain vehicle types or perhaps only change for drivers.

Link to comment
Share on other sites

you should rather use the code i posted ...

 

your code checks same thing twice and for unneeded stuff where it can be done simpler ... also it has a wierd dubble sleep inbetween the if statements wich can create some wierd experiences in some cases.

 

besides that, this can be quite easy changed to only activate on certain vehicle types or perhaps only change for drivers.

 

I separated the two so that when your combat timer goes off in a vehicle it won't put you in first person.  It can be extremely difficult to spot a shooter when you are in a vehicle in first person.  This allows you to slow down and switch to 3rd person if you need too.  It also means if you wreck or hit something with your vehicle you won't be forced into 3rd person unless you exit the vehicle.  Makes it easier to tell if you are stuck on a rock/fence/etc... You are probably right about the redundant sleep command though. **Edit** I've been testing this with a friend for hours now...  I haven't found anything to indicate that it is unstable in any way.  It seems to work exactly as intended every time. If I notice any problems though, I'll let you guys know.

Link to comment
Share on other sites

tbh I get the idea, but it's not for me/my server. Every zombie hit would force somebody in 1st person. The switching would cause too much whining from players :( I'll just play 1st person myself and die alot.

It is definitely for those looking for more survival/realism in their servers.  Not for everyone. I'm going to be running 3 servers in the future, and I only plan on using this on one of them.  For the very reasons you have stated.  If it helps though, it doesn't constantly ping pong you back and forth between 1st and 3rd person.  If you are in third person when your combat timer goes off, you are forced into first person until the combat timer stops.  However, once it does it doesn't go back to 3rd person on it's own.  You have to manually go back to third person once the danger has passed. I suppose you could modify the script so that once the combat timer stops it automatically puts you in third person again, but this would force everyone into 3rd person whenever their combat timer is not going off.

Link to comment
Share on other sites

  • 2 weeks later...

You could setup two variables.  One that checks for the combat timer and one that stores the result fo the last check.  If the last check = true but the current check = false then the timer has switched off and you could perhaps give a screen prompt that 3rd preson view is available again.

 

1st person only in combat and frivig at not slow speeds sounds interesting.  Suits my play style more but I would imagine a lot of the CoD crowd would not be happy.  Imagine all of Frankies videos if 1st person was the only choice :o.  Oh the horror :D .

 

RB

Link to comment
Share on other sites

  • 3 months later...

Ok, so here it is:

Private ["_countCPC"];
if (!isDedicated) then { //preventing start on server

	waitUntil {!isNull (findDisplay 46)}; //making sure player is spawned

	if (difficultyEnabled "3rdPersonView") then
	{
		while {true} do {

			waitUntil {cameraView == "EXTERNAL" || cameraView == "GROUP"};
			// Objects in array to force first person if player is near them.
                        _countCPC = count nearestObjects [player, ["Plastic_Pole_EP1_DZ","CinderWallDoorSmallLocked_DZ","Land_DZE_WoodDoorLocked","CinderWallDoorLocked_DZ","Land_DZE_GarageWoodDoorLocked","WoodFloorHalf_DZ","WoodFloor_DZ","WoodFloorQuarter_DZ","MetalFloor_DZ"], 50];
			
			// If player is not in a vehicle and is in combat, player forced into first person.
			if  (((vehicle player) == player) && (dayz_combat == 1)) then {
				player switchCamera "INTERNAL";
			};
			
			// If player is in a vehicle and near objects within _countCPC, player forced into third person.
			if (((vehicle player) != player) && (_countCPC > 0)) then {
				(vehicle player) switchCamera "EXTERNAL";
			}; 
			
			// If player is not in a vehicle and is near objects within _countCPC, player forced into first person.
			if (((vehicle player) == player) && (_countCPC > 0)) then {
			player switchCamera "INTERNAL";
			};
			
			// Allow third person while building. In current state can be exploited to use third person while no intention to build, not recommended.
			/*
			if (((vehicle player) == player) && (DZE_ActionInProgress)) then {
			player switchCamera "EXTERNAL";
			};
			*/
			
			sleep 0.1;
		};
	};
};

Works.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Discord

×
×
  • Create New...