Jump to content
Sign in to follow this  
Blanco

How to prevent AI firing at empty vehicels?

Recommended Posts

Ok, an empty vehicle can be a threat, but not when enemy troops are firing at you. I've seen situations where the AI ran out of ammo,because they really want to destroy an empty & damaged UAZ. That's stupid, because an empty vehicle can be used against the enemy.

When you order your men to attack a UAZ with MG (just an example) , they will try to kill the gunner and driver first, but after that they really want to destroy the UAZ.

It's not an issue when I'm in command, because I can always cancel the target , but AI-officers don't do that stuff.

Even worse, when you kill the gunner and the driver disembarks, the AI will fire at the UAZ instead of the driver.

How can I fix that with a script? I will report it as a bug, dunno BIS will confirm this as a bug. I guess these things are hardcoded.

Anyway, I tried setcaptive & setfriend but both commands don't work on vehicles, only on troops.

Any suggestions?

PS: damn a typo in my topic title... tounge2.gif

Share this post


Link to post
Share on other sites

That problem comes from OFP and I'm hoping for a solution for that as you are. huh.gif

Share this post


Link to post
Share on other sites

Hmm, this has bugged me too, when troops waste all their ammo on

destroying an unmanned MG.

There is a more elegant solution for sure,

but for now i can think of a script that replaces the vehicle.

Retrieve the vehicles heading and position and then

deletevehicle it and createvehicle an empty vehicle right on the spot with the data. This should at least work for now, if i can think of something better i will post here.

Share this post


Link to post
Share on other sites

They'll continue firing at an empty vehicle because they don't know it's empty, as they didn't see the crew disembark. If one of the people in the group gets close enough they should be able to report it as empty. It wasn't actually much of a problem in OFP, but in any case simply putting a friendly or civilian in the vehicle will get them to stop.

Share this post


Link to post
Share on other sites

yeah , they stop to fire, but they still follow car and aim at it! banghead.gif

 I played a mission yesterday, At the end of the mission, I got in the enemy jeep and drove it back to friend line. I didnot get any friendly fire, but the AI still follow me and aim at me, no matter where I am going ....

Share this post


Link to post
Share on other sites
They'll continue firing at an empty vehicle because they don't know it's empty, as they didn't see the crew disembark. If one of the people in the group gets close enough they should be able to report it as empty. It wasn't actually much of a problem in OFP, but in any case simply putting a friendly or civilian in the vehicle will get them to stop.

Hmmm, i did a little test in the editor.

I placed a two man squad, I'm in command and both units have setcaptive true in the init.

In front of them, just about 15m away, a UAZ with MG.

My man killed the gunner and when the driver dismounts he still fires at the UAZ. I'm sure he saw him disembarking that vehicle. If he wasn't captive, he would be dead by now.

I know it's an OFP bug and I solved it by creating an identical vehicle on the same spot with the same data, but I was hoping for a better solution. Ir even better... for a fix cause it's a stupid bug that can ruin your mission.

Putting a civilian in the vehicle would look odd imo, but I gonna try to put a gamelogic in it.

Share this post


Link to post
Share on other sites

Indeed a bit annoying, I have observed this a lot in ArmA as well. When we get attacked in a jeep for example we just jump out and dash off to some covered positions before firing back.

But it happens that the enemy still only concentrates on the vehicle alone. We had such a situation last week - after a while we just went on running torwards our next waypoint. 5 minutes later we could still hear the enemy troops firing at our jeep in the distance rofl.gif

I will add a little script to my vehicles for this now. When empty, make it neutral to the enemy; when manned, leave this to the enemy to decide. That should do the trick.

As SQS:

?(count crew this == 0): this setCaptive true

?(count crew this >0): this setCaptive false

Or as SQF:

IF (count crew this == 0) THEN {this setCaptive true} ELSE {this setCaptive false};

Regards,

Victor

Share this post


Link to post
Share on other sites

