Jump to content
Sign in to follow this  
mikey74

Auto Aiming

Recommended Posts

I've got a script I'm working on based a tad bit on dead eye in Red Dead 2. This is not for realism by the way! 😄 I was wondering if there is a way to set players aim more accurately. Like a random head, torso, arms, legs. But so far I've not found a way to set players aim very accurately. It only does it when you zoom. To me zoom in Arma is unrealistic anyways. lol Why not give an edge up. Click the spoiler to see the script.

 

Spoiler

mh_standerd_view = getObjectFOV player;
While {alive player} do {

	waitUntil {(getObjectFOV player) < mh_standerd_view};
	hint format ["Standerd View) %1\n Actual view) %2\n Target %3\n distance) %4",mh_standerd_view, (getObjectFOV player), cursorTarget, (player distance cursorTarget)];
	//player camSetFov 0.75; sleep 20;
	waitUntil {(getObjectFOV player) >= mh_standerd_view || (((vehicle cursorTarget) isKindOf "AllVehicles") && (alive (vehicle cursorTarget)))};
	_Target = if ((vehicle cursorTarget) isKindOf "AllVehicles") then {(vehicle cursorTarget)} else {player};
	if ((getObjectFOV player) < mh_standerd_view) then {
		_Cpos = getPos cursorTarget;
		_pos = [(_Cpos select 0),(_Cpos select 1),0.1];
		if (str _Cpos =="[0,0,0]") then {} else {
			_dis_mult = switch (true) do {
				case ((player distance cursorTarget) < 35): {0.5};
				case ((player distance cursorTarget) > 35 && (player distance cursorTarget) < 50): {0.4};
				case ((player distance cursorTarget) > 50 && (player distance cursorTarget) < 65): {0.3};
				case ((player distance cursorTarget) > 65 && (player distance cursorTarget) < 80): {0.2};
				case ((player distance cursorTarget) > 100): {0.05};
			};
			_timer = time + .35;
			while {_timer > time} do
			{
				Player setDir ((player getDir _pos)- _dis_mult);//(player getDir _pos);//((player getDir _pos)-0.5);//
      
				hint format ["Standerd View) %1 Actual view) %2 distance %3", mh_standerd_view, (getObjectFOV player), (player distance cursorTarget)];
			}
		};


	};
	_sleep = switch (true) do {
		case ((player distance cursorTarget) < 35): {0.25};
		case ((player distance cursorTarget) > 35 && (player distance cursorTarget) < 50): {0.5};
		case ((player distance cursorTarget) > 50 && (player distance cursorTarget) < 65): {1};
		case ((player distance cursorTarget) > 65 && (player distance cursorTarget) < 80): {2};
		case ((player distance cursorTarget) > 100): {3};
	};
	//sleep _sleep;
	if (speed _target > 0 && _target != player) then {
		waitUntil {(getObjectFOV player) >= mh_standerd_view || !(alive (vehicle cursorTarget))};// || ((vehicle cursorTarget)) != _Target}
		sleep _sleep + (speed _target);// + 2;
	} else {
		waitUntil {(getObjectFOV player) >= mh_standerd_view || (str (vehicle cursorTarget)) == "<NULL-object>" || !(alive (vehicle cursorTarget)) || ((vehicle cursorTarget)) != _Target};
		sleep _sleep;
	};
}

 

 

Thanks in advanced. 

  • Like 2

Share this post


Link to post
Share on other sites

Thanks KillZone_Kid,

 

I tried that one. When I displayed a hint while zoomed or not it always said internal view. BTW there is no way to script in a lock on FOV is there?

 

Thanks again KZ You're probably the best coder and I've learned a lot from your site and you throughout the years in the OFP/Arma verse. I grovel at your feet. lol seriously kid your a hero. 😉

Share this post


Link to post
Share on other sites

It should display "GUNNER" perhaps you were reading it too early.
 

AFAIK you can not control where player aims with script unless you can hack mouse input via extension. 

  • Like 1

Share this post


Link to post
Share on other sites

Yeh I have it set in a while loop with a few waitUntils. It did flash gunner view once or twice this last test.

 

Kind of figured there wasn't an easy way to control a players aim by script. lol

 

Thanks what I have works. Just need to polish it a bit. 

 

Thanks again. 🙂

Share this post


Link to post
Share on other sites

did you make more progress by now?

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  

×