Jump to content
Sign in to follow this  
Funkman

Getting tanks to fire and miss

Recommended Posts

Hello,

I am making a movie, and I want some tanks to fire shells at a running man. I want the shells to miss and explode around him to look impressive.

Originally, I was placing markers, and using this code:

T1 (the tank) doTarget Marker1;

Sleep 1.5;

T1 fire "D81";

It didnt work I dont know why,

So I tried using camera.sqs to get a location beside where he runs, I now tried this:

T1 doTarget [-90285.16,11845.05,-7337.04];

Sleep 1.5;

T1 fire "D81";

This isnt working either.

Any suggestions?

Share this post


Link to post
Share on other sites

Sounds like doing that might require a lot of annoying things! :D

Maybe try creating an invisible target (included in ACE) in the places you want the tank to fire, and then make the man "Neutral" by using:

unit setCaptive true;

Failing that, MP might be a good way to go! :D

Share this post


Link to post
Share on other sites

T1 selectWeapon "D81";
(driver T1) selectweapon "D81";
(driver T1) lookAt (getMarkerPos Marker1);
(driver T1) doTarget (getMarkerPos Marker1);
Sleep 1.5;
T1 fire "D81";

?

Share this post


Link to post
Share on other sites

What do you mean "never mind"? I want a solution please!

Wokstation, thanks for the suggestion, I will try that, but is "driver" the right person to be doing the targeting throughout?

Share this post


Link to post
Share on other sites

:D By "never mind" he means that someone else has already solved the problem.

I'm sure Wokstation's suggestion will work.

Share this post


Link to post
Share on other sites

Well if that is what he meant then s(he) should have said so.

Unhelpful at best.

Share this post


Link to post
Share on other sites
What do you mean "never mind"? I want a solution please!

Wokstation, thanks for the suggestion, I will try that, but is "driver" the right person to be doing the targeting throughout?

No, you're right. Do gunner instead, silly me :)

Share this post


Link to post
Share on other sites

Well, Wokstation, I am afraid it did not work for me, I substituted "gunner" for "driver", but still no luck.

Share this post


Link to post
Share on other sites

The code does work with a little changing, for some reason I can't get it to work using an array of targets.

Anyway this will fire on four gamelogics named targ1,targ2,targ3,targ4.

T1 dowatch Targ1;
sleep 2;
T1 selectWeapon "D81";
gunner T1 selectweapon "D81";
gunner T1 lookAt targ1;
gunner T1 doTarget targ1;
Sleep 1.5;
T1 fire "D81";
sleep 4;

T1 dowatch Targ2;
sleep 2;
T1 selectWeapon "D81";
gunner T1 selectweapon "D81";
gunner T1 lookAt targ2;
gunner T1 doTarget targ2;
Sleep 1.5;
T1 fire "D81";
sleep 4;

T1 dowatch Targ3;
sleep 2;
T1 selectWeapon "D81";
gunner T1 selectweapon "D81";
gunner T1 lookAt targ3;
gunner T1 doTarget targ3;
Sleep 1.5;
T1 fire "D81";
sleep 4;

T1 dowatch Targ4;
sleep 2;
T1 selectWeapon "D81";
gunner T1 selectweapon "D81";
gunner T1 lookAt targ4;
gunner T1 doTarget targ4;
Sleep 1.5;
T1 fire "D81";
sleep 4;

Now if someone could get it working using an array of targets that would be better.

Has anyone noticed how the barrel of the T72 at distance always points to the front of the tank even when firing in opposite direction.

.

Edited by F2k Sel

Share this post


Link to post
Share on other sites

Should work:

_targetArray = [Targ1, Targ2, Targ3, Targ4];
_tank = T1;

{
_tank dowatch _x;
sleep 2;

_tank selectWeapon "D81";
(gunner _tank) selectweapon "D81";
(gunner _tank) lookAt _x;
(gunner _tank) doTarget _x;
sleep 1.5;

_tank fire "D81";
sleep 4;

} forEach _targetArray;

Edited by Cyborg11

Share this post


Link to post
Share on other sites

By "never mind" i guess he meant he posted something that has already been said

in this thread or that he came to the conclusion that what he originally posted didn't

make sense, so he did overwrite the already existing post with the "never mind" thingy.

At least that's the way i've seen ppl doing in posts. ;)

~S~ CD

Share this post


Link to post
Share on other sites

Thanks Cyborg112 the only correction was the array

_targetArray = [Targ1, Targ2, Targ3, Targ4];

Share this post


Link to post
Share on other sites

Does someone knows the classname of the invisible targets? Ive been trying to make an A10 fire its main gun to the middle of a marker and despite everything I tried nothing worked. So I think by creating an invisible target in the marker I could do that.

Share this post


Link to post
Share on other sites

Hmm, thanks for the scripts Sel, I will try them out tomorrow.

Stigma, good luck with that, as the A10 gun is not aimable, you will have to get the A10 to fly right at the target before you can fire....

'select weapon' command, combined with 'disableAI' to stop it changing the weapon back?

Then doTarget, doFire?

Share this post


Link to post
Share on other sites

I think if your just doing an cam script then the best solution would be to get the tank to fire at an object out of sight using the script and then spawn a bomb it the exact location as it would be more accurate.

Cyborg has corrected his script now and should work fine.

Share this post


Link to post
Share on other sites

@wickedstigma:

Invisible ACE targets can be found here. No solution for vanilla game. Probably BIS doesn't want us to "break the AI rules" or something :p

Share this post


Link to post
Share on other sites

That's what it looks like but BIS cheat by having invisible fences that aren't listed in the editor.

Share this post


Link to post
Share on other sites

If you know about any invisible BIS targets, I would be extremely happy to know about them. I have many uses for them. If you know the classnames, please share them, or where they are found :)

Share this post


Link to post
Share on other sites
If you know about any invisible BIS targets, I would be extremely happy to know about them. I have many uses for them. If you know the classnames, please share them, or where they are found :)

They're not targets just invisible fences of different sizes, I gues you could place them on rooftops to stop the ai falling off while allowing them to move.

I find it best to make one in the mission.sqm as then you can place them using the editor.

BIS_fence1 = createVehicle ["InvisibleFence2", getpos gamelogic, [], 0, "CAN_COLLIDE"];

BIS_fence1 = createVehicle ["InvisibleFence3", getpos gamelogic, [], 0, "CAN_COLLIDE"];

Share this post


Link to post
Share on other sites

Ok. Useful to know, never heard of those before. So, putting one of them out does work for doTarget (for infantry). But doFire will not. And if you do the fire command on an infantry, well let's just say he won't be hitting the target. Action ["useweapon"...] was also futile, for infantry.

So it seems the only way to make an "addon free mission" these days is to include a mission specific addon? I must say, that kind of sucks. :mad: Watch a machinegunner fire "M240" while prone, and be amazed :(

I think I'll open a new A2 CIT ticket for improvements to the fire command.

Share this post


Link to post
Share on other sites

When you consider how often this subject comes up it does seem odd that we still have a struggle getting units to target certain objects and fire at them.

Share this post


Link to post
Share on other sites

So the gist here is that creating an invisible fence can be used for doTarget but not doFire?

What about doTarget followed by "fire" (Weapon) once the unit has targeted the object?

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  

×