Jump to content
Sign in to follow this  
enad

Make units shoot at targets.

Recommended Posts

Hi all. I have a question.

I'm trying to make a little Training Base template and it would be really awesome if I could add some soldiers(AI) at firing positions, sorta slowly shooting off rounds at placed targets.

Is there any way to do this?

Thanks in advance! :)

Share this post


Link to post
Share on other sites

dowatch _placed_target

dotarget _placed_target

dofire _placed_target

after that if you wont you can do some

sleep _some_time

dotarget ObjNull

Share this post


Link to post
Share on other sites

I read about this:

fireAtTarget b:OBJECT fireAtTarget ARRAY

It's only in Arrowhead (Combined Op), but I never tested, just saw...

Share this post


Link to post
Share on other sites
fireAtTarget

true = aHMMWV fireAtTarget [aTargetObject];

Each time this is executed the gunner of the vehicle, aHMMWV will fire his default weapon one time at aTargetObject. You can also specify the weapon after aTargetObject if desired. It doesn't appear to work with soldiers, only vehicles.

The command requires itself to be set to a bool, as in the example above. DO NOT use false = as that'll end up screwing up your client forcing a hard restart of the game.

Share this post


Link to post
Share on other sites
true = aHMMWV fireAtTarget [aTargetObject];

Each time this is executed the gunner of the vehicle, aHMMWV will fire his default weapon one time at aTargetObject. You can also specify the weapon after aTargetObject if desired. It doesn't appear to work with soldiers, only vehicles.

The command requires itself to be set to a bool, as in the example above. DO NOT use false = as that'll end up screwing up your client forcing a hard restart of the game.

Is anyone aware of an alternative usage of this command ?

As kylania stated setting it to false screws up the client.

I have serious issues with new FSMs being started after i use the command:

true = _newunit fireAtTarget [_tar1];

The FSMs dont register setvariable changes to units which screws everything.

Share this post


Link to post
Share on other sites
There's since been a lot more documentation about this command listed here:

http://community.bistudio.com/wiki/fireAtTarget

So you can specify which weapon to shoot. Also seems to return a script handle now.

Thanks Kylania, with the handle and a dofire combination it works.

I was surprised about choosing a boolean value for the left hand side of the assignment operator (l-value). I am pretty sure that thats the reason

why i couldnt assign any true values anymore to any setvariable commands.

Share this post


Link to post
Share on other sites

how can you get the ai to dofire on a pop up target? it doesnt seem to work for me, infact the ai wont fire on anything that is an object, only units and vehicles with units in them

Share this post


Link to post
Share on other sites

I have to test this command out more. It would be interesting if vehicles could be forced to lock onto and fire at a laser target object with this. If that was possible then guided missles could be led around by setposing a spawned laser target object and that would be very usefull and easy method for guiding missles.

Dofire is allegedly broken since second last patch. I have not confirmed it because I found use of fire command and useweapon command a while back.

If you place a popup target in front of a unit (50 Meters should do but move it around) and then make a simple trigger that has this code in Onactivation field:

unitname dotarget targetname;unitname dofire targetname

and make the logical names for unit/target....

If the unit does not fire when trigger is run then dofire is infact broken. If it does fire then your usage of dofire is not working for some other reason that might be hard to determine.

Too far away or AI too "busy" with something else would be my guess....

dofire should work against target objects like popuptarget but not neutral objects like barrels.

Seems like BIS is finally giving good attention to AI fire dilemmas but it seems like good old dofire got left behind. :(

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  

×