Home   Help Search Login Register  

Author Topic: Static guns  (Read 1568 times)

0 Members and 1 Guest are viewing this topic.

Offline Luke

  • Members
  • *
  • Thank God! The OFPEC Staff are here!
Static guns
« 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
« Last Edit: 13 Aug 2008, 02:37:27 by Luke »
Pesky Human!!
Wort Wort Wort.

Offline Denz

  • Former Staff
  • ****
Re: Static guns
« Reply #1 on: 13 Aug 2008, 03:29:10 »
I don't think the viewdistance would effect it, what command are you using?
Something like
Code: [Select]
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
Code: [Select]
unit1 reveal unit2;unit1 dotarget unit2
I've got 'em right where I want 'em - surrounded from the inside!
Jerry "Mad Dog" Shriver, SOG Recon One-Zero
24/09/41 - 24/04/69

Offline Luke

  • Members
  • *
  • Thank God! The OFPEC Staff are here!
Re: Static guns
« Reply #2 on: 13 Aug 2008, 04:02:25 »
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.

« Last Edit: 13 Aug 2008, 04:19:09 by Luke »
Pesky Human!!
Wort Wort Wort.

Offline Denz

  • Former Staff
  • ****
Re: Static guns
« Reply #3 on: 13 Aug 2008, 13:53:34 »
Ok, so what effect are you hoping to achieve?

Do you want the barrel pointing up? Does the cannon need to fire?

I've got 'em right where I want 'em - surrounded from the inside!
Jerry "Mad Dog" Shriver, SOG Recon One-Zero
24/09/41 - 24/04/69

Offline Luke

  • Members
  • *
  • Thank God! The OFPEC Staff are here!
Re: Static guns
« Reply #4 on: 13 Aug 2008, 17:51:59 »
Yes, eventually I am hoping for competently accurate rounds on the invisiH.

Luke
Pesky Human!!
Wort Wort Wort.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Static guns
« Reply #5 on: 13 Aug 2008, 21:17:53 »
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.

Offline jones

  • Members
  • *
Re: Static guns
« Reply #6 on: 13 Aug 2008, 21:34:45 »
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.

Code: [Select]
_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;

« Last Edit: 13 Aug 2008, 21:39:01 by jones »

Offline Luke

  • Members
  • *
  • Thank God! The OFPEC Staff are here!
Re: Static guns
« Reply #7 on: 13 Aug 2008, 21:50:06 »
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
Pesky Human!!
Wort Wort Wort.

Offline jones

  • Members
  • *
Re: Static guns
« Reply #8 on: 13 Aug 2008, 21:55:39 »
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.