Jump to content
Sign in to follow this  
scottb613

Sequence (3) AI Helicopters to launch 30 seconds apart ???

Recommended Posts

Hi Folks,

 

A simple question I'm sure but one I've struggled countless hours with trying to get to work...

 

What's the proper way to get three AI Helicopters to launch (30) seconds apart - after firing a trigger ???

 

I've tried using Move and Hold Waypoints (WP) with synced triggers - I've tried tried putting sleep statements in both Condition and Activation fields of WP's... I've scripted the WP to check for the activation of an un-synced trigger - I've tried using all kinds of timings in the three WP time fields (min/mid/max)... Nothing yields consistent results... It appears that the WP timers increment even before the WP is reached - are those times "global" to the mission times - as opposed a little relative timers associated to the WP ???

 

Any help appreciated...

 

Regards,
Scott

Share this post


Link to post
Share on other sites

Would three separate triggers work in your situation? One with no delay, one with a 30sec delay, one with a 60sec delay?

  • Like 1

Share this post


Link to post
Share on other sites

Hi...

 

Well - this is just a small part of a large Air Assault - these are the gunships in support of slicks that I want to launch first... Without delay - it just looks fake as they all launch at exactly the same time... While individual triggers will most definitely work - I'm trying to use a single trigger to kickoff the entire event with scripted delays between launches... With the slicks I control the troops with the same trigger prior to load - and the timers on those Move WP's seem to work - it only seems to be the helicopters without troops giving me fits... In addition - I did read somewhere that you should attempt to keep triggers to a minimum as they aren't very efficient - I can neither confirm nor deny - just something I read...

 

Thanks for your help !!!

:)

 

Regards,
Scott

Share this post


Link to post
Share on other sites

Hi Folks,

Just perusing the Wiki on my lunch break - would this work ???

If WP-1 (HOLD) and WP-2 (MOVE)...

Remove all synchronization from the trigger and just execute the following on activation ?

_grp1 = group cobra1;
_grp2 = group cobra2;
_grp3 = group cobra3;
 
deleteWaypoint [_grp1, 1];
sleep 30;
deleteWaypoint [_grp2, 1];
sleep 30;
deleteWaypoint [_grp3, 1];

Any input appreciated...

Regards,

Scott

Sent from my iPad using Tapatalk

Share this post


Link to post
Share on other sites

It should be quite simple just make sure the first waypoint (move) it close to the chopper and in the condition place a variable eg helihold1

Do the same for all three choppers and change the condition to match helihold2,helihold3

No need for sych's

 

The in a trigger place this in the on act box

null=[] spawn {helihold1=true;sleep 30;helihold2=true;sleep 30;helihold3=true};

 

When you want the heli's to start to launch you will need to trigger the trigger, you can set that how you want using the triggers various methods.

You can also place the code in a waypoint on act, so it activates when a unit reaches that waypoint.

  • Like 1

Share this post


Link to post
Share on other sites

It should be quite simple just make sure the first waypoint (move) it close to the chopper and in the condition place a variable eg helihold1

Do the same for all three choppers and change the condition to match helihold2,helihold3

No need for sych's

 

The in a trigger place this in the on act box

null=[] spawn {helihold1=true;sleep 30;helihold2=true;sleep 30;helihold3=true};

 

When you want the heli's to start to launch you will need to trigger the trigger, you can set that how you want using the triggers various methods.

You can also place the code in a waypoint on act, so it activates when a unit reaches that waypoint.

 

THANK YOU - YES - WORKS !!!

 

I've spent probably more than 8 hours - not all in one sitting trying to get this to work... It seems when you just have a list of statements in the activation field - - it executes them all simultaneously... I used "hint" to comment the execution and the "sleep" prior to the hint had absolutely no effect - as soon as the waypoint was activated - the hint would trigger as well ignoring the preceding "sleep"... When I moved my code into an actual SQF file - the "sleep" started working as I though it should... Very strange...

 

Your method works exactly how I wanted it - thanks again !!! You made my night...

:D :D :D

 

Regards,

Scott

Share this post


Link to post
Share on other sites

Hi...

 

If I might ask one follow up - the other side of this mission I am firing a trigger to get the same three helicopters to break off combat and RTB... Again - spent hours on this - my latest code follows - it's trying to delete all "search and destroy" WP's - disable targeting - and removing all ammunition from said aircraft... Doesn't seem to work at all - the aircraft continue their attack runs and still have weapons to shoot - despite orders... Any idea what I'm doing wrong ???

grp1 = group cobra1;
grp2 = group cobra2;
grp3 = group cobra3;
 
deleteWaypoint [grp1, 2];
deleteWaypoint [grp2, 2];
deleteWaypoint [grp3, 2];

deleteWaypoint [grp1, 3];
deleteWaypoint [grp2, 3];
deleteWaypoint [grp3, 3];

