Jump to content
Sign in to follow this  
Beeralbion

Easy one for you scripters!

Recommended Posts

Basically I know very little about scripting and would like to know how to get a bomber to drop its payload onto an area and not say a tank. Situation of lots of troops milling around in town but plane will not target them so just flys around and around. How can i get it to bomb them!?!?!

Thanks in advance

Share this post


Link to post
Share on other sites

If you increase the rating of the units (using the addrating command, unitname addrating 5000) the bomber should target them.

RED

Share this post


Link to post
Share on other sites

Thanks for the quick reply RED. I have quickly tried out what you said but it appears to make no difference.

I have for test purposes just set up a group of troops on Desert Island. A Falklands Mod Mirage flies to waypoint above them. I want the Mirage to drop payload on to troops but it flies striahgt over them. I have added the "addrating 5000" to the units to be bombed but the plane does not even detect the troops, let alone bomb them!?!?!

Like i say i am a complete novice to this but its really interesting. are there any manuals / references i can look at to help?

Share this post


Link to post
Share on other sites
Thanks for the quick reply RED. I have quickly tried out what you said but it appears to make no difference.

I have for test purposes just set up a group of troops on Desert Island. A Falklands Mod Mirage flies to waypoint above them. I want the Mirage to drop payload on to troops but it flies striahgt over them. I have added the "addrating 5000" to the units to be bombed but the plane does not even detect the troops, let alone bomb them!?!?!

Like i say i am a complete novice to this but its really interesting. are there any manuals / references i can look at to help?

if you remove all but the bombs from the planes, and do

Mirage1 doTarget someSoldier

Mirage1 doFire someSoldier

or perhaps

Mirage1 fire ["bombname","bombname"]?

Share this post


Link to post
Share on other sites

Ok I have tried the DoTarget & DoFire commands on the planes but they still dont do anything sad_o.gif

I dont know the names of the bombs that it carries so not sure how to do the Mirage1 fire ["bombname","bombname"]

I have tried it with the standard SU-25 and it does exactly the same BTW so its not the plane im using??....

Share this post


Link to post
Share on other sites

No, it's simply that the pilots doesn't "see" the soldiers as threats to them.

This is configured in the config-file for the aircraft.

the same goes for soldiers vs APC's

if they do not have an LAW they wont attack it even if they could disable it by throwing grenades at it.

This doesn't help you much.

to get the names of the bombs, presuming you are using Resistance

make a script, call it "fired.sqs" or something

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_p1 = _this select 1;

_p2 = _this select 2;

_p3 = _this select 3;

_p4 = _this select 4;

setAccTime 0.1

_bullet = nearestObject [player,_p4];

hint Format ["1:%1\n2:%2\n3:%3\n4:%4\n5:%5\n6:%6", (typeOf (vehicle player)), _p1, _p2, _p3, _p4, _bullet]

setAccTime 1

exit;

inside the editor, make yourself piloting one of the Mirages

and place in the mirages initline:

this addEventHandler ["fired", {_this exec "fired.sqs"}]

now fly the plane and drop one of the bombs, the hintBox will appear telling you the name of the bomb

Share this post


Link to post
Share on other sites

Hey neat! I now have the bomb names. What do i need to do to get them to drop on a spot on the map? if its easier can i just get the plane to drop on a certain point on the map such as a town?

Share this post


Link to post
Share on other sites

well you can place an trigger with an radious let's say 300

(only guessing)

activation: west (or the side of the Mirages)

onActivation: [Mirage1,Mirage2 etc..] exec "airstrike.sqs"

airstrike.sqs

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_plane1 = _this select 0

_plane2 = _this select 1

_plane3 and so on..

_iX = 0

_limit = 8 (or equals the amount of bombs the Mirages are carrying)

#Loop

plane1 fire ["bomb","bomb"]

~1

plane2 fire ["bomb","bomb"]

~1

_iX = _iX + 1

?(_iX < _limit)

exit

now you'll need to "time" the radious of the trigger so the bombs fall on and or near the enemy troops

This script is not tested, I'm only scripting on the fly.

Share this post


Link to post
Share on other sites

Ok I have made a bodged attempt at the code you wrote for me:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

mirage1 = _this select 0

_iX = 0

_limit = 4

#Loop

mirage1 fire ["flkmiragebomblauncher","flkmiragebomblauncher"]

~0.2

mirage1 fire ["flkmiragebomblauncher","flkmiragebomblauncher"]

~0.2

mirage1 fire ["flkmiragebomblauncher","flkmiragebomblauncher"]

~0.2

mirage1 fire ["flkmiragebomblauncher","flkmiragebomblauncher"]

~0.2

_iX = _iX + 1

?(_iX < _limit)

exit

I get an error mentioning Reserved Variable in Expression - I assume its just me editing the code badly!

Anyway YES! the plane will now drop 3 bombs in a line (not the fourth for some reason??) so i guess i will just play with it a bit to get it right!

Thanks very much for your help smile_o.gif

Share this post


Link to post
Share on other sites
I get an error mentioning Reserved Variable in Expression - I assume its just me editing the code badly!

You need to change mirage1 to _mirage1

making this an local script variable, this should make it work propperly.

If you do not, you try to place an object into an allready existing variable(object)

I guess that you have named the aircraft mirage1 in the "name" field of the unit?

(this can be overridden, but we'll leave that for later)

[ edited]

You can however skip the

_mirage1 = _this select 0

if you are only using one aircraft.

then you change the onACtivation of the trigger to:

[] exec "airstrike.sqs"

[ /edited]

Quote[/b] ]Anyway YES! the plane will now drop 3 bombs in a line (not the fourth for some reason??) so i guess i will just play with it a bit to get it right!

This can be related to the error you've got at the start.

Quote[/b] ]Thanks very much for your help  smile_o.gif

No problem, glad I can help you out  wink_o.gif

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  

×