Home   Help Search Login Register  

Author Topic: M2's shooting into the air  (Read 3028 times)

0 Members and 1 Guest are viewing this topic.

Offline Sparticus76

  • Members
  • *
M2's shooting into the air
« on: 08 Jan 2008, 09:19:37 »
Ok, here's the problem.
Vehicles with M2's dont seem to shoot at zsu's so I made this script.....

Code: [Select]
_firer = _this select 0
_tgt = _this select 1

#fire
_ammo = _firer ammo "M2"
_burst = _ammo - 10
_firer dotarget _tgt
~2

#burst
_firer dotarget _tgt
_firer fire "M2"
_ammo = _firer ammo "M2"
? _ammo <= _burst : goto "alivechck" 
? _ammo > _burst : goto "burst"

#alivechck
? alive _tgt : goto "fire"
? !alive _tgt : exit


This script makes _firer engage _tgt, however the M2 rides up from the target and ends up pointing into the sky at what appears to be full elevation during the burst.
....help?
p.s. couldnt find anything on this on searches :o|

« Last Edit: 13 Jan 2008, 13:08:58 by Sparticus76 »

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: M2's shooting into the air
« Reply #1 on: 08 Jan 2008, 11:55:47 »
Havent tested that, but you might try to change _firer dotarget _tgt by _firer doWatch getPos _tgt, then wait a second or two to make sure it is watching the correct direction and then _firer fire "M2".

You may also try just waiting 2 seconds after the doTarget command to make sure the M2 is aligned with the target before ordering it to fire.

Offline Sparticus76

  • Members
  • *
Re: M2's shooting into the air
« Reply #2 on: 08 Jan 2008, 11:59:21 »
_firer starts firing and hitting the target, it's just that the barrel of the M2 immediately starts to rise to the heavens. I have tried delays, dont know what the problem is, thanks for the help.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: M2's shooting into the air
« Reply #3 on: 08 Jan 2008, 12:34:55 »
Did you try the doWatch position instead of doTarget?

Offline Sparticus76

  • Members
  • *
Re: M2's shooting into the air
« Reply #4 on: 08 Jan 2008, 12:40:35 »
Yeah mate, does the same thing. An interesting thing that might help out though is that, if I move within about 20 - 15 meters of the firer, the muzzle goes down, points at the target and engages exactly how I want. I even tried using the targets global name in the script, but still wouldnt engage correctly, hey I'll try anything here.

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: M2's shooting into the air
« Reply #5 on: 08 Jan 2008, 13:54:58 »
could it be that the M2 bearer is losing sight of the target and thus estimates the position? try adding a reveal command in there.

Offline Sparticus76

  • Members
  • *
Re: M2's shooting into the air
« Reply #6 on: 08 Jan 2008, 14:10:16 »
Thanks, tried the reveal command, no joy  :dunno:

Offline Loyalguard

  • Former Staff
  • ****
Re: M2's shooting into the air
« Reply #7 on: 08 Jan 2008, 15:12:32 »
Hmmm...based on your statement about it working when you approach firer...I don't know much about it, but, could this be an issue with the firer's knowsAbout level?  Perhaps firer doesn't have a high enough knowsAbout level to keep firing on target but when you come closer perhaps you are "sharing" your knowsAbout level of the target which is enough to put firer over the magic number and properly target/fire on the target?
« Last Edit: 08 Jan 2008, 15:17:03 by Loyalguard »

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: M2's shooting into the air
« Reply #8 on: 08 Jan 2008, 15:23:55 »
Is it possible it's simply a matter of recoil? I.e., it starts shooting, but the recoil kicks back the barrel - due to the scripted nature of things however, the AI isn't interested in returning the sights to the target, which results in pigeon-shooting.

Maybe try having the M2 shoot short bursts (as long as they can before they're kicked out of focus) and then re-run the script?

Wolfrug out.
"When 900 years YOU reach, look as good you will not!"

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: M2's shooting into the air
« Reply #9 on: 08 Jan 2008, 16:03:39 »
This happens because of a bug in the fire command (yeah, OK, you realised that already). Just use the USEWEAPON action instead (this works for infantry, static M2 and other vehicles with "sky-shooting" weapons, though if weapons have multiple muzzles, you'd need to calculate the _weaponIndex differently):
Code: [Select]
_weaponIndex = (weapons _vehicle) find "M2";
_gunner action ["USEWEAPON", _vehicle, _gunner, _weaponIndex];
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Sparticus76

  • Members
  • *
Re: M2's shooting into the air
« Reply #10 on: 09 Jan 2008, 02:12:36 »
Thanks fellas, but still no luck here's what I have now.  :confused:

; initiated with [vehicle firing, targeted vehicle] exec "tgt.sqs"

Code: [Select]
_firer = _this select 0
_tgt = _this select 1

; get crew of the target for exiting script if they're dead
_crew = crew _tgt

; establish info for USE WEAPON action
_gunner = gunner _firer
_weaponindex = (weapons _firer) find "M2"


; establish 10 round burst size
#fire
_ammo = _firer ammo "M2"
_burst = _ammo - 10
_firer dowatch getpos _tgt
~2
goto "burst"


; conduct burst with ammo check and loop
#burst
_firer dowatch getpos _tgt
_gunner action ["USE WEAPON", _firer,_gunner, _weaponindex]
_ammo = _firer ammo "M2"
? _ammo <= _burst : goto "alivechck" 
? _ammo > _burst : goto "burst"


; check if target crew are alive after every burst for script exit
#alivechck
? !alive (_crew select 1) && !alive (_crew select 2) : exit
goto "fire"
« Last Edit: 13 Jan 2008, 13:11:11 by Sparticus76 »

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: M2's shooting into the air
« Reply #11 on: 09 Jan 2008, 02:50:22 »
If it is imperative for you to have that M2 firing at the shilka, attach a Mando Gun to it. Check mando_gun2_v1_2.Intro example mission which uses also static MGs.

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: M2's shooting into the air
« Reply #12 on: 09 Jan 2008, 04:39:22 »
"USE WEAPON" doesn't have a space, so you should have:
Code: [Select]
_gunner action ["USEWEAPON", _firer, _gunner, _weaponindex];
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Sparticus76

  • Members
  • *
Re: M2's shooting into the air
« Reply #13 on: 09 Jan 2008, 06:23:35 »
yes, I tried it without the space.... Believe me I try every combination I can before posting on here. I saw in another post where someone opened up the config or something and found all the actions and it had a space...but I did try without the space, no joy.

Edit: Ok, thanks for all the help gents, looks like I'll have to try and work in Mandoble's script or use tow launchers for the assault, thanks again.
« Last Edit: 09 Jan 2008, 11:31:54 by Sparticus76 »

Offline Sparticus76

  • Members
  • *
Re: M2's shooting into the air
« Reply #14 on: 12 Jan 2008, 05:21:39 »
So as I understand it Mandoble, the only solution is to point the gun at the target, create a projectile at the end of its muzzle and fling it at the enemy with added sound so it appears as though the gun is firing and repeat that at a great rate of knots?