Hit_Sqd_Maximus 0 Posted April 20, 2003 I was wondering if there is a way to get the m2 machine gun to shoot at something just for an effect? I made a map were you paradrop in and you are surrounded by enemies all over the place at night and I want it to seem like there was a lot more units that droped than there really was so you can hear small firefights far off in the distance, is there any way I could get the m2 to shoot at something continuously till it ran out of ammo? maybe not shoot at full auto..... just about 5 rounds every once in a while. Share this post Link to post Share on other sites
edc 0 Posted April 20, 2003 Here's a script that should do it. Â Name the M2 that you want to be shooting m2. Â Then copy the text below into a file in the mission folder. Â Name it something like m2_fire.sqs(must be have sqs extension). Â Then in a trigger w/ that will be activated when you want the firing to start put [] exec "scriptname.sqs" with the quotes. </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE"> #Top m2 fire "browning"; ~ 0.2 m2 fire "browning"; ~ 0.2 m2 fire "browning"; ~ 0.2 m2 fire "browning"; ~ 0.2 m2 fire "browning"; ~random 9 goto "top" <span id='postcolor'> Share this post Link to post Share on other sites
Hit_Sqd_Maximus 0 Posted April 20, 2003 Thanks What if I want more than one m2 to shoot? Say M2_1 and M2_2, m2_3 exc Share this post Link to post Share on other sites
edc 0 Posted April 20, 2003 Ok, us this code. Â Instead of putting [] exec "scriptname.sqs" put this: [name of m2] exec "scriptname.sqs" in the on activation field. Â Just replace the name of m2 w/ the name of one of the m2's that you want to fire. Â Then copy and paste for all the m2's. Â In each one you obviously need to change the name in the [ ]'s to the name of another m2. </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _m2=_this select 0; #Top _m2 fire "browning"; ~ 0.2 _m2 fire "browning"; ~ 0.2 _m2 fire "browning"; ~ 0.2 _m2 fire "browning"; ~ 0.2 _m2 fire "browning"; ~random 9 goto "top" <span id='postcolor'> Share this post Link to post Share on other sites
Hit_Sqd_Maximus 0 Posted April 20, 2003 Nevermind, it works w/ the M2 but not the machinegun I was using Share this post Link to post Share on other sites
edc 0 Posted April 20, 2003 yeah I did. Do you mean the first one I posted? Describe what you did. Share this post Link to post Share on other sites
Hit_Sqd_Maximus 0 Posted April 20, 2003 Heh, sorry to bug you again, I got the 2nd script to work... but how do I get it to shoot into the air? Right now it is shooting level but the ground is hilly were the MG is. Share this post Link to post Share on other sites
Polishdude 0 Posted April 20, 2003 Easy way is just to set up a trigger of AK-74 firing in disance or expolsions or such. Edit: Also if you like it to be longer set up a trigger sound ambience 0f AK74, set time 2 minutes or more If you don't understand this reply I'l go play ofp and figure it out Share this post Link to post Share on other sites
Hit_Sqd_Maximus 0 Posted April 21, 2003 Well, it doesnt sound right to have AK47's when it is the wrong timeline, thats why I wanted some Machineguns to fire. but how can I get the script to stop when the gunner is dead? Share this post Link to post Share on other sites
edc 0 Posted April 21, 2003 If the gunner of the M2 is dead, then I don't think the M2 will fire. There has to be somebody in it I believe. Share this post Link to post Share on other sites
Hit_Sqd_Maximus 0 Posted April 21, 2003 Yea, I killed one and started shooting at some enemies and I couldnt control when it fired or not. Share this post Link to post Share on other sites
ralphwiggum 6 Posted April 21, 2003 try this. (not tested. don't fire at me) </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _m2=_this select 0; _gm2 = gunner _m2 #Top ?(!alive _gm2):goto "gdead" _m2 fire "browning"; ~ 0.2 _m2 fire "browning"; ~ 0.2 _m2 fire "browning"; ~ 0.2 _m2 fire "browning"; ~ 0.2 _m2 fire "browning"; ~random 9 goto "top" #gdead exit <span id='postcolor'> Share this post Link to post Share on other sites
Hit_Sqd_Maximus 0 Posted April 22, 2003 It didnt work Share this post Link to post Share on other sites
sanctuary 19 Posted April 22, 2003 Something that will work but is not very good , because it is only bullet by bullet and not a realistic full auto you will need you , a M2 machinegunner and 3 triggers The test -Create West Soldier : You -Create near a West M2 Machinegunner, name it m2 -De-group you and the AI -Create a trigger , Activation West , select Once , Â Min,Max,Averag to .5 (if you let it to 0 , it will shoot opne time and no more after) at the line On Activation , put </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">m2 fire "browning"; m2 fire "browning"; m2 fire "browning"; GO=true<span id='postcolor'> -Create a 2nd trigger , nothing to Activation , select Repeated , Min,Max and Average to .5 too at the line Condition , instead of this , type </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">GO <span id='postcolor'> at the line On Activation , put </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">m2 fire "browning"; m2 fire "browning"; m2 fire "browning"; GO=false; GO2=true<span id='postcolor'> -Create a 3rd and last trigger , nothing to Activation , select Repeated , Min,Max and Average to .5 too at the line Condition , instead of this type </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">GO2<span id='postcolor'> at the line On Activation , put </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">m2 fire "browning"; m2 fire "browning"; m2 fire "browning"; GO2=false; GO=true<span id='postcolor'> Test it ingame, you will see the M2 machinegunner firing at nothing until he has no ammo (with another trigger and min,max,average to a specific number and the good On Activation line, you can give him new M2 magazines to prevent him to stop firing) Now , play with the value in min, max, average to have a better result It works , it is not the most realistic way but that is better than nothing , someone will certainly post a better code or script to execute that Share this post Link to post Share on other sites
seedhe 0 Posted April 22, 2003 You could get the M2 to target and fire at a barrel, it will continue firing until the damage == 1. So by setting the damage back to zero you can keep it firing. I messed around with something like this a while back but dont recall the exact script you could try something like-</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">_m2 = _this select 0 _barrel = _this select 1 _m2 reveal _barrel #Loop ? !alive _m2 : goto "Exit" _m2 doFire _barrel _barrel setdammage 0 ~2 goto "Loop" #Exit deletevehicle _barrel exit <span id='postcolor'> To get the m2 firing in the air setPos the barrel in the loop too otherwise it'll fall out of the sky. The skill of the m2 will effect the rate of fire - high skill  will give you constant fire. Share this post Link to post Share on other sites
Balschoiw 0 Posted April 22, 2003 There are some invisible targets. You can setpos them whereever you like and the enemies will engage them at once. Maybe helpfull for you. Gimme a sign if you need them. Share this post Link to post Share on other sites
Chris Death 0 Posted April 22, 2003 Or you could try this script (originally created by MI_Fred to simulate various artellery salvos, modified by me to simulate MG firing at nothing). :note - this script doesn't require any object to target onto, also there are some hints included which do return a reason, why (if) the mg can't fire. You can even use it with the player mounted in the mg. </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">;==>MG_salves.sqs<== ;**credits to MI_Fred @OFPEC forum** ;**original script by MI_Fred ;**original script name below** ;==MIF_FieldGunArty v.0.5==; ;**additional changes by Chris Death ;**altered the script to be used by a single machinegun ;[machinegun,rounds_to_fire] exec "MG_salves.sqs" _gun1 = _this select 0 _g = 0 _rmax = _this select 1 _rcount = 0 {_x setCombatMode "RED"} forEach _gnrs ;--the aimpoint, 100 meters in front of the gun, 30 meters above _aimpoint = [(getPos _gun1 select 0)+100*(sin(getDir _gun1)),(getPos _gun1 select 1)+100*(cos(getDir _gun1)),(getPos _gun1 select 2)+30] _ax = _aimpoint select 0 _ay = _aimpoint select 1 _az = _aimpoint select 2 ;--makes machinegun watch a random point near the aimpoint _gun1 doWatch [(_ax)-5+(random 5*2),(_ay)-5+(random 5*2),(_az)-2+(random 2*2)] ~3 ;--makes the vehicles fire their weapons #fireloop ;gunner-check ?!(alive gunner _gun1) : goto "emptygun" ;ammo-check ? _gun1 ammo (weapons _gun1 select 0) < 1 : goto "lowammo" ;gun-functionality-check ? (getDammage _gun1) >= 1 : goto "dammaged" _gun1 doWatch [(_ax)-5+(random 5*2),(_ay)-5+(random 5*2),(_az)-2+(random 2*2)] ~0.05 _gun1 fire (weapons (_gun1) select 0) ~0.05 _rcount = _rcount + 1 ? _rcount < _rmax : goto "fireloop" goto "endseq" #emptygun hint "no gunner in mg" goto "endseq" #lowammo hint "mg out of ammo" goto "endseq" #dammaged hint "mg doesn't work properly anymore" #endseq ;enable hint for end of script by deleting the; ;hint "end of firing" exit <span id='postcolor'> ~S~ CD Share this post Link to post Share on other sites
WhoCares 0 Posted April 22, 2003 If it is just for the sound of war, you could just play one of the original sound samples that does just that, with shooting and explosions close and far. BIS used it in some of the missions as well. I think you can activate it with a trigger, but I guess, somebody else can tell you more about this. Share this post Link to post Share on other sites
Ruskiesrule 0 Posted April 22, 2003 try the ofp cookbook at the CIA, they have a real good one that i can think of a hundered of uses for. http://www.ciahome.net/modules....e=index I beleave that is correct Its in the scripts section, its called M2 supporting fire or somthing alone those lines. Share this post Link to post Share on other sites
Hit_Sqd_Maximus 0 Posted April 23, 2003 </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (DV Chris Death @ April 22 2003,12:50)</td></tr><tr><td id="QUOTE">Or you could try this script (originally created by MI_Fred to simulate various artellery salvos, modified by me to simulate MG firing at nothing). :note - this script doesn't require any object to target onto, also there are some hints included which do return a reason, why (if) the mg can't fire. You can even use it with the player mounted in the mg. </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">;==>MG_salves.sqs<== ;**credits to MI_Fred @OFPEC forum** ;**original script by MI_Fred ;**original script name below** ;==MIF_FieldGunArty v.0.5==; ;**additional changes by Chris Death ;**altered the script to be used by a single machinegun ;[machinegun,rounds_to_fire] exec "MG_salves.sqs" _gun1 = _this select 0 _g = 0 _rmax = _this select 1 _rcount = 0 {_x setCombatMode "RED"} forEach _gnrs ;--the aimpoint, 100 meters in front of the gun, 30 meters above _aimpoint = [(getPos _gun1 select 0)+100*(sin(getDir _gun1)),(getPos _gun1 select 1)+100*(cos(getDir _gun1)),(getPos _gun1 select 2)+30] _ax = _aimpoint select 0 _ay = _aimpoint select 1 _az = _aimpoint select 2 ;--makes machinegun watch a random point near the aimpoint _gun1 doWatch [(_ax)-5+(random 5*2),(_ay)-5+(random 5*2),(_az)-2+(random 2*2)] ~3 ;--makes the vehicles fire their weapons #fireloop ;gunner-check ?!(alive gunner _gun1) : goto "emptygun" ;ammo-check ? _gun1 ammo (weapons _gun1 select 0) < 1 : goto "lowammo" ;gun-functionality-check ? (getDammage _gun1) >= 1 : goto "dammaged" _gun1 doWatch [(_ax)-5+(random 5*2),(_ay)-5+(random 5*2),(_az)-2+(random 2*2)] ~0.05 _gun1 fire (weapons (_gun1) select 0) ~0.05 _rcount = _rcount + 1 ? _rcount < _rmax : goto "fireloop" goto "endseq" #emptygun hint "no gunner in mg" goto "endseq" #lowammo hint "mg out of ammo" goto "endseq" #dammaged hint "mg doesn't work properly anymore" #endseq ;enable hint for end of script by deleting the; ;hint "end of firing" exit <span id='postcolor'> ~S~ CD<span id='postcolor'> Thanks, but how do I use this? Do I just put an exec command in the initialization text box that points to that script? Share this post Link to post Share on other sites
Chris Death 0 Posted April 23, 2003 </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">Thanks, but how do I use this? Do I just put an exec command in the initialization text box that points to that script?<span id='postcolor'> As described at the top of the script: e.g: [mg1,200] exec "MG_salves.sqs" This will make the mg called: mg1 let fire 200 rounds. You can use this in a trigger's or waypoint's onActivation field or wherever you want to execute a command at the given time you want ~S~ CD Share this post Link to post Share on other sites
Hit_Sqd_Maximus 0 Posted April 24, 2003 Ok, I got that script to work. But he only fires a few rounds and then stops, and never fires again. I want him to fire about 5 - 8 rounds between every 5 and 20 seconds. Share this post Link to post Share on other sites
Chris Death 0 Posted April 24, 2003 </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE">Ok, I got that script to work. But he only fires a few rounds and then stops, and never fires again. I want him to fire about 5 - 8 rounds between every 5 and 20 seconds.<span id='postcolor'> Well, in case of this script you need to consider 1 round as 1 bullet. So if you want him to shoot let's say 60 bullets, you need to run it by [mg_name,60] exec "MG_salves.sqs" The 5-8 rounds every 20 secs for, i'll modify the script for you later at the day. btw - i found an older line in the script, which was used with the artellery version of the script. It doesn't make sense in this version of the script: replace following line in the script: </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">{_x setCombatMode "RED"} forEach _gnrs<span id='postcolor'> by following line: </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">_gun1 setCombatMode "RED"<span id='postcolor'> ~S~ CD Share this post Link to post Share on other sites
Chris Death 0 Posted April 25, 2003 Well, here's the modified script like you want it to use: [machinegun,rounds_to_fire,bullets_per_round,delay_between_rounds] exec "MG_salves.sqs" [mg1,5,25] exec "MG_salves.sqs" will make mg1 fire 5 times 25 bullets </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">;==>MG_salves.sqs<== ;**credits to MI_Fred @OFPEC forum** ;**original script by MI_Fred ;**original script name below** ;==MIF_FieldGunArty v.0.5==; ;**additional changes by Chris Death ;**altered the script to be used by a single machinegun _gun1 = _this select 0 _maxbullets = _this select 2 _delay = 20 - (random 15) _g = 0 _rmax = _this select 1 _rcount = 0 _bullc = 0 _gun1 setCombatMode "RED" ;--the aimpoint, 100 meters in front of the gun, 30 meters above _aimpoint = [(getPos _gun1 select 0)+100*(sin(getDir _gun1)),(getPos _gun1 select 1)+100*(cos(getDir _gun1)),(getPos _gun1 select 2)+30] _ax = _aimpoint select 0 _ay = _aimpoint select 1 _az = _aimpoint select 2 ;--makes machinegun watch a random point near the aimpoint _gun1 doWatch [(_ax)-5+(random 5*2),(_ay)-5+(random 5*2),(_az)-2+(random 2*2)] ~3 ;--makes the vehicles fire their weapons #fireloop ;gunner-check ?!(alive gunner _gun1) : goto "emptygun" ;ammo-check ? _gun1 ammo (weapons _gun1 select 0) < 1 : goto "lowammo" ;gun-functionality-check ? (getDammage _gun1) >= 1 : goto "dammaged" _gun1 doWatch [(_ax)-5+(random 5*2),(_ay)-5+(random 5*2),(_az)-2+(random 2*2)] ~0.05 _gun1 fire (weapons (_gun1) select 0) ~0.05 _bullc = _bullc + 1 ? _bullc < _maxbullets : goto "fireloop" goto "roundcheck" #emptygun hint "no gunner in mg" goto "endseq" #lowammo hint "mg out of ammo" goto "endseq" #dammaged hint "mg doesn't work properly anymore" goto "endseq" #roundcheck ~_delay _bullc = 0 _rcount = _rcount + 1 ? _rcount < _rmax : goto "fireloop" #endseq ;enable hint for end of script by deleting the; ;hint "end of firing" exit <span id='postcolor'> OK, this should do the job for you now  ~S~ CD Share this post Link to post Share on other sites