Jump to content
Sign in to follow this  
pstennisace

how to script AI choppers to fire rockets?

Recommended Posts

Hey guys, im kinda new to scripting, but Ive noticed that when i call in apaches, or cobras, that when they attack they only fire thier cannon. Is there a way to script them so that they fire rockets as well? thanks guys!

Share this post


Link to post
Share on other sites

They do fire rockets, they just need a target that's worth it. Imagine you're a proper pilot; you're hardly going to fire a hydra at a single man rather than your machine gun. In my mission I have an AH-6D that flies in to help the player and he fires rockets at large concentrations of enemy infantry. No scripting needed :D

Hope this helps!

Share this post


Link to post
Share on other sites

using the mi8_rockets_ru or mi24D will almost guarantee a rocket attack

Share this post


Link to post
Share on other sites

I used this script to get a Mi-8 with the rocket pods to shoot a ton of rockets into a general area. The rockets never really hit the exact spot, and they really do pretty much go wildly anywhere... try it out and see if it works for you.

Also, if you wanted to time the sleeps, with the up and down motion of the chopper I'm sure you could maybe dial in the rocket hits a little better, but good luck with that.

note: h1 is the name of you chopper and target1 is the name of an empty marker placed in the editor, where you want your rockets to roughly hit. I recommend placing target1 a few hundred meters in front of your actual target, closer to the chopper since it seemed the majority of rockets overflew the target.

shoot.sqf

if(!isServer) exitWith{};

sleep 0.5;

vehicle h1 setBehaviour "AWARE";

vehicle h1 setCombatMode "YELLOW";

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 2.5;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 0.001;

vehicle h1 doTarget target1;

vehicle h1 doWatch target1;

sleep 0.001;

vehicle h1 doFire target1;

sleep 0.001;

vehicle h1 fire "57mmLauncher";

sleep 1.0;

Share this post


Link to post
Share on other sites

That could possibly be the longest script I have ever seen :/

Share this post


Link to post
Share on other sites

1. I don't see they guy having any more questions, so obviously it worked well enough for him, as it did for me.

2. I don't see any of you guys giving any better answers or trying to help the guy at all.

3. Not everybody on this forum understands every little piece of code in this scripting language and how to use it properly, otherwise questions like this wouldn't be here. So don't poke fun at other peoples attempts to make something work, just because it may not be the prettiest or most optimal way to do something.

4. How about you offer a better solution, and an explanation of why it works better the way you've shown. Or even better yet, post some examples on the BIS wiki, so when your arrogant ass posts a link to something there, it can be understood by others who don't come from a background in computer languages.

5. You three are a prime example of why this community is so screwed up. People are here for help and answers, but typically they just get passive aggressive flaming for simply needing a little explanation or help that your too lazy to give. Your comments directed at me are uncalled for and immature. So damn me because I had the audacity to give what help I could to another person and that help wasn't good enough by your standards huh? well you three can assume that you rank among the lowest scum to bless this forum for your actions in my eyes. happy gaming gentlemen.

Share this post


Link to post
Share on other sites

Why not using unitCapture?

Get used to that command and its use in the past days and it is really handy, if u want the AI doing what YOU want, without any strange behaviours.

Share this post


Link to post
Share on other sites

@franklin:

2. Post #2?

3. You'll laugh about it yourself eventually. Been there, done that. Looking at my OFP scripts today just makes me wanna have a drink and forget. Point is, you do get better with practice. And... Post #6 seems like a practice suggestion to me...

4. Post #6, as an improvement to your suggestion?

5. Lol, so having a little fun makes us the, and I quote, "lowest scum to bless this forum"? Thanks for that, much appreciated. And I'm sure you checked all my other replies I've made over the years to come to that conclusion. How is this community screwed up? Please explain. I can't believe you got sore for that... I apologize, but I will make funny remarks again if I see something I find funny, sorry, but that's just the way it is... And you say you three? MichaelGER's suggestion makes perfect sense, it even links to information about how to use it. If you get upset about a :p smiley, then I think you should take a look at yourself instead...

