Jump to content
Sign in to follow this  
Mosquito023

AI burst shooting

Recommended Posts

Hi guys, im new to this board. And got my first question!

I'm trying to make a mission for the mod Invasion1944, and i'm trying to recreate the mission in the series Band of Brothers called "Crossroads".

So i have a MG34 nest up on the road, overlooking the landscape in front of it.

So what i'm trying to do is have the MG34 fire bursts at nothing really..so he just shoots in front of him while there's nothing.

I have tried the DoWatch, DoTarget, DoFire etc commands, but that failed. The only way it worked for me was using the damage false command, for a US unit and place him in front of the gun. But it kinda looks weird if i have a US soldier standing there, doing nothing ofcourse. So i'm wondering if there is a script that allowes me to do this, since i'm not a big scripter..i haven't figured it out yet.

I hope i can get any help here!

Regards! and thanks in advance :)

Share this post


Link to post
Share on other sites

As it happens Dotarget is broken and doesn't look like it's going to be fixed any time soon.

The result of this is that it's quite hard to get a unit to raise his weapon long enough to to fire his weapon in the required direction.

If the unit is lying down this isn't a problem as it doesn't need the command.

For testing you can try this.

name a unit man

in the units init put man setunitpos "down"

place a gamelogic and name it gl (it needs this for the action command to operate)

In a repeating trigger 0,0 size radio alpha

null=[] spawn {for "_i" from 0 to 4 do {man setformdir  random 120; sleep 0.4;for "_i" from 0 to 9 do {sleep 0.1;gl  action ["useweapon",man,man,0]}}}

It will fire 5 bursts with 10 shots in each burst, it will also slightly adjust direction unless it see the enemy then it will target that instead.

Share this post


Link to post
Share on other sites

isn't setunispos "down" a command for him to lie down ?

Cause he won't be able to lie down, since the MG34 nest is static gun nest. So he won't be able to lift the weapon of the sandbags.

But when i get home, i'll try and see if it works!

Share this post


Link to post
Share on other sites

You don't need that then static gun should be fine.

Share this post


Link to post
Share on other sites

Well i tried it, but failed. He turns all the way to the left (wich i don't really want, i want him to keep his gun in the middle and fire it) and he refused to fire it. Also 1 thing wich might be good to know, the soldier is a german! And the one who plays the mission is a US airborne soldier. So working with radio trigger isn't doing good i think ? Because u have to activate it with 0-0-1 right ?

Share this post


Link to post
Share on other sites

Yes because it's a static gun it needs a small change.

For direction I set it to 180 degrees and then the random will have it move 120degrees about that position. You can mess with the numbers to get the direction you want or remove the code as in the second script.

The trigger could be set up in anyway you want I set it to radio for testing.

You could have it set to anyone present and place it in front of the Mgun.

Also you don't need a game logic for static unit.

slight direction change

null=[] spawn {for "_i" from 0 to 4 do {man setformdir  180 + random 120/2; sleep 0.4;for "_i" from 0 to 9 do {sleep 0.1;man  action ["useweapon",man,man turretunit [0],0]}}}

Fire from current direction

null=[] spawn {for "_i" from 0 to 4 do {man setformdir getdir man + random 120/2; sleep 0.4;for "_i" from 0 to 9 do {sleep 0.1;man  action ["useweapon",man,man turretunit [0],0]}}}

Share this post


Link to post
Share on other sites

Ok thanks, will try it out :)

Ok got it to work, but now i only need to find a way to have him got more ammo, cause now he does it like 4/5 times. And stops cause he run out of ammo, because he doesn't shoot bursts. But atleast your code got him to fire it now! lol

Edited by Mosquito023

Share this post


Link to post
Share on other sites

The first sleep is the delay between bursts and the second the delay between shots.

To increase the number of bursts try increasing for "_i" from 0 to 4 do to for "_i" from 0 to 25

If you want even more ammo increase bursts to 100 or more and put this in the M guns init

this addeventhandler ["fired", {(_this select 0) setvehicleammo 1}]

This will give constant ammo.

Share this post


Link to post
Share on other sites

Ive got it to work! just messing around with the direction, since i want him to have him ONLY shooting in front of him. but other then that, it's working! thanks alot! :)

Share this post


Link to post
Share on other sites

guys I cannot understand that. I've just tested what you typed above but it doesn't work... If I want a MG NEST (arma 2 reinforcements) to fire in front of it without stopping and with infinite ammo, how can I do that?

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  

×