Jump to content
Sign in to follow this  
vostov

AI command to launch flare

Recommended Posts

I wanted to make a night mission.

I wanted to add Flares to AIs that do not have NVGs. So in addition to flashlights they would periodically launch flares to keep the sky lit as long as they can.

Back in Operation Flashpoint there was a pretty easy way to do this with a detection trigger.

Is there a better way? I don't even remember how to make the command.

Is there a way to do this now?

Share this post


Link to post
Share on other sites

Easy way.

Place the effects module, Flare down. Select the color you want. Place a trigger down (and set it to blufor detected assuming the player is blufor). Link trigger to flare and there you go. It will pop a flare if blufor is detected inside the trigger radius. I used this approach with delays to have a village being assaulted at night through up flares every so often (lots of triggers and flare modules).

Hard way.

Put an eventHandler on the AI in question. If he spots a player, have him call the script above (but change player to the AI name or 'this') so the flare pops over the head of the soldier that saw you with an offset. This could be cool in that he would keep popping flares all night. You might need to set up a system so he doesn't ripple fire them off. You could also use a variable on the soldier to give him limited ammo.

Das

Share this post


Link to post
Share on other sites

And here is the Arma3 version - just add a west grenadier, add him some flare ammo and name him "test_soldier":

flare_target = "Land_HeliPadEmpty_F" createvehicle [(getposATL test_soldier select 0)+5,(getposATL test_soldier select 1)+5,10];
flare_target setpos [(getposATL test_soldier select 0)+5,(getposATL test_soldier select 1)+5,10];
test_soldier addmagazine ["UGL_FlareGreen_F",10];
test_soldier reveal flare_target;
sleep 1;
test_soldier dotarget flare_target;
sleep 3;
test_soldier fire ["GL_3GL_F","GL_3GL_F","UGL_FlareGreen_F"];

:cool:

You can call this SQF from where you want.

And here is the demo mission:

https://www.dropbox.com/s/i8s5yek2x2xlgxz/flareup.Stratis.zip

For east soldiers to shoot flares you have to look flare ammo and flare muzzle from config viewer.

Regards.Väinämöinen

Share this post


Link to post
Share on other sites

Sorry to bump an old thread but I just cant seem to get this to work with version 1.50. Has something changed in classnames?

Share this post


Link to post
Share on other sites

Sorry to bump an old thread but I just cant seem to get this to work with version 1.50. Has something changed in classnames?

Yeah, classnames changed. Check this: https://community.bistudio.com/wiki/Arma_3_CfgMagazines

 

This works: 

flrObj = "8Rnd_82mm_Mo_Flare_white" createvehicle ((player) modelToWorld [0,100,200]); flrObj setVelocity [0,0,-10];

Share this post


Link to post
Share on other sites

Saw this and maded something for self, add unit to players's group and check his 6's command menu

init.sqf

execVM "ssc.sqf"; 

Files to mission folder.

https://yadi.sk/d/KOAMuSyDj4kTb

 

Move 

_x addaction ["Flare","additionals\sffc.sqf","_this select 0"];

from ssgl.sqf to ssc.sqf , make it:

		_x addaction ["Select grenade launcher","additionals\ssglc.sqf","_x"];
		_x addaction ["Flare","additionals\sffc.sqf","_x"];

Share this post


Link to post
Share on other sites

can you put that script in a demo mission ILLIAS?  not sure what to do?

Sure, wait few mins, need to work for that a bit.

Share this post


Link to post
Share on other sites

