OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: ZapBrannigan on 15 Dec 2007, 21:38:02

Title: 1st person
Post by: ZapBrannigan on 15 Dec 2007, 21:38:02
hey,
I need to find a way to lock the player in the 1st person so that he cant switch to 3rd person.

thanks
Title: Re: 1st person
Post by: Spooner on 15 Dec 2007, 21:45:30
3rd person is an "easymode" thing that can be switched on by the player, so I'm not sure it is appropriate to turn it off (the player, if at all serious, will not have it enabled...if not serious, then he probably really does want to see around corners and get all the benefits from this, even if you don't want to give him this ability).

Anyway, should you wish to override the player's preferences, you could make a null action that used the 3rd person key:
Code: [Select]
player addAction ["", "", nil, 0, false, true, "tacticalView"];

(I think "tacticalView" is the correct key name, but, if not, a list of action-keys (http://community.bistudio.com/wiki/ArmA:_CfgDefaultKeysMapping) is at the BIKI)
Title: Re: 1st person
Post by: Wolfrug on 15 Dec 2007, 22:08:02
Also, a slightly sneakier way (not foolproof, but practically) is to use the switchCamera (http://www.ofpec.com/COMREF/index.php?action=list&game=All&letter=s#361) command to force the player to return to 1st person view all the time. There are two ways you can do that, the easy "hack" way and the more complicated way:

The hack way is simple:

Code: [Select]
while {alive Player} do
{
Player switchCamera "gunner";
sleep 0.1
};

That will switch the player's camera to "gunner" once every 0.1 seconds : this WILL screw with other things though (for instance inside vehicles where "gunner" view can be a more zoomed-in view), and might not be the best solution.

The more complicated way is to read through this thread (http://www.ofpec.com/forum/index.php?topic=30525.0) carefully, and to figure out how to find out when the player is changing the camera, and then resetting it to "gunner" or "internal" whenever that happens. Potential (untested) code:

Code: [Select]
while {alive Player} do
{
_wpos = positionCameraToWorld [0,0,0];
waitUntil {_wpos distance (vehicle Player) > 3};
Player switchCamera "Internal";
hint "3rd person camera is disabled!";
sleep 0.2;
};

As I said, haven't tried, but might work. ;D

Wolfrug out.
Title: Re: 1st person
Post by: Mandoble on 18 Dec 2007, 00:00:22
Or

Code: [Select]
// Check_for_cheater.sqf
// Run it in init.sqf or init.sqs
// When a cutscene is going to start set incutscene = true and after the cutscene switch back to false

while {true} do
{
   if (alive player) then
   {
      if ((vehicle player distance positionCameraToWorld [0,0,0]) > 3) && (!incutscene)) then
      {
         cutText["YOU CHEATER GO BACK TO FIRST PERSON VIEW!", "BLACK OUT"];
         waitUntil {(vehicle player distance positionCameraToWorld [0,0,0]) < 3};
         cutText["AND DONT TRY THAT AGAIN!", "BLACK IN"];
      };
   };
   Sleep 1;
};

BTW, I dont think the action-key overwrite will have any effect.
Title: Re: 1st person
Post by: ZapBrannigan on 20 Dec 2007, 06:29:10
Ahh, great
I will have to see how they work.

thanks guys :)