Jump to content
Sign in to follow this  
dismas

Problems with fire and dofire

Recommended Posts

I've been trying to force an AI to fire automatically at a target, or just automatically indiscriminately. Trouble is, I can't force this with doFire, and when I use fire ["g36a", "fullauto"] the AI aims directly into the air and unloads into the sky. Does anyone know how to force the AI to aim at least on the level (horizontal)?

disableAI "TARGET" and disableAI "AUTOTARGET" doesn't seem to help, before anyone dares to suggest it wink.gif

I have searched the forums as best I could before asking this, and couldn't find any helpful posts.

And no, I don't want to do setAccTime 10 and loop doFire, for reasons of appearance.

thanks in advance

Share this post


Link to post
Share on other sites

What happens when you give him a doTarget or doWatch command first then tell him to fire? Is this for a cutscene or something?

Share this post


Link to post
Share on other sites

Yes, I do doWatch and doTarget. doesn't make a lick of difference.

this is for a cutscene, yeah.

Share this post


Link to post
Share on other sites

Well this one is beyond me confused.gif I can't stop him from shooting at the sun (or whatever it is he's trying to hit). No matter what I get him to target or what AI I disable he still shoots into the air, the safety conscious foo. Even tried making him with camCreate so he was AI'less but still no luck.

Share this post


Link to post
Share on other sites

You just have to give him a target, and then use doTarget

or doFire.

fire[ "","" ] doesn't work very well with rifles.

Sad but true.

wink.gif

Share this post


Link to post
Share on other sites

Had similar problems. Made a Machine-Gunner in Patrol Boat target an enemy grunt with dotarget, dofire. It only works one out of 20 times or so?! On the other hand I successfully got a Chinook gunner to fire at an infantry squad in full flight! (Worked one out of 10 times! Happy me.)

It seems to me (after trial and error) that distances have a considerable effect on the whole procedure. Sometimes I've got the feeling that at shorter distances it doesn't work at all, while at medium distances I've got a better chance to make it work.

It would be nice to hear more opinions on this. Its a very crucial part in scripting interesting cutscenes or battles.

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (SCLZ @ June 05 2002,11:50)</td></tr><tr><td id="QUOTE">Well this one is beyond me  confused.gif I can't stop him from shooting at the sun (or whatever it is he's trying to hit). No matter what I get him to target or what AI I disable he still shoots into the air, the safety conscious foo. Even tried making him with camCreate so he was AI'less but still no luck.<span id='postcolor'>

Place a 'H'(invisible) somewhere and make the AI fire at the 'H'-pad.

sample:

name the helipad 'target1'

name the firing-unit 'unit1'

then : unit1 dofire target1 should work.

Have'nt tried it with 'dofire', but 'dotarget' with tanks work great.

Share this post


Link to post
Share on other sites

the trouble with fire and doFire (doTarget) only lies with infantry. You can't force an infantry man to aim any kind of weapon at a coordinate set which is what the fire command relies on. After much trial and error and nearly smashing my computer and killing myself, I've determined that the ONLY way to get an ai infantry to fire automatically at another ai infantry is to just go get a gun yourself.

If you don't mind how it looks, you can use this following script which I home brewed. It's almost reliable. ALMOST.

; _weapon is the string name of the weapon (weapon identifier)

_weapon = "g36a"

; guy that gets WASTED. it is the object name. you can get creative and use nearestObject, too

_target = whatever_you_want_put_here

; guy that does the _targetshooting. object name, again

_leeharveyoswald = whatever_you_want_put_here

; how many times you want to try to force the guy to fire "automatically"

_shots = 10

_c1 = 0

#loop1

_leeharveyoswald doTarget _target

_leeharveyoswald doFire _target

_ca = _leeharveyoswald ammo _weapon

@((_leeharveyoswald ammo _weapon) <= (_ca - 1))

_target setDammage 0

setAccTime 0.1

~0.2

setAccTime 2

_c1 = _c1 + 1

? _c1 < _shots : goto "loop1"

just play around with the numbers till you get the effect you want. as is, this looks very nice in cutscenes because there is a pause in which you can see the weapon flare and the shell ejecting.

You will never have this problem with vehicles, though, because the fire command works properly with them.

This is something I seriously hope BIS changes/fixes.

Share this post


Link to post
Share on other sites

Or just put a helecopter above the guy so when he shoots hes actually hitting something wink.gif

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  

×