@VictorFarbau

Blanco stated earlier:

Quote[/b] ]

Anyway, I tried setcaptive & setfriend but both commands don't work on vehicles, only on troops.

Any suggestions?

Share this post


Link to post
Share on other sites

If this is true then let's see if there's any other way to get this done. That sounds like a challenge and that's what we like about Arma smile_o.gif

I did apply this to vehicles before - but then there were people in it, maybe that's the difference.

Victor

Share this post


Link to post
Share on other sites

I gonna try to create a civilian in the vehicle and delete him after a second or so. If the side "civilian" remains, the problem could be solved.

In OFP I'm 100% sure empty vehicles in OFP were on civilian side, dunno it's the same in Arma.

Share this post


Link to post
Share on other sites

Yes ,also in Arma, empty vehicles are on the civilian side.

No matter if you put a civilian inside, the AI will continue to fire at it until it is destroyed.

The side of the car does change to civilian, but the AI has been issued the command to destroy it as it was still an enemy.

The vehicle is damned for destruction no matter what you do.

Share this post


Link to post
Share on other sites

Well I just tried my theory in the editor and it works.

My squad doesn't fire the vehicle when the civ became driver and deleted.

I had to dismount (setpos) the civilian first because deleting him while he's in vehicles doesn't seem to work.

here's the dirty script :

Quote[/b] ]

;Dirty Emptyvehiclefix script by blanco

_veh = _this select 0

#loop

? !alive driver _veh && !alive gunner _veh: man moveindriver _veh;goto "check"

~1

goto "loop"

#check

@man in _veh

man setpos [0,0,0]

~1

deletevehicle man

~2

hint format ["%1", side _veh]

It returns "CIV" smile_o.gif

It would be better if I create the civilian in the script itself but I don't have the time right now. i just placed a civilian on the map and I named him "man".

I don't know it will work with all vehicles tho. I tried it with a UAZ with MG. It should be a general script that also works for static weapons and such.

Be free to improve it if you want (convert it to sqf smile_o.gif )

You won't see the civilian but your men will report him, they know he was there for a very short period. (whatever)

You can also order your men to capture the vehicle.

Here's the proof : http://www.mediafire.com/?6rldwweh5dl

Share this post


Link to post
Share on other sites

I'm not sure why but it seems only some people get this problem. I've never had this problem (at least nothing this serious) in OFP, yet some people claim they have. Still, it's caused by the AI not realizing the vehicle is empty. I don't know if this helps but you can try using reveal, revealing the vehicle to the group of said AI might force them to recognize it as empty (the theory based on the fact that distant, empty enemy vehicles are often mistaken by AI as manned, but recognized as empty when they're closer). Alternatively, you might also try ejecting the dead crew, no idea if it has any effect but at least it truely empties the vehicle.

Share this post


Link to post
Share on other sites

Blanco, the funny thing is that I tried your mission but then removed the EVF script from the vehicle - and my soldiers would still cease fire after the killed the two drivers anyway smile_o.gif No obsessed and crazy firing at an emtpy vehicle.

EDIT: my test mission was to drive in a HMMWV and place a BRDM not too far away. Then fire a few rounds at the BRDM and run away. Then watch how the BRDM would fire at the HMMWV until explosion, no matter what. I even placed an east driver into the HMMWV but they still would not stop shooting. As I say, mindless obsession smile_o.gif

Victor

Share this post


Link to post
Share on other sites

I know, I just found it out myself. Very very strange.

Maybe in the heat of the battle they go in berzerk mode...

Share this post


Link to post
Share on other sites

If you write a general script for that, consider KyleSarnik's thought about ejecting the crew, because not every vehicle might have ejectdeaddriver=true in their config.

And he is right about this working different on every machine,

i have tried this today exactly the same way with the civilian and they kept firing at the car,even killing the civilian driver sometimes lol. A bizarre issue this whole thing is, i wonder what Suma would have to say about it ?

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×