Home   Help Search Login Register  

Author Topic: Cancelling dofire/dowatch/dotarget  (Read 1305 times)

0 Members and 1 Guest are viewing this topic.

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Cancelling dofire/dowatch/dotarget
« on: 05 Mar 2005, 02:32:54 »
Hey all. I'm running into a really frustrating problem here, and I'm hoping someone has figured this out before. Anyway, I'm making a script to allow AI with grenade launchers to target a passed point on the map. Basically it creates an invisible target 50 meters in front of them, and sets it at a height depending on the range to the real target. I tell the grenadier to dowatch, dotarget, and dofire at the target. Then I order the unit to fire at the target, and his grenade sails through the air and lands at the passed position. That part works great.

The target I'm using (from the invisible targets addon) is on the "civilian" side, so nobody will shoot at it unless specifically told to by the dofire command. But the problem is, the guy keeps shooting at the target, and I can't seem to get him to stop, short of him running out of ammo.

So basically, does anyone know how to make a unit STOP targetting a unit?

I've got an eventhandler that tells me when he fires his first shot (the grenade), which is then supposed to stop him from continuing to fire at that target. I've tried using that EH to tell the unit to dofire null, or to dofire himself even. Neither one works. Anyone got any ideas?   :-\


HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!

Offline Blanco

  • Former Staff
  • ****
Re:Cancelling dofire/dowatch/dotarget
« Reply #1 on: 05 Mar 2005, 02:44:14 »
maybe...

Code: [Select]
unit dofire objnull
...or create and delete the invisible target in your script
Search or search or search before you ask.

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:Cancelling dofire/dowatch/dotarget
« Reply #2 on: 05 Mar 2005, 02:49:07 »
Darn, I tried it, and objnull doesn't seem to work either.  :-\

I don't know why I never thought about creating a new target like you suggested though! See, I can't delete the first target I create in the script via an eventhandler, because I have no way of passing it to the EH. As it is, there is a short delay in the main script, and then it deletes the target.

But creating a new target, then having them target that one.... it should work! I'll try that out. Thanks :)
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:Cancelling dofire/dowatch/dotarget
« Reply #3 on: 05 Mar 2005, 03:09:22 »
Yep, it worked perfectly! Still seems a shame that the only way to stop a dotarget order is by the target disappearing/dying, or by giving a new order.... I'll keep this thread open in case someone knows of another way.

Thanks! :)
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!

Offline ACF

  • Members
  • *
  • Llama?? Ain't that French for tanks?
Re:Cancelling dofire/dowatch/dotarget
« Reply #4 on: 05 Mar 2005, 10:37:23 »
This refers to what I think is the problem:

http://www.ofpec.com/yabbse/index.php?board=6;action=display;threadid=13357

I stupidly didn't check whether I'd said it in that thread but an AI machine gunner firing on an indestructible soft target will complete his  20s of fire time before he switches onto a second indestructible soft target that he's been ordered to engage.

Saw the thread on this on the BIS forum yesterday so have thought about it a bit. My guess is the target you're using is a fairly high armour value (to promote bucketloads of fire).  If there's a more easily killable one, that would solve the problem - first round that's on target - boom - no more target - grenadier ceases fire - job's a good 'un.

For small arms fire, I was thinking of an array of killable targets that the firers would work through without too much script control.  

As you've demonstrated, the usual approach to this idea is to tell the firers where to fire and then try to control that.  Turning it on it's head, if you used 'high threat' enemy-sided killable targets the firers will sort themselves out.  It would be up to you to tell the manoeuvre element of the group to 'hold fire' so they will move without distraction.

Final thought - onMapSingleClick has the only instance of 'selected group members' function, right? To make the script more universal, could you not extract that and pass it to the script so you decide who you want to put down the covering fire as well as where; and who is holding fire ready to move?

Plan B required! From the script, SetBehaviour and SetCombatMode will be applied to the whole group, not just individual units.  Only you can do that through the F-keys. You also need to use Alt-Click on the map to prevent the selected units from moving to the point you specify (it's a 'Watch' command by default).  Looks like it's back to civvy targets and unit-specific DoFires (which could work from the selected units array).

In the British context, Section Battle Drill No.4 is 'winning the firefight' - usually the whole section fire to regain the advantage and give the section commander time to plot his next move. It is therefore not unrealistic for the whole section to DoStop and give covering fire by default, then you leisurely select who you want to hold fire and manoeuvre.

I suppose I still can't quite see how it's intended to function in-game (unless it is purely for effect) because semi-skilled AI are going to deal with any real threats anyway, if you let them.  If it's a more deliberate attack: ordering 'hold fire', revealing targets, selected units 'open fire', other units 'follow me' is not dramatically more involved than remembering how to initiate scripted covering fire.
« Last Edit: 05 Mar 2005, 14:16:57 by ACF »

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:Cancelling dofire/dowatch/dotarget
« Reply #5 on: 06 Mar 2005, 03:14:24 »
@ACF

Checked the other thread, but the ideas there won't work, since I don't want to set the entire group to "hold fire". Blanco's suggestion works perfectly though, so it isn't really a problem anymore.

I think you might be misunderstanding what my script is about... it isn't at all about suppressive fire. Basically it's like CoC's Unified Artillery, only for grenadiers. I'll post it in the beta section in a few days so you can see what I'm talking about :)
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!

Offline Blanco

  • Former Staff
  • ****
Re:Cancelling dofire/dowatch/dotarget
« Reply #6 on: 06 Mar 2005, 07:43:36 »
sounds cool  ;)
Search or search or search before you ask.