zodd 14 Posted December 12, 2011 Gday all, I am working on a fire support script, all I need now is the beaten zone (area of fire as opposed to point fire) Currently it works well, firing at a target (at the moment i use either a small empty object or a game logic location - either works fine) I have tried several different ways to spread the firing area however hit a wall each time (I am sure that all/most of these methods will work - its just probably small syntax errors) _g1 and _g2 are the guns, _tgt is the target (aiming to be middle of the target AREA) Option 1 - Adding coords Using either included random numbers or input when calling the script, adding a random amount to the _tgt posn so eg. _fireat = _tgt + [random 10, random 10, 0]; _g1 doWatch _fireat; (Followed by firing script - fully functional) Result - Stops script Option 2 - Using BIS_fnc_relPos; Same variables with: _bzm = beatenzone size minimum _bzx = beatenzone extra to be added _distance = _bzm + (random _bzx) ; _direction = random 360; _fireat = [_tgt, _distance, _direction] call BIS_fnc_relPos; _g1 doWatch _fireat; (Followed by firing script - fully functional) Result - Script works however the gun just fires straight ahead Option 3 (desperate) - Moving the target around between each burst This was a last resort (And STILL didnt work!) Same kind of stuff as above but using : _tgt getposn, adding coords and _tgt setPosition _newaim; Result - no joy (deleted that script - cant remember result) Option 4 - No idea if this is possible but will solve it instantly... Is it possible to modify the accuracy of AI gunners? So instead of all rounds hitting the point target, the rounds will be in a wide area around them? Input MUCH appreciated... Time to take a break now! Share this post Link to post Share on other sites
demonized 20 Posted December 12, 2011 use artilery module and BIS_ARTY_F_SetDispersion Share this post Link to post Share on other sites
zodd 14 Posted December 12, 2011 Would that work with direct fire weapons though? (M2 MG tripod/MG bunker)? If so - ARTY module, synched with the guns then use the setdispersion as part of the script? Share this post Link to post Share on other sites
demonized 20 Posted December 12, 2011 Would that work with direct fire weapons though? (M2 MG tripod/MG bunker)?If so - ARTY module, synched with the guns then use the setdispersion as part of the script? No, i dont think so, i just asumed it to be artillery you meant, mg nests makes more sence now. Afaik arty module is for arty only, though ive never tested with mg etc... Share this post Link to post Share on other sites
zodd 14 Posted December 12, 2011 No luck - What I have done for now as part of the script is set accuracy for the weapons passed in to it to 0.1... works pretty well... Is there any way of finding out what an individuals accuracy is though? (So i can save it before executing the script -- return accuracy at the end of it?) Share this post Link to post Share on other sites
f2k sel 164 Posted December 12, 2011 whatever = unitname skill "aimingAccuracy" will return the Accuracy. Share this post Link to post Share on other sites
ceeeb 147 Posted December 12, 2011 Your array addition looks like it would cause a problem. _fireat = _tgt + [random 10, random 10, 0]; //the result of this is no longer a location, but a six element array try something like: _fireat = [(_tgt select 0) + random 10, (_tgt select 1) + random 10, 0]; Share this post Link to post Share on other sites
f2k sel 164 Posted December 12, 2011 (edited) Without using accuracy you could do it this way. update May be no, for some reason it still won't fire around the object, just randomly at a point in front of the object. The script is fine it's because the firing unit is adjusting his weapon to the target, it's only looking at it and not aiming. // // dfsw.sqf // // BASIC DIRECT FIRE SUPPORT WEAPON SCRIPT // DESIGNED FOR 2 GUNS AT ONE TARGET // GUN 2 FIRING OFFSET TO GUN 1 // DOES NOT INCORPORATE BEATEN ZONE // // BY ZODD - 10 DEC 11 // //Inspired by INKO SFS (http://forums.bistudio.com/showthread.php?t=83797) //And F2KSel (http://forums.bistudio.com/showthread.php?t=127189) // // ---USAGE--- // CALLED BY: // firemsn1 =[gun1, gun2, number of bursts, length of burst in rounds, time between main gun bursts, target,spread] execVM "dfsw.sqf"; // firemsn1 =[gun1, gun2, 12,4,2, target,100] execVM "dfsw.sqf"; _g1 = _this select 0; _g2 = _this select 1; _bursts = _this select 2; _rounds = _this select 3; _lulltime = _this select 4; _actual = _this select 5; _spread = _this select 6; _tgt = [getPos _actual, (random _spread)-_spread/2, random 360] call BIS_fnc_relPos; //START _g1 dowatch _tgt; //ASSIGN TARGET TO BOTH GUNS _g2 dowatch _tgt; sleep 3; //ALLOW TIME TO ALIGN for "_i" from 1 to _bursts do { _tgt = [getPos _actual, (random _spread)-_spread/2, random 360] call BIS_fnc_relPos; _g1 dowatch _tgt; //ASSIGN TARGET TO BOTH GUNS _g2 dowatch _tgt; for "_i" from 0 to _rounds do //FIRE A BURST THE LENGTH OF 'ROUNDS' { sleep 0.1; _g1 action ["useweapon",_g1,_g1 turretunit [0],0]; }; sleep (_lulltime/2); //WAIT HALF THE LULL TIME (SO GUN 2 FIRES OFFSET TO GUN 1) for "_i" from 0 to _rounds do //SAME AGAIN { sleep 0.1; _g2 action ["useweapon",_g2,_g2 turretunit [0],0] }; sleep (_lulltime/2); _g1 setVehicleAmmo 1; //IF YOU DONT WANT UNLIMITED AMMO - COMMENT THESE TWO LINES OUT _g2 setVehicleAmmo 1; Edited December 12, 2011 by F2k Sel Share this post Link to post Share on other sites