gc8 970 Posted October 8, 2018 Hi I made script that makes the artillery fire but if the artillery is too close to the target it wont fire. The inRangeOfArtillery command however always returns true for too near artillery. So my question is, is there way to detect if artillery too close to the target? thx! Share this post Link to post Share on other sites
Harzach 2507 Posted October 8, 2018 5 hours ago, gc8 said: I made script You know what the first question is going to be. 1 Share this post Link to post Share on other sites
gc8 970 Posted October 8, 2018 Just now, Harzach said: You know what the first question is going to be. umm no, any clues? Share this post Link to post Share on other sites
zagor64bz 1225 Posted October 8, 2018 2 minutes ago, gc8 said: umm no, any clues? ..."script"... Share this post Link to post Share on other sites
gc8 970 Posted October 8, 2018 You want to see the script? Share this post Link to post Share on other sites
zagor64bz 1225 Posted October 8, 2018 Just now, gc8 said: You want to see the script? Share this post Link to post Share on other sites
gc8 970 Posted October 8, 2018 Alright it's quite messy though because it's just a rough prototype with infinite ammo for the arty _vehType = typeof arty; _vehConf = configfile >> "CfgVehicles" >> _vehType; _turrets = _vehConf >> "turrets"; //systemchat format["...: %1",_turrets]; mags = []; for "_t" from 0 to (count _turrets - 1) do { _turret = _turrets select _t; _weapons = getArray (_turret >> "weapons"); { _weapName = _x; _weap = configfile >> "cfgWeapons" >> _x; _mags = getArray(_weap >> "magazines"); { _mag = configfile >> "cfgMagazines" >> _x; systemchat format["_mag: %1", _mag]; // mags pushbackunique (getText(_mag >> "ammo")); mags pushbackunique [_weapName,_x]; } foreach _mags; } foreach _weapons; // systemchat format["Tur: %1",getArray (_turret >> "weapons")]; }; getVehicles = { params ["_group"]; private _vehs = []; { if(vehicle _x != _x && alive _x) then { _vehs pushBackUnique (vehicle _x); }; } forEach (units _group); _vehs }; sleep 0.5; if(count mags > 0) then { _wm = mags select 0; _weapName = _wm select 0; _mag = _wm select 1; systemchat format["Firing... %1 %2", _mag, (getMarkerPos "target") inRangeOfArtillery [[arty], _mag] ]; _group = group arty; _vehs = _group call getVehicles; { _x doArtilleryFire [getmarkerpos "target", _mag, 100]; [_x,_weapName] spawn { params ["_v","_weapName"]; while { true } do { sleep 0.1; _v setammo [_weapName,100]; }; }; } foreach _vehs; }; arty is the mlrs placed on the map. 1 1 Share this post Link to post Share on other sites
pierremgi 4739 Posted October 8, 2018 getmarkerpos "target" inRangeOfArtillery [[arty], arty currentMagazineTurret [0]] 2 Share this post Link to post Share on other sites
gc8 970 Posted October 8, 2018 3 minutes ago, pierremgi said: getmarkerpos "target" inRangeOfArtillery [[arty], arty currentMagazineTurret [0]] That seems to work, thanks! But what about different magazines? Unless I'm mistaken the artilleries in arma can fire different kinds of rounds Share this post Link to post Share on other sites
pierremgi 4739 Posted October 8, 2018 No problem. The "currentMagazine" is ... the current used mag. Share this post Link to post Share on other sites
gc8 970 Posted October 8, 2018 2 minutes ago, pierremgi said: No problem. The "currentMagazine" is ... the current used mag. Right, but how do I make the artillery fire specific ammo type then? The whole purpose of my script was to find those different ammo types Share this post Link to post Share on other sites
pierremgi 4739 Posted October 8, 2018 You can use : arty magazinesTurret [0] for the array of magazines. turret [0] is always the gunner (in fine mods also) 2 Share this post Link to post Share on other sites
gc8 970 Posted October 8, 2018 @pierremgi Ok so no need to go config digging thanks But I'm still unable to make the artillery fire at certain range even the inRangeOfArtillery returns true here's my code: getVehicles = { params ["_group"]; private _vehs = []; { if(vehicle _x != _x && alive _x) then { _vehs pushBackUnique (vehicle _x); }; } forEach (units _group); _vehs }; sleep 0.5; _mags = arty magazinesTurret [0]; _mag = selectrandom _mags; systemchat format["Firing... %1 %2", _mag, (getMarkerPos "target") inRangeOfArtillery [[arty], _mag] ]; _group = group arty; _vehs = _group call getVehicles; { _x doArtilleryFire [getmarkerpos "target", _mag, 100]; } foreach _vehs; If I place the artillery further from the target it fires Share this post Link to post Share on other sites
gc8 970 Posted October 8, 2018 wait i forgot something :) Share this post Link to post Share on other sites
gc8 970 Posted October 8, 2018 Ok updated the code but the arty doesn't fire, yet inRangeOfArtillery returns true sleep 0.5; _mags = arty magazinesTurret [0]; _mag = selectrandom _mags; systemchat format["Firing... %1 %2", _mag, (getMarkerPos "target") inRangeOfArtillery [[arty], arty currentMagazineTurret [0]] ]; _group = group arty; _vehs = _group call getVehicles; { _x doArtilleryFire [getmarkerpos "target", _mag, 100]; } foreach _vehs; Share this post Link to post Share on other sites
pierremgi 4739 Posted October 8, 2018 It seems there is a problem with flares (at least on MK6 mortar) You need to fire them closer than the max close range. I don't know why. Not tested, but stay in range of the burst. Example a mortar can't fire more than 8 shells in a burst. Share this post Link to post Share on other sites
gc8 970 Posted October 8, 2018 @pierremgi Hmm in my test mission it's MLRS. and it has only one mag, the rockets Edit: The artillery actually reacts to the fire command but does not fire... Share this post Link to post Share on other sites
pierremgi 4739 Posted October 8, 2018 Your code should work. Verify : _group call getVehicles That doesn't have sense without the getVehicles code. _vehs = vehicles select {group _x == group arty} Share this post Link to post Share on other sites
gc8 970 Posted October 8, 2018 @pierremgi I was actually using the getvehicles just omitted it from the post to save some space :) I've been playing with the artillery code but can't figure it out. Artillery far = fires and inRangeOfArtillery = true Artillery very close = does not fire and inRangeOfArtillery = false Artillery somewhere in the mid range = does not fire but inRangeOfArtillery = true <------ The problem Share this post Link to post Share on other sites
pierremgi 4739 Posted October 8, 2018 I can't reproduce your problem. My 3 MLRS fire what ever the distance if not too close (then inRangeOfArtillery = false also). Do you have more info on map, position of arty, position of marker, used mods...? And perhaps the whole script with your loop for infinite ammo. Sometimes, things must have time to run an animation or an engine macro. Share this post Link to post Share on other sites
gc8 970 Posted October 8, 2018 11 minutes ago, pierremgi said: Do you have more info on map, position of arty, position of marker, used mods...? Malden. I just disabled all mods and it still doesnt work 11 minutes ago, pierremgi said: And perhaps the whole script with your loop for infinite ammo. Sometimes, things must have time to run an animation or an engine macro. Havent used that code anymore Here if you want to test I uploaded the whole test mission: google drive Share this post Link to post Share on other sites
pierremgi 4739 Posted October 8, 2018 That's a kind of 3den entity messing. mission.sqm is very fragile for that kind of engine: artillery, linked objects like support module... Don't ask me why. You just have to move your artillery (3 m left on the road, for example). test it. Then, You can replace it at the former position after that. Worked for me and it's not the first time artillery messes like that. Share this post Link to post Share on other sites
gc8 970 Posted October 9, 2018 12 hours ago, pierremgi said: That's a kind of 3den entity messing. mission.sqm is very fragile for that kind of engine: artillery, linked objects like support module... Don't ask me why. You just have to move your artillery (3 m left on the road, for example). test it. Then, You can replace it at the former position after that. Worked for me and it's not the first time artillery messes like that. So your saying eden placed artillery is causing this bug? Share this post Link to post Share on other sites
pierremgi 4739 Posted October 9, 2018 7 hours ago, gc8 said: So your saying eden placed artillery is causing this bug? Depending on so much things: translated old mission form old 2D editor, lots of modifications adding/erasing modules, scripts calling init field or expression field... That works 95% of time. After that, there are some conditions of manipulation which let you think all is clear but that doesn't work. Make a few alteration: move slightly the artillery (some obstacle in terrain?), the artillery works. Delete/ remake links on support modules, they work again, ungroup/refgroup the vehicles in convoy, the convoy behavior is far better... I used to alter some little things on concerned objects to make it work. Not a solution for bad script but that repairs some macros or FSM sometimes, imho. Share this post Link to post Share on other sites
gc8 970 Posted October 9, 2018 It's also little bit difficult to find a spot for the artillery where it fails to fire. I'm hoping that as long as the artillery is not eden placed or as long as it moves to some location it will fire Share this post Link to post Share on other sites