Now, getting the helicopter to shoot
isn't too hard. I don't know why you want to use it on friendlies. It would be considered friendly fire but if that's what you want, then you got it. I guess your saying an enemy helicopter. I dont usually script for enemies so it's a habit of wondering why you want this. It's the same for the enemies, or I should say vise versa. However, what I did was, I used a script_origin as the target. I put it near the enemy, or the friendlies in your case. I don't remember clearly, but you can use it on the actors, but to me, I had some errors as in the actors are undefined. I don't have time to test it now, since I don't have time, but you can experiment with it. For now, just use the script_origin or script_struct if you prefer.
Ok, I assume you got the basic done. Now, make sure that on one of the script_struct that you want your helicopter to stop at, make sure you give it a targetname.
Then, name your script_origin that is the target and place it by the enemies. Don't worry, the weapon that the heli uses will hit the enemy.
Now, that's it in radiant, pretty much, you can also go ahead a give a targetname for the enemies or friendlies. Now the script.
Code:
cobrashoothere = getent("cobrashoothere","targetname"); //the target
cobraattack = getstruct("shoot_here","script_noteworthy"); //your script_struct that you want the heli to stop at.
cobraattack waittill( "trigger", helicop ); /waittill the heli reaches that script_struct. helicop is what I named my helicopter, use what you have named.
helicop vehicle_detachfrompath(); // detach it from the path so it can stop and shoot
wait 0.75; //give it some time
helicop thread fire_missile( "mi28_seeker", 10, cobrashoothere, 3 ); // now this is from the _helicopter_globals gsc file. Check out the file for more helicopter actions.
//mi28_seeker is the weapon name, you can find out other weapons in the gsc file. 10, if I can remember is how many times or how many bullets you want it fire. Cobrashoothere is the target. 3 would be the delay between shots. It tells you what all the variables/functions are in the gsc file.
then when you are done, use another wait if you like to get it in order. Sometimes, it might not response properly.
wait 5;
helicop vehicle_resumepathvehicle(); // continue flying.
Now, you can use
Code:
helicop thread mgon(); //this uses the machine gun. If I can remember machine gun is the only one that you don't need to script. It fires by itself at any enemy it sees. You can just add this without all those codes, if you just want the machine gun.
Make sure you have all the other scripts ready. Like spawning the vehicles, activating the triggers. Remember to use a wait before you spawn the helicopter or any vehicles for that matter.
If you need more help and requires the whole script for this scene, I will be more than glad to share it. This scene was in the part 3 playtest, the one where Colonel Markens dies. I know I did not release the source file but it would be a good idea to see what actually happens. And ask away if you need anything.
Enjoy!
edited on Dec. 13, 2010 06:46 pm by sam_fisher3000
Make sure you add this at the top
#include maps\_helicopter_globals;
with all the other stuff.
edited on Dec. 13, 2010 06:47 pm by sam_fisher3000
edited on Dec. 13, 2010 06:48 pm by sam_fisher3000
credit goes to voidsource who helped me on this.
edited on Dec. 13, 2010 06:49 pm by sam_fisher3000
isn't too hard, sorry typo. It
isn't too hard.