Jump to content
Sign in to follow this  
woody00

Bomb Bay Doors

Recommended Posts

Hey,

I've got a DH Mosquito with bomb bay doors which work fine but i was wondering if it was possible to script the Ai to open the doors when a certain weapon is selected and if so how would this be achieved? Thanks

Share this post


Link to post
Share on other sites

soryy about double post but web connection died half way through and thought it had not posted sorry again

Share this post


Link to post
Share on other sites

I don't think you can. The best you could probably do is make the bay doors open instantly when you drop a bomb.

Share this post


Link to post
Share on other sites
I don't think you can. The best you could probably do is make the bay doors open instantly when you drop a bomb.

This is how I did the doors on the F-35: it kind of works...

There is one more trick:

You can loop and find when the AI plane goes from "Safe" to "Combat". When this happens you open the doors.

The AI doesn't fire in Safe mode*, so it shouldn't launch through the doors.

Then, you monitor when the AI goes from "Combat" back to "Safe", and close the doors again.

Or close them again when the ammo reaches 0.

You can pick-up the behaviour of the AI using the "behaviour _plane" command.

* - I think this is true, but it may not be 100%.

Share this post


Link to post
Share on other sites

Yep, script looping on the B52 addon.

Quote[/b] ]_plane = _this select 0

; We start with the bay closed

_bayclosed = 1

#MainLoop

; If the plane's dead, we can leave

?(not alive _plane): goto "Exit"

; If the player is in the plane, we don't need to do this

?(player in _plane): goto "Exit"

; Check the behaviour

_behstr = behaviour _plane

; If we're in combat, and the bay is closed, then open it

?(_behstr == "COMBAT" and _bayclosed == 1 ): goto "OpenBombBay"

; If we are not in combat, and the bay is open, close it

?(_behstr != "COMBAT" and _bayclosed == 0 ): goto "CloseBombBay"

; Add a delay, cause this isn't a critical loop

~(1 + random 2)

goto "MainLoop"

#OpenBombBay

_plane animate ["LeftBombbay",1]

_plane animate ["RightBombbay",1]

_plane addweapon "B52BombRail"

_bayclosed = 0

~1

goto "MainLoop"

#CloseBombBay

_plane animate ["LeftBombbay",0]

_plane animate ["RightBombbay",0]

_plane removeweapon "B52BombRail"

_bayclosed = 1

~1

goto "MainLoop"

#Exit

exit

Share this post


Link to post
Share on other sites
Quote[/b] ]This is how I did the doors on the F-35: it kind of works...

Can you check what weapon is selected? I think he wants the bay doors to open when the pilot selects the bombs as a weapon?

At least with the fired event you can say for sure what weapon is un use.

Share this post


Link to post
Share on other sites
Quote[/b] ]This is how I did the doors on the F-35: it kind of works...

Can you check what weapon is selected? I think he wants the bay doors to open when the pilot selects the bombs as a weapon?

At least with the fired event you can say for sure what weapon is un use.

Agreed: I don't think there's a way of finding the _selected_ weapon, is there?

I meant that with the FiredEH, you know what's been launched, so you can immediately open the appropriate bay.

If you give the weapon a longer initTime, and the bay anim quite a short animperiod, you can 'fudge' the result to look okay-ish.

Share this post


Link to post
Share on other sites

Hey guys thanks for your help its much apreciated! I've had a go at using [APS]Gnat's script though i seem to have problems with the command _plane as i have an error stating that it "Expected Array". So i wondering whether i had to state something about _plane somewhere else in the addon??

Share this post


Link to post
Share on other sites

Youre probably not calling the script like;

[this] exec "scriptname.sqs"

Also, the script will not work as-is, for one the "LeftBombbay" names etc are special to the B52 ...... you would need the corresponding one for the plane you are using ........ if they exist.

Share this post


Link to post
Share on other sites

i've changed the appropiate parts of the script for use with the Mosquito and have activated it in "Class EventHandlers".<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

class EventHandlers

{

init = (_this select 0)exec "\mosquito\bombay.sqs";

};

So in game it seems to run the script then throws up an error message in top left saying

'_plane = _this select0|*|: Error Select: type object, expected array

Share this post


Link to post
Share on other sites

hmmmmm .... that error doesnt make any sense .... I suspect the error is more likely to be a typo.

Is it really "select0" or "select 0" ?

Share this post


Link to post
Share on other sites

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

{

init = _this exec "\mosquito\bombay.sqs";

};

Leave away the 'select 0' or you don't pass an array, which leads to the error you mentioned before.

Share this post


Link to post
Share on other sites
Quote[/b] ]

hmmmmm .... that error doesnt make any sense .... I suspect the error is more likely to be a typo.

Is it really "select0" or "select 0" ?

Sorry yeah its supposed to be "select 0" have tryed hardrocks suggestion of removing this part which elminates the error but still nothing happens.

Share this post


Link to post
Share on other sites
Quote[/b] ]

hmmmmm .... that error doesnt make any sense .... I suspect the error is more likely to be a typo.

Is it really "select0" or "select 0" ?

Sorry yeah its supposed to be "select 0" have tryed hardrocks suggestion of removing this part which elminates the error but still nothing happens.

Did you change this part;

Quote[/b] ]_plane animate ["LeftBombbay",1]

_plane animate ["RightBombbay",1]

_plane addweapon "B52BombRail"

... to suit the the mosquito's own setting ?

It won't work until those names are changed.

Share this post


Link to post
Share on other sites

Yeah i've changed them all the appropiate names to the mosquitos setting and still the error continues. The only time its seems to go away is when the "select 0" part is removed.

Do i have to define this as something somewhere else in the addon??

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  

×