When anyone is unarmed it getting action to make self captive, after using, getting to set uncaptive (Skript from my mission, so with it, you can delite it, in over of video i'm shoving how)

When anyone have weapon fron list in ssc.sqf (need to expand, just put there other wepons with underbarrel grenade launcher's from here: https://community.bistudio.com/wiki/Arma_3_CfgWeapons_Weapons (allmx's is there already) (" "," ")) he getting actions to select underbarrel grenade launcher what letting you to chose what ammo to load in, shoot the round (shooting where watching to), flare (targetting air (how you can see in video working with any round exact flares, have no even think on idea why, if you'll know how to fix this, pleeeease tell me)).

All actons acsseseble trough: select Ai > 6 and manualy on Ai, enjoy.

About quality of video, i'm making mission, not videos

https://youtu.be/7FPfs_JWv2Y

Share this post


Link to post
Share on other sites

I am following this thread with interest, as I have some plans to use what little knowledge I have to set up radio triggers that activate flares, well, arrays of flares in the sky. Radio alpha for a corridor of flares 3 across, and 5 in front of me (for when advancing)... radio bravo for a cluster directly above my head (for when defending positions etc).

I can do this easy enough manually I think, but all the flares drop down together in total formation... looks a bit naff really. I know how to change the xyz values for position and velocity, but i dont want to change each one manually.

So my question ... how can i (or can I) randomise (within a set range) the xyz values for position and for velocity?

Thanks
RM

 

 

##~~EDIT~~##

 

 

The above ^^ might be a bit of a ramble, so this is what I'm on about. I can figure out how to activate flares, using a radio trigger set to 20-second intervals. What would be great is knowing how to randomise the x y and z coordinates so that the flares drop all around you :)

 

 

I know this isn't specifically related to the OP question, so apologies for changing the direction of the thread slightly.

Share this post


Link to post
Share on other sites

https://community.bistudio.com/wiki/BIS_fnc_randomNum That's what you are looking for. It chooses a number between the first entry of the array and the seconds one.

 

Example:

[150,300] call BIS_fnc_randomNum;//Will return a number between 150 and 300 where 150 is the lowest and 300 the highest possible number


--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

Random would also work, however it will always return a number between 0 and the number in the brackets.

 

Example:

random(300); // Will return a number between 0 and 300.

Since you do not want the flares to spawn at Z = 0 you would need to do some extra calculations.

_zPos = 150 + random (150); 

Whether you use the function or the command is up to you ;)

Share this post


Link to post
Share on other sites

@mamasan8 - thanks for this, Banjo does good vids, I have learned something here :)

 

@R3vo - thank you so much, I will give that a go tonight mate. Really appreciated :)

Share this post


Link to post
Share on other sites

Why cannot I force another unit (not player) to fire? Tried that:

_void = [] spawn {
    MyUnit selectWeapon "rhs_weap_rsp30_red";
    sleep 5;
    MyUnit fire ["rhs_weap_rsp30_red", "rhs_weap_rsp30_red", "rhs_mag_rsp30_red"];
    hint "Flare!";
}
Alternatively, as this is Arma 3:

    MyUnit forceWeaponFire ["rhs_weap_rsp30_red", "rhs_weap_rsp30_red"];
It works if I myself play as that unit, but does not work when this unit is AI-controlled — all he does is changing his weapon to that flare stick, but he never fires.

I also tried that (with different weapon indices):

    MyUnit action ["UseWeapon", MyUnit, MyUnit, 0];
As far as I remember, this command allowed me to force a tank to fire anywhere it points to (with MyTank, MyTank, MyGunner tuple) in Arma 2, but with an infantry unit it does virtually nothing — even if I myself play as that unit, only some “throw that on the ground†animation is played.

More details on the weapon, as I may be mistaking all those confusing “vehicle — weapon — muzzle — magazine — ammo — mode — etc — etc — etc†configuration names:

  • displayed name: RSP-30 Flare Red / RSP-30 Red flare / Flare Round (Red) (1/1)
  • cfgVehicles: rhs_weapon_rsp30_red
  • cfgWeapons: rhs_weap_rsp30_red
  • cfgMagazines: rhs_mag_rsp30_red
  • cfgAmmo: rhs_40mm_red
  • weapon modes: this
Taking into account that the first snippet has the desired effect when the unit is controlled by player, I assume that I guessed the fire command parameters correctly.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×