grp1 setBehaviour "CARELESS";
grp1 disableAI "TARGET";
grp1 disableAI "AUTOTARGET";
grp1 allowFleeing 1;
{cobra1 removeWeapon x} forEach weapons cobra1;

grp2 setBehaviour "CARELESS";
grp2 disableAI "TARGET";
grp2 disableAI "AUTOTARGET";
grp2 allowFleeing 1;
{cobra2 removeWeapon x} forEach weapons cobra2;

grp3 setBehaviour "CARELESS";
grp3 disableAI "TARGET";
grp3 disableAI "AUTOTARGET";
grp3 allowFleeing 1;
{cobra3 removeWeapon x} forEach weapons cobra3;

Regards,
Scott

Share this post


Link to post
Share on other sites

That is tricky the problem is once the AI know about the enemy there's no specific command that will override their knowledge and so they keep engaging.

 

For DisableAI to work it needs to be applied before they see the enemy which isn't much use in this situation.

 

That leaves one option you will need to set all the enemy to captive then use the disableAI  then restet the enemy  again.

 

Try placing this

grp1 = group cobra1;
grp2 = group cobra2;
grp3 = group cobra3;

deleteWaypoint [grp1, 2];
deleteWaypoint [grp2, 2];
deleteWaypoint [grp3, 2];

deleteWaypoint [grp1, 3];
deleteWaypoint [grp2, 3];
deleteWaypoint [grp3, 3];

{_x setcaptive true} foreach allunits ;

{
_x  setBehaviour "CARELESS";
_x disableAI "TARGET";
_x disableAI "AUTOTARGET";
_x setcombatmode "BLUE";
} foreach [grp1,grp2,grp3];

{_x setcaptive false} foreach allunits;

allunits is a bit of a hammer as it's working on everything, this could be made more efficient by creating an array of the enemy units close to the choppers, ie creating a trigger set to detect OPFOR and use  LIST triggernamegoeshere   instead of allunits

 

Also try and avoid allowFleeing 1; as when they are fleeing I think they ignore commands and waypoints for a while and fly in any direction.

Share this post


Link to post
Share on other sites

Hi...

Thanks again for taking the time - while I'm currently messing with Unsung in A2 - much of this carries over to A3 so I'll be able to put it to good use there as well... I'm taking it all onboard...

I'll try what you posted above tonight when I get home...

I've tried several ways to delete all the munitions carried by the aircraft - that doesn't seem to work - as they are always able to shoot after issuing the commands - would you know if it "should" work on a helicopter in flight ?

One thing I did find in my search was a thread related to level bombing - they didn't want the plane attacking after the initial bomb run - so they used "setVectorDir" and several others to basically fly the aircraft at a level altitude, in a given direction, for a given distance - does this also sound like it should work ? With these commands would it ignore the automatic attack routines ? I can't find the post at the moment...

Thanks again !!!

Regards,

Scott

Sent from my iPad using Tapatalk

Share this post


Link to post
Share on other sites

for removing weapons your syntax is incorrect x should be _x

 

I haven't tested to see how it works removing weapons as it can be a hassle putting them back later if you need to.

Edit:- just ran a quick test and the chopper still seems to try and engage even though it can't fire.

 

Yes setvectordir may work, I've done it before with the pitchbank function and then add velocity but it always looks a little fake.

 

 

Sometimes it's better to have the pilot and gunners in different groups so you can set the pilot to careless at the start of the mission.

The gunners can then be set to combat so they will still fire from their positions.

Share this post


Link to post
Share on other sites

Hi...

Ok - thanks - you've definitely gone above and beyond - sir...

I'll play with this all tonight...

Oh - I deleted the preceding underscore on variables because when used in the activation field they throw an error "Local Variable used in a Global Variable space" or something like that... I tried using the "private" to initialize the variables thinking it would isolate them for use in my script - but - it still threw an error... The only way to get to to stop was to remove the underscore... I'll research it more...

You've been more than helpful and I don't want to abuse the courtesy...

:)

Regards,

Scott

Sent from my iPad using Tapatalk

Share this post


Link to post
Share on other sites

Hi Folks,

 

Just to follow up here - while I've read a bunch of threads saying it was almost impossible to get AI to break off an attack once the enemy was seen - I've found it not too bad (maybe it was an older version of A2) - I tested many things with [disableAI], [removeWeapon] , and the [setCaptive] functions as posted above - but this is what I've found works consistently on helicopters actively engaging ground forces where they abort the attacks immediately every time... It's a stand alone SQF script called by a radio trigger...

 

I seem to be having better luck writing SQF scripts - as the same code in an "Activation" window seems to behave differently...

 

Thanks for all the help !!!

;)

 

WP-3 = "Get Out"

_grp1 = group cobra1;
_grp2 = group cobra2;
_grp3 = group cobra3;

{
_x setCurrentWaypoint [_x, 3];
_x setBehaviour "CARELESS";
_x setCombatMode "BLUE";
sleep 30;
} foreach [_grp1,_grp2,_grp3];

Regards,

Scott

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  

×