Edited by CarlGustaffa

Share this post


Link to post
Share on other sites
That could possibly be the longest script I have ever seen :/

Why was this comment needed? it offered no help at all, and only criticized my effort to help.

Whats about a for loop?

First off, this has nothing to do with helping the OP directly, since he obviously doesn't know much about scripting. secondly the one example that BIS posted doesn't mean anything to me. I have no way of knowing how to include that in a script in order to make it do anything, so how can somebody with less knowledge than I make it work? The sarcasm isn't appreciated, refer to #4.

I bet he didn't even use copy & paste

Obvious insult directed at my lack of knowledge (or intelligence), which I did not appreciate. On top of that, you added nothing towards creating a solution for the OP.

post #2 didn't offer the OP a solution, it just told him that sometimes the AI fire rockets at groups of infantry. He didn't ask for a lesson in tactics, he asked for a way to force AI helicopters to fire rockets.

And I'm sure you checked all my other replies I've made over the years

I'm sure you've offered lots of help to others in the past, I've seen your name many times in the past years. But it doesn't matter how much you've done in the past to me anymore, since you've come into this post only to insult me and offer no help at all. All that great work you've done, but this guy isn't good enough for you huh... how do you decide who is good enough and who isn't? if they understand a little scripting, you'll take your time to help?

I do understand that I have a long way to go to understand the arma scripting language, I don't pretend to know everything. My limited knowledge and experience leave me asking questions here and doing hours worth of searching. But i still do it, and because of the many that do offer great help to me, I give back to those who I can help as much as I can. So what if my script isn't perfect, or doesn't use some scripting function I don't understand. it works, and it works better than anything else posted in this thread. Since were playing "holier than thou" with the "I've been here helping for years blah blah blah", At least I took my time to help the guy.

Its incidents like these that make me believe this community is jacked up. People who just want to enjoy this awesome game and create something cool for their friends, but have a hard time grasping the scripting language get treated like shit here. People like you that understand all the scripting functions think that just by providing a link to something it will magically be understood by the person with a question. Sorry dude, but i have the BIS wiki in my favorites page too, but that doesn't mean I can clearly understand everything that is there. Come down off your high horse and remember what it was like to be learning this stuff, and just want an answer to your question so you could get back into the editor.

Share this post


Link to post
Share on other sites
Its incidents like these that make me believe this community is jacked up.

It's rambling "waaah you hurt my feelings" posts like all of yours in this thread that make me believe you take offense way too easily and the problem lies with you, not the community.

When someone says "That's the longest script I've ever seen", the proper response is, "Why, yes, it is. I had no idea what I was doing and still don't, how can I improve it please?" not "You sarcasm makes me sad in the pants and you're all jerks!"

Share this post


Link to post
Share on other sites
First off, this has nothing to do with helping the OP directly, since he obviously doesn't know much about scripting.

As you are doing now, we were not answering the OP...

Obvious insult directed at my lack of knowledge (or intelligence), which I did not appreciate.

Noted, but was meant as a funny remark, not an insult... I will not stop either, as life is supposed to be fun and not always dead serious. And I can not guess who does not share my sense of humor. Sorry you didn't, I truly am... I suggest you simply put me on your ignore list then, problem solved.

Since were playing "holier than thou" with the "I've been here helping for years blah blah blah", At least I took my time to help the guy.

And someone tried to help you by pointing you in the right direction. Did you even bother to check the Control Structures link provided in that link? For the rest of what I quoted, no - I'm not gonna take the bait.

Come down off your high horse and remember what it was like to be learning this stuff, and just want an answer to your question so you could get back into the editor.

Wow... Just... Wow... I'm sorry, but I have to agree with kylania on this one - you take offense way too easily. I can't really see the offensive part even if I try to.

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  

×