Jump to content
Wiki

AI drop bomb with onMapSingleClick

Recommended Posts

Hello guys.

 

Is there a possibility to have an AI plane drop bomb on a specific position using onMapSingleClick command?

 

community.bistudio.com/wiki/onMapSingleClick

 

For example, once a trigger is activated, I want the player to be able to call an airstrike / bomb run using this command.

 

It doesn't work well with the modules.

Plus, I can't use the modules to have a napalm run with Unsung asset for example.

 

Thanks

 

Edit:

to do this for example:

 

Share this post


Link to post
Share on other sites

Or at least, simulate a bomb run via the onMapSingleClick command.

 

I mean, create a napalm bomb on the position clicked on the map with the onMapSingleClick command.

Share this post


Link to post
Share on other sites

Not tested:

onMapSingleClick "bomb = 'Bo_GBU12_LGB' createVehicle _pos; onMapSingleClick '';";

This is extremely basic. This won't create the plane fly over or anything else, it instantly creates the explosion where ever you click.

Share this post


Link to post
Share on other sites

Works great, thanks

 

Edit:

 

how to have 2 bombs, let's say 5m away from each other?

Share this post


Link to post
Share on other sites

Try:

onMapSingleClick "bomb = 'Bo_GBU12_LGB' createVehicle _pos; bomb2 = 'Bo_GBU12_LGB' createVehicle (bomb getPos [5, 0]); onMapSingleClick '';";

Might be better on having a function inside there or execVM a script which has all the code. If you plan to do more.

Share this post


Link to post
Share on other sites

Thx, it works well.

 

Edit:

And also, to have them spawn after a few seconds.

 

Thanks

 

 

Share this post


Link to post
Share on other sites

Retyped reply where I suggested using the countdown option in the trigger when I realized you were using the trigger to spawn the option of the bomb run.

 

Apologies :)

Share this post


Link to post
Share on other sites
6 minutes ago, Rich_R said:

Retyped reply where I suggested using the countdown option in the trigger when I realized you were using the trigger to spawn the option of the bomb run.

 

Apologies :)

 

Hum, maybe your answered could be useful.

How would you do it?

 

Use onmapsingleclick command and a trigger to spawn the bombs?

It's interesting, but dunno how to do it.

Share this post


Link to post
Share on other sites
2 hours ago, Wiki said:

Thx, it works well.

 

Edit:

And also, to have them spawn after a few seconds.

 

Thanks

 

 

I recommend you do this:

player onMapSingleClick {_this execVM "bombsAway.sqf";};
// bombsAway.sqf

private _requester = param [0, objNull];

if (isNull _requester) exitWith {};

_requester sideChat format ["Requesting CAS at map grid %1", mapGridPosition _pos];

_bomb = "Bo_GBU12_LGB" createVehicle _pos;
sleep 2;
_bomb2 = 'Bo_GBU12_LGB' createVehicle (_bomb getPos [5, 0]);

onMapSingleClick "";

Not tested!

This way you can put more code in, etc...You can create the jet fly over and simulate the bomb drop using commands, setVelocity, etc...

Not sure if _pos exists still using this alt syntax. You'll have to do some testing.

  • Like 1

Share this post


Link to post
Share on other sites
2 hours ago, HazJ said:

I recommend you do this:


player onMapSingleClick {_this execVM "bombsAway.sqf";};

// bombsAway.sqf

private _requester = param [0, objNull];

if (isNull _requester) exitWith {};

_requester sideChat format ["Requesting CAS at map grid %1", mapGridPosition _pos];

_bomb = "Bo_GBU12_LGB" createVehicle _pos;
sleep 2;
_bomb2 = 'Bo_GBU12_LGB' createVehicle (_bomb getPos [5, 0]);

onMapSingleClick "";

Not tested!

This way you can put more code in, etc...You can create the jet fly over and simulate the bomb drop using commands, setVelocity, etc...

Not sure if _pos exists still using this alt syntax. You'll have to do some testing.

 

Thx for the help, but it is not working.

I think we can't have onmapsingleclick + script behind.

Share this post


Link to post
Share on other sites
2 hours ago, HazJ said:

Not tested!

I'll do some testing when I get chance. It'll be late evening tomorrow (Mon). For now try:

onMapSingleClick "[] spawn {bomb = 'Bo_GBU12_LGB' createVehicle _pos; sleep 2; bomb2 = 'Bo_GBU12_LGB' createVehicle (bomb getPos [5, 0]); onMapSingleClick '';};";

 

Share this post


Link to post
Share on other sites

I knew you didn't test it.

I was just keeping you informed about the test I ran  ;-)

 

I'll try the other one, thx

 

Edit:

nope, not working either.

Share this post


Link to post
Share on other sites

Try:

onMapSingleClick "_this spawn {bomb = 'Bo_GBU12_LGB' createVehicle _pos; sleep 2; bomb2 = 'Bo_GBU12_LGB' createVehicle (bomb getPos [5, 0]); onMapSingleClick '';};";
onMapSingleClick "[_pos] spawn {bomb = 'Bo_GBU12_LGB' createVehicle (_this select 0); sleep 2; bomb2 = 'Bo_GBU12_LGB' createVehicle (bomb getPos [5, 0]); onMapSingleClick '';};";

If this doesn't work then I'll start my game and test myself. Too lazy at the moment! :grinning:

  • Like 1

Share this post


Link to post
Share on other sites

Nah, that's ain't working unfortunately.

Share this post


Link to post
Share on other sites

Edit:

 

gave a try.

Looks nice, but the napalm bomb is not accurate.

 

Also, even if I disallow some munitions, when I open the cas field menu, I can still ask CAS with them.

Share this post


Link to post
Share on other sites

Use this, works perfectly:

https://community.bistudio.com/wiki/BIS_fnc_fireSupportVirtual

It can be adjusted a lot.

 

mapclick = true;
onMapSingleClick "
[_pos,'Bo_GBU12_LGB',15 + (random 25),4 + (random 6),[1,2 + (Random 3)],{},nil,500,50,['mortar1','mortar2','shell1','shell2']] spawn BIS_fnc_fireSupportVirtual;
mapclick = false;
";
waitUntil{!(mapclick)};
onMapSingleClick "";

Not tested.

 

Edit: You must use this bomb class 'Sh_82mm_AMOS', then will be working

  • Thanks 1

Share this post


Link to post
Share on other sites

Just tested, not working.

 

Thx anyway

Share this post


Link to post
Share on other sites
0 = [] spawn { 
mapclick = true; 
 
onMapSingleClick " 
marker_Bomb = createMarkerLocal ['Bomb',_pos]; 
marker_Bomb setMarkerAlphaLocal 1; 
marker_Bomb setMarkerColorLocal 'ColorRed'; 
marker_Bomb setMarkerShapeLocal 'ELLIPSE'; 
marker_Bomb setMarkerBrushLocal 'Solid'; 
marker_Bomb setMarkerSizeLocal [20, 20]; 
 
[ 
        _Pos, 
        'Bo_GBU12_LGB', 
        25, 
        [2,10], 
        [1,5], 
        {}, 
        25, 
        200, 
        600, 
        ['shell1','shell2'] 
    ] spawn BIS_fnc_fireSupportCluster; 
mapclick = false; 
"; 
waitUntil{!(mapclick)}; 
onMapSingleClick ""; 
UiSleep 5; 
deleteMarker marker_Bomb; 
};

https://community.bistudio.com/wiki/BIS_fnc_fireSupportCluster

https://community.bistudio.com/wiki/BIS_fnc_fireSupport

https://community.bistudio.com/wiki/BIS_fnc_fireSupportVirtual

Share this post


Link to post
Share on other sites

Looks nice.

But how does it work?

I put it on a script, called it, then clicked on the map but nothing happened.

Share this post


Link to post
Share on other sites

Isn't there a way to have the custom ammunitions (such as napalm bomb) be available in the support module?

 

Cause for now, I know how to add custom planes to the support module, but not the custom ammunitions

Share this post


Link to post
Share on other sites

I do this all the time, it's pretty awesome. I've scripted my own JDAM, MOAB, B52 carpet bomb runs, all kinds of stuff. No external files or mods. It takes a bit of tweaking but what you get is worth it.

What you want to do is pick your type of plane and bomb. Say you want to drop a regular GBU12 from an A-10. Make him "careless" and set his speed. Have him "flyInHeight" at, say, 500. Do the "on map single click" script and have it place a trigger right on that spot:

 

openMap true; onMapSingleClick { YourTrigger setPos _pos; marker1 setMarkerPos _pos; onMapSingleClick ''; true};

 

Just create a target marker of whatever type and a trigger. Now comes the part where you have to tweak. In the trigger activation, you want to create a GBU12 right under the A10, so: 

 

 bomb1="Bo_GBU12_LGB" createVehicle (getPos A10 vectorAdd [0,0,-5]); bomb1 setDir (getDir A10); 

 

Now when the A10 flies into his trigger, he will drop a bomb. The part you have to tweak is how big the trigger is so that the bomb falls directly on the spot you want (remember, the bomb doesn't fall straight down, it actually glides quite a ways). So make the trigger circular and I think maybe like 1000 in diameter to start. It should fall somewhere around your point, then just tweak it to your needs. 

Now, how do you get the A10 to fly exactly where you want? You give him a waypoint. Either create a waypoint for him on that "_pos" or you setWaypointPosition an existing "move" waypoint. Or, to save that "_pos" create an invisible water bottle and name it "bombpos", and have that "setPos" at that map click. That's what I do, and it works flawlessly. 

 

So your initial trigger is maybe a radio trigger. Name it something like "A-10 Bomb Strike." Sync it to a "show/hide" module for your plane, so he isn't flying around and completing waypoints. In the activation, put in something like this:  

openMap true; onMapSingleClick { YourTrigger setPos _pos; marker1 setMarkerPos _pos; bombpos setPos  _pos; [A10group, 1] setWaypointPosition [bombpos, 0]; onMapSingleClick ''; true};  He will now fly directly into your trigger and drop a bomb directly on your target.

 

I know this may seem derivative of the vanilla support modules, but the reason why i do this is because I don't just want a regular bombing run. You can evolve this script to do whatever you want. You can drop several bombs at several points all at once, use sound effects, particle effects, etc... 

 

EDIT: Here's a clip I just made of two examples I use in my missions. MOAB and Medevac. One single click and boom. 

 

 

  • Like 1

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

×