Kydoimos 916 Posted July 3, 2013 Okay, okay, I know this has been covered a lot - but all the threads I could find are very old or do not directly relate to Arma3. I have had a good search and have found a few scripts - but none of them appear to work very well. The best I could do is spawn a flare in the air. However, in the showcase for the night mission, I have seen the AI actually launch flares upon detecting the enemy which travel from the ground up. They have fired them into the air themselves. Does anybody know the code for this? I guess it's something that has to be called. If there's something in a thread somewhere (that works properly) please let me know! Share this post Link to post Share on other sites
laverniusregalis 10 Posted July 3, 2013 I also want to know. Only thing I can figure is someone would have to dePBO the mission and take a look at it... Share this post Link to post Share on other sites
jw custom 56 Posted July 3, 2013 The below function is from the "showcase night" mission. As you can see it uses createVehicle to create the flare so the AI does not actually fire the flare themself. In the ArmA 2 editing forum theres a AI flare script that actually does make AI use flares, i might need some editing though! /* Fire a flare up in the sky Start: The start position of the flare - (ARRAY) End: The end position of the flare - (ARRAY) Horizontal Speed: The added horizontal speed to the flare - (NUMBER) Vertical Speed: The added vertical speed to the flare - (NUMBER) Class: The flare class - (STRING) */ //Params private ["_start", "_end", "_horizontalSpeed", "_verticalSpeed"]; _start = [_this, 0, [0,0,0], [[]]] call BIS_fnc_param; _end = [_this, 1, [0,0,0], [[]]] call BIS_fnc_param; _horizontalSpeed = [_this, 2, 5, [0]] call BIS_fnc_param; _verticalSpeed = [_this, 3, 30, [0]] call BIS_fnc_param; //The flare class name private "_class"; _class = [ "F_40mm_Cir", "F_40mm_Green", "F_40mm_Red", "F_40mm_White", "F_40mm_Yellow" ] call BIS_fnc_selectRandom; //The moving direction of the flare private "_direction"; _direction = [_start, _end] call BIS_fnc_dirTo; //The flare private "_flare"; _flare = _class createVehicle _start; //Add motion _flare setVelocity [ sin _direction * _horizontalSpeed, cos _direction * _horizontalSpeed, _verticalSpeed ]; //Flare weapon firing sound _flare say3D "SN_Flare_Weapon_Fired"; //Flare sounds _flare spawn { sleep 0.5; //The sound of the flare starting to burn _this say3D "SN_Flare_Fired_4"; sleep 1; //The flare burning loop sound while { !isNull _this } do { _this say3D "SN_Flare_Loop"; sleep 4; }; //Log "Flare stopped burning!" call BIS_fnc_log; }; //Log ["Flare %1 (%2) fired! Start: %3 - End: %4 - Direction: %5 - Horizontal Speed: %6 - Vertical Speed: %7", _class, _flare, _start, _end, _direction, _horizontalSpeed, _verticalSpeed] call BIS_fnc_logFormat; //Return value _flare; Share this post Link to post Share on other sites
Kydoimos 916 Posted July 5, 2013 Okay thanks, that's great. Can anyone help with editing the above? And where can I get the sound effects from? I have a dePBO tool, but I can't find the file to dePBO... be fantastic to get a nice, easy, and effective script going! Share this post Link to post Share on other sites
Johnson11B2P 3 Posted July 5, 2013 (edited) Start: The start position of the flare - (ARRAY) End: The end position of the flare - (ARRAY) Horizontal Speed: The added horizontal speed to the flare - (NUMBER) Vertical Speed: The added vertical speed to the flare - (NUMBER) Class: The flare class - (STRING) The first two parameters is an array and so position in ARMA is either 2D or 3D and it uses an array. The third & four parameter needs a number so any regular number will do. The last parameter needs the class of the flare you want in quotation marks like this "flareClassName". [[6482.58,4782.85],[6382.58,4782.85],2,15,"F_40mm_Yellow"] All the values I put in are arbitrary, you need to edit those values yourself now what would help is the name of the function otherwise you can't call it. Edited July 5, 2013 by Johnson11B2P typo Share this post Link to post Share on other sites
Kydoimos 916 Posted July 5, 2013 Ah, so we're lacking the function name? Share this post Link to post Share on other sites
kylania 568 Posted July 5, 2013 That script doesn't make AI use flares, it simulates AI using flares. Share this post Link to post Share on other sites
Kydoimos 916 Posted July 5, 2013 Mmm, is that the best we can get thus far? Share this post Link to post Share on other sites
f2k sel 164 Posted July 6, 2013 placed on a radio triggers on act unit dotarget targ;null=[] spawn {sleep 5;gamelogic action ["useweapon",unit,unit,5];} Targ was an object placed in the air (helpers usertextur1m) works.(maybe a playmove action would be better) It seems to need a long sleep before it will target an object. I removed all other ammo for testing other wise it fires grenades if it has them. Share this post Link to post Share on other sites
Kydoimos 916 Posted July 6, 2013 Brilliant - well done, I'll try that! Share this post Link to post Share on other sites
EL_LEJI 13 Posted July 7, 2013 Someone could explain it better I can not make it work. The showcase night function I would like to put a trigger so that when a unit enters the zone, the flares are triggered Thanks in advance Share this post Link to post Share on other sites
Kydoimos 916 Posted July 7, 2013 Does anyone know if there's a sound effect for the flare when AI fire them? Haven't had a chance to test it yet - but I remember on the showcase there's a definite 'sizzling' sound which sounds great and really adds to immersion. Share this post Link to post Share on other sites
f2k sel 164 Posted July 7, 2013 (edited) If your simulating launching a flare the sound would be playsound3d ["a3\sounds_f\weapons\Grenades\ugl_shot_4.wss",unitname]; I haven played any missions so I'm not sure what the actual sound your looking for is. this sounds like it may be close playsound3d ["a3\sounds_f\sfx\special_sfx\sparkles_wreck_4_loop.wss",unitname]; Edited July 7, 2013 by F2k Sel Share this post Link to post Share on other sites
Kydoimos 916 Posted September 18, 2013 Sorry to drag up an old thread, but I can't get the AI to FIRE a flare. I've made sure they're equipped with one, obviously. And F2K's code doesn't seem to work. I don't want the flare to appear in the sky, I want the AI to actually fire it. I managed to get them firing smoke shells, but not the flares! Any help would, as always, be greatly appreciated! Share this post Link to post Share on other sites
cobra4v320 27 Posted September 18, 2013 (edited) 0 = [unitName, 4] execVM "fireFlare.sqf" // this unit will fire 4 flares East and GUER Muzzle = EGLM West Muzzle = GL_3GL_F _unit = _this select 0; _flareCount = if (count _this > 1) then {_this select 1} else {1}; _count = 0; _muzzle = if (side _unit == WEST) then {"GL_3GL_F"} else {"EGLM"}; _unit selectWeapon _muzzle; _target = "Zombie_PopUp_Moving_90deg_F" createVehicle (getPos _unit); _target setPos [(getPos _unit select 0) - random 50 + random 50 , (getPos _unit select 1) - random 50 + random 50 , 150 + random 50]; _unit doWatch _target; sleep 3; _unit doTarget _target; sleep 6; while {_count < _flareCount} do { _unit fire _muzzle; _target setPos [(getPos _unit select 0) - random 50 + random 50 , (getPos _unit select 1) - random 50 + random 50 , 150 + random 50]; _count = _count + 1; sleep (random 15); }; _unit doWatch objNull; deleteVehicle _target; If you dont want a zombie target floating in the air you will need to find something smaller. Invisible helicopter pad didnt work for me either. The sleeps give the unit time to aim up into the air and it didnt work without doWatch and doTarget combined. Edited September 18, 2013 by cobra4v320 Share this post Link to post Share on other sites
Kydoimos 916 Posted September 19, 2013 Thanks Cobra - it does work! Lovely. I hope BI will release a proper flare gun at some point, though. That the AI will use properly. Share this post Link to post Share on other sites
sprite2712 10 Posted November 14, 2013 Hi all, found an easy way to do this. give it a go and let me know how you get on. 1. open the editor. 2. place a blufor unit set as player. 3. place a blufor ai unit name it unit1. 4. in unit1 initialization box paste: removeallweapons this; removeallassigneditems this; this addweapon "arifle_MX_GL_F"; this addmagazine "UGL_FlareWhite_F"; this addmagazine "UGL_FlareWhite_F"; this addmagazine "UGL_FlareWhite_F"; this addmagazine "UGL_FlareWhite_F"; this addmagazine "UGL_FlareWhite_F"; this will give the ai unit MX 6.5mm assault rifle with a grenade launcher and 5 white 40mm flares. 5. place a move waypoint for the ai unit to move to. 6. Place a trigger, set radius to 10 x 10 to make a circle, set activation to blufor, pressent , once, in condition box type unit1 in thislist; in OnAct box type unit1 fire ["GL_3GL_F"]; Place the trigger on top of the move waypoint. The direction the ai unit runs to his waypoint should be the direction the flare goes in. click preview. give it a try any questions let me know and ill try and help out. Share this post Link to post Share on other sites
solrac24 0 Posted June 13, 2020 I know this is an old thread but I think I have the perfect solution to this problem of getting AI units to fire flares. Place an OpFor Grenadier on a map and edit his loadout to add flares to his vest, give the grenadier a unitname in the Object Init Variable Name field. Place the BluFor invisible soldier from CBA as a target for the AI Grenadier unit to point at and give it the name "target" in the Object Init Variable Name field. Untick the Enable Simulation and Enable Damage boxes in the Object Special States field. Set the invisible soldier at the height and distance so that the AI Grenadier soldier can point at. Place a trigger and set the On Activation field with [] execVM "fireFlare.sqf", set the condition to true (just for testing) Place in the mission folder the following script named fireFlare.sqf :- unitname setUnitPos "UP"; unitname setCombatMode "BLUE"; // stops the Grenadier from firing bullets at the invisible soldier. sleep 2; target enableSimulation true; // the Grenadier can now target the invisible soldier. unitname doTarget target; sleep 6; unitname fire ["GP25Muzzle", "", "CUP_IlumFlareWhite_GP25_M"]; // I used CUP units and CUP flares ... note the second parameter MUST be empty to work. target enableSimulation false; unitname disableAI "autoTarget"; // the Grenadier will stop pointing at the invisible soldier. sleep 4; unitname setCombatMode "YELLOW"; // the Grenadier is now free to use his weapon and grenades to engage any other enemy units. unitname setUnitPos "AUTO"; Share this post Link to post Share on other sites