OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: Luke on 13 Aug 2008, 02:08:41
-
I've done it before but now they don't cooperate...
I cannot seem to get static guns to aim at an invisible H if it is any further than 4000 1200 m.
Luke
-
I don't think the viewdistance would effect it, what command are you using?
Something like
gun doWatch getMarkerPos "invisH"or you could use a gamelogic for him to look at.
You could use a different approach. Setpos an enemy unit underground then
unit1 reveal unit2;unit1 dotarget unit2
-
I'm using 'mygun dotarget h'
I'll try dowatch.
Dowatch only points the gun straight at the target.
When it's close enough, dotarget actually compensates for drop.
Any other ideas?
Luke
Edit:
Photo shows dowatch versus dotarget.
Dotarget is in the foreground.
-
Ok, so what effect are you hoping to achieve?
Do you want the barrel pointing up? Does the cannon need to fire?
-
Yes, eventually I am hoping for competently accurate rounds on the invisiH.
Luke
-
completely accurate shots means a shot = a hit.
Use fired event handler combined with doWatch and action "use weapon". When the round is fired, delete it, wait a second and create a similar round 1m above the invH, the round will fall down and explode just over the target.
-
This is if you are intending to use a non scripted round launched from the gun. Else disregard this reply. I wrote this intending it to be for indirect firing purposes where the player actually would still have to do the math to determine where the round trajectory.
the _tangent and _elevation are adjustable variables and the distance is for a point of reference. and it would eleminate the more than 1200 meters issue you are having. you can test it just by running the script from an addaction command in the init line of a soldier standing next to Ai manned M119. just need an interface to adjust the tangent and elevation. i ran some similar code in a loop and adjusted it with slider controls, kind of like a remote control turret. Just remember to delete the logic after you are done with the script or you will end up with a 100 logics floating around.
maybe you can come up with some math to determine the trajectory and set the elevation accordingly for things like clickconmap. Not sure what your overall intent is. Like Mandoble said you could just simulate the shots and create them over the target.
_tangent = 10; ///// adjustable variable to set the azimuth expressed in degrees.
_elevation = 45; //// this is the other adjustable variable expressed in degrees
_distance =1000; //// this is just a point of reference to get the math rolling. no need to adjust it
_M119 = position player nearestObject "M119";
_Fireposition = getposASL _M119;
_targetdir = [( _fireposition select 0) + sin (_tangent) * _distance, ( _fireposition select 1) + cos ( _tangent)*_distance];
_aimpoint = "logic" createvehicle _targetdir;
_aimingelev = (_fireposition select 2) + tan (_elevation)* _distance;
_aim =[(_targetdir select 0), (_targetdir select 1),_aimingelev];
_aimpoint setposASL _aim;
_M119 dowatch _aimpoint;
-
My aim (pun intended :D) is to create a non-scripted shell fired so that it lands reasonably close to the target area.
BTW can arma handle imaginary numbers?
I need to know because I've got something in the works that uses the quadratic formula.
Luke
-
if you are using a non scripted round then you can use that code to deterime the tangent and elevation of the gun barrel. What kind of interface are you planning using? dialogs, clickonmap, radio? that woul dbe the determining factor on how the code is used. works great via dialog but i do the trajectory calculations myself.