C][G GhostTown™

Help with 1st person script!

18 posts in this topic

So I have a 1st person only script during combat 

Spoiler

ZEForceFirstPerson = {
	while {true} do {
		if (ExileClientPlayerIsInCombat) then {
			if (cameraView == "External") then {
				player switchCamera "Internal"; 
				hint "Your camera can't be third-person while in combat.";
			};
		};
	};
};

 

 

But how could I have this set to check if in a vehicle if in a vehicle it wont force switch the camera?

Share this post


Link to post
Share on other sites

Posted (edited)

7 minutes ago, C][G GhostTown™ said:

So I have a 1st person only script during combat 

  Hide contents


ZEForceFirstPerson = {
	while {true} do {
		if (ExileClientPlayerIsInCombat) then {
			if (cameraView == "External") then {
				player switchCamera "Internal"; 
				hint "Your camera can't be third-person while in combat.";
			};
		};
	};
};

 

 

But how could I have this set to check if in a vehicle if in a vehicle it wont force switch the camera?

You could probably adapt this script that checks if you have a weapon in your hand, or if you are the passenger in a vehicle and locks you to 1PP.

Spoiler

private ["_hintcounterweapon", "_hintcounterpilot"];
    
_hintcounterweapon = 0;
_hintcounterpilot = 0;

if (difficultyEnabled "3rdPersonView") then
{
    while {TRUE} do 
    {
        waitUntil {cameraView == "EXTERNAL" || cameraView == "GROUP"};
        if (((vehicle player) == player) && (currentWeapon player != '')) then
        {
            player switchCamera "INTERNAL";
            if (_hintcounterweapon < 2) then
            {
                hint "Holster your weapon to use 3rd person view";
                _hintcounterweapon = _hintcounterweapon + 1;
            };
        }
        else
        {
            if (player != driver (vehicle player)) then 
            {
                player switchCamera "INTERNAL";
                if (_hintcounterpilot < 2) then
                {
                    hint "Only drivers and pilots can use 3rd person view";
                    _hintcounterpilot = _hintcounterpilot + 1;
                };
            };
        };
        sleep 0.1;
    };
};

 

Edited by speedweasel

Share this post


Link to post
Share on other sites
Advertisement
15 minutes ago, speedweasel said:

You could probably adapt this script that checks if you have a weapon in your hand, or if you are the passenger in a vehicle and locks you to 1PP.

  Hide contents

private ["_hintcounterweapon", "_hintcounterpilot"];
    
_hintcounterweapon = 0;
_hintcounterpilot = 0;

if (difficultyEnabled "3rdPersonView") then
{
    while {TRUE} do 
    {
        waitUntil {cameraView == "EXTERNAL" || cameraView == "GROUP"};
        if (((vehicle player) == player) && (currentWeapon player != '')) then
        {
            player switchCamera "INTERNAL";
            if (_hintcounterweapon < 2) then
            {
                hint "Holster your weapon to use 3rd person view";
                _hintcounterweapon = _hintcounterweapon + 1;
            };
        }
        else
        {
            if (player != driver (vehicle player)) then 
            {
                player switchCamera "INTERNAL";
                if (_hintcounterpilot < 2) then
                {
                    hint "Only drivers and pilots can use 3rd person view";
                    _hintcounterpilot = _hintcounterpilot + 1;
                };
            };
        };
        sleep 0.1;
    };
};

 

I am new to scripting but would this work, not sure if I added my code correctly.

Spoiler

private ["_hintcounterweapon", "_hintcounterpilot"];
    
_hintcounterweapon = 0;
_hintcounterpilot = 0;

if (difficultyEnabled "3rdPersonView") then
{
    while {TRUE} do 
    {
        waitUntil {cameraView == "EXTERNAL" || cameraView == "GROUP"};
        if (((vehicle player) == player) && (currentWeapon player != '')) then
        {
            player switchCamera "INTERNAL";
            if (_hintcounterweapon < 2) then
            {
                hint "Holster your weapon to use 3rd person view";
                _hintcounterweapon = _hintcounterweapon + 1;
            };
        }
        else
        {
        if (ExileClientPlayerIsInCombat) then {
            if (cameraView == "External") then {
                player switchCamera "Internal"; 
                hint "Your camera can't be third-person while in combat.";
            };
        {
        else
        {
            if (player != driver (vehicle player)) then 
            {
                player switchCamera "INTERNAL";
                if (_hintcounterpilot < 2) then
                {
                    hint "Only drivers and pilots can use 3rd person view";
                    _hintcounterpilot = _hintcounterpilot + 1;
                };
            };
        };
        sleep 0.1;
    };
};

 

Share this post


Link to post
Share on other sites
4 minutes ago, C][G GhostTown™ said:

I am new to scripting but would this work, not sure if I added my code correctly.

  Reveal hidden contents

private ["_hintcounterweapon", "_hintcounterpilot"];
    
_hintcounterweapon = 0;
_hintcounterpilot = 0;

if (difficultyEnabled "3rdPersonView") then
{
    while {TRUE} do 
    {
        waitUntil {cameraView == "EXTERNAL" || cameraView == "GROUP"};
        if (((vehicle player) == player) && (currentWeapon player != '')) then
        {
            player switchCamera "INTERNAL";
            if (_hintcounterweapon < 2) then
            {
                hint "Holster your weapon to use 3rd person view";
                _hintcounterweapon = _hintcounterweapon + 1;
            };
        }
        else
        {
        if (ExileClientPlayerIsInCombat) then {
            if (cameraView == "External") then {
                player switchCamera "Internal"; 
                hint "Your camera can't be third-person while in combat.";
            };
        {
        else
        {
            if (player != driver (vehicle player)) then 
            {
                player switchCamera "INTERNAL";
                if (_hintcounterpilot < 2) then
                {
                    hint "Only drivers and pilots can use 3rd person view";
                    _hintcounterpilot = _hintcounterpilot + 1;
                };
            };
        };
        sleep 0.1;
    };
};

 

But my combat part would still force you in 1st if your the driver tho? so it counters what I was trying to do lol

Share this post


Link to post
Share on other sites
if (ExileClientPlayerIsInCombat) then {
            if (cameraView == "External") then {
                player switchCamera "Internal"; 
                hint "Your camera can't be third-person while in combat.";
            };
        {
        else

That last brace is back to front, but otherwise it looks good to me.  You should be able to test this in the editor by calling it from initPlayerLocal.sqf in your mission folder.

Share this post


Link to post
Share on other sites
36 minutes ago, C][G GhostTown™ said:

 

Do you want only the driver to be forced with 1st person or all in the vehicle? 

Share this post


Link to post
Share on other sites

I want to force people in 1st person when in combat BUT not when inside a vehicle. 

Now I like the merge of his script and I like the idea of forcing everyone else in 1st except the driver/pilot.

Share this post


Link to post
Share on other sites
51 minutes ago, ka0s said:

Do you want only the driver to be forced with 1st person or all in the vehicle? 

only the passengers.

I don't want to the driver/pilot to be in 1st. 

We want to do some testing with our players this way to see how they like it

Share this post


Link to post
Share on other sites

Posted (edited)

57 minutes ago, C][G GhostTown™ said:

I want to force people in 1st person when in combat BUT not when inside a vehicle. 

Now I like the merge of his script and I like the idea of forcing everyone else in 1st except the driver/pilot.

I think my script works because:

1. 3PP firefights are cheaty and break the major game mechanic.

2. Players can still control the camera by choosing to holster or unholster their weapon with the penalty of being 'unarmed' while using 3PP.  i.e. the game never snatches a camera view from the player due to circumstances outside their control (like being fired on.)

3. Preventing passengers from using 3PP stops every passenger in a vehicle acting as a super-commander that can see in all directions.

I pretty much agree with everything Dslyecxi says here:  

 

 

Edited by speedweasel
Oops
1 person likes this

Share this post


Link to post
Share on other sites
18 minutes ago, speedweasel said:

I think my script works because:

1. 3PP firefights are cheaty and break the major game mechanic.

2. Players can still control the camera by choosing to holster or unholster their weapon with the penalty of being 'unarmed' while using 3PP.  i.e. the game never snatches a camera view from the player due to circumstances outside their control (like being fired on.)

3. Preventing passengers from using 3PP stops every passenger in a vehicle acting as a super-commander that can see in all directions.

I pretty much agree with everything Dslyecxi says here:  

 

 

Agh now that you said it like that it makes more sense and I like that idea!

Will do some testing with this later! :)

 

Thank you for your help! I appreciate it.

Share this post


Link to post
Share on other sites
Advertisement

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

  • Recently Browsing   0 members

    No registered users viewing this page.