Home   Help Search Login Register  

Author Topic: Select weapon/muzzle on an AI controlled chopper?  (Read 1818 times)

0 Members and 1 Guest are viewing this topic.

Offline laggy

  • Members
  • *
  • "Behold a pale horse"
Select weapon/muzzle on an AI controlled chopper?
« on: 23 Mar 2009, 14:40:02 »
Has anyone ever been able to select weapon/muzzle on an AI controlled chopper?
This is my setup:

- GameLogic called "spot"

- Cobra called "tc" in perfect line of sight from "spot".

- Trigger set to "true" with onActivation:

tcd selectWeapon "FFARLauncher";
tcg selectWeapon "FFARLauncher";
tcd selectWeapon "R_Hydra_HE";
tcg selectWeapon "R_Hydra_HE";
tcd doTarget nearestObject [getpos spot, "static"];
tcg doTarget nearestObject [getpos spot, "static"];
tcd doFire nearestObject [getpos spot, "static"];
tcg doFire nearestObject [getpos spot, "static"];

The Cobra is still just firing with the cannon/machinegun.

I've tried just having selectWeapon once (either weapon or muzzle)... No difference.
I've tried just having "tc" selectWeapon etc. instead of "tcd" and "tcg"... No difference.
I've tried setting nearestObject selection to "all" and then the Cobra don't fire at all.

Very annoyed and confused  :blink:

Laggy
And I looked and beheld a pale horse and his name that sat on him was Death and Hell followed with him.

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Select weapon/muzzle on an AI controlled chopper?
« Reply #1 on: 23 Mar 2009, 16:03:01 »
Well, first you tell them to use "FFLauncher", then change that to "R_Hydra_HE". Thus, they will try to use the latter. Unfortunately, "R_Hydra_HE" is an ammo type, not a weapon/muzzle, so they'll just ignore you.

The bigger issue, however, is that selectWeapon doesn't prevent the AI from working. They will physically change weapons and then the AI will tell them to use what it thinks is best in the situation. selectWeapon just changes the current weapon, it does not tell them to use it; it is mostly useful on players after you've equipped them, to ensure they have the weapon you want selected in their hands.

[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline laggy

  • Members
  • *
  • "Behold a pale horse"
Re: Select weapon/muzzle on an AI controlled chopper?
« Reply #2 on: 23 Mar 2009, 16:45:55 »
Hmmm...

Do you think a quick selectWeapon function set on a 0.001 sleep loop would help?
Kind of "bombarding" the AI with commands to selectWeapon  :scratch:

Thanks,

Laggy
And I looked and beheld a pale horse and his name that sat on him was Death and Hell followed with him.

Offline Deadfast

  • Members
  • *
Re: Select weapon/muzzle on an AI controlled chopper?
« Reply #3 on: 23 Mar 2009, 17:28:14 »
Don't know what situation you want to use it in, but removing the gun's ammo will work for sure.

Offline Sparticus76

  • Members
  • *
Re: Select weapon/muzzle on an AI controlled chopper?
« Reply #4 on: 24 Mar 2009, 03:32:26 »
Code: [Select]
_gunner = _this select 0;
_spot = _this select 1;
_gunner dotarget _spot;
sleep 0.5;
_gunner action ["useWeapon", _helo, _gunner _helo, 0];?
or try this
_gunner action ["useWeapon", _helo, _gunner _helo, 1];?
or try this
_gunner action ["useWeapon", _helo, _gunner _helo, 2];?

have you tried this?

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Select weapon/muzzle on an AI controlled chopper?
« Reply #5 on: 24 Mar 2009, 16:52:51 »
Removing the ammo, for weapons you want to disallow, sounds like the Gordian Knot solution and would work quite well.

Although useWeapon action will work to a point, it doesn't prevent the AI firing the normal weapon (they'd be busy firing the MGs normally, then you'd be auto-firing the special weapons on top of that). There are several significant difficulties to overcome here, such as ensuring they don't fire at friendly vehicles, terrain or buildings that happen to be blocking their line of sight. I remember trying to force the AI to fire suppressively using this technique and just getting bogged down...
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)