Jump to content
Sign in to follow this  
evans d [16aa]

Forcing AI to stay in Vehicle

Recommended Posts

Ladies and gentlemen,

Some of you may have seen my previous thread in which I ask about the unitCapture / unitPlay / unitPlayFiring functions. Well, since that isn't working out for me I've thought of a work around that, currently, isn't working around...

My helicopter (helo1) circles the airfield, attacking vehicles that I've placed and are occupied by friendly forces. However, the main target for helo1's assault is a friendly helicopter. I've placed it in the editor, made sure that it spawns very damaged so it's easier to blow up, removed the fuel so it can't take off, and given it the following commands in its initialization box:

this disableAI "MOVE";
this disableAI "TARGET";
this disableAI "AUTOTARGET";

Now, picture the scene:

It's dark, with floodlights illuminating the base. Troops patrol, and a truck with the players in pulls up. The players disembark, and prepare to get their briefing. The officer arrives and starts to deliver it, when all of a sudden: BOOM! MI-48 out of frakking nowhere! There are shells exploding, trucks exploding, it fires at the helicopter on the pad, their primary way of getting to their objective and as the explosions ripple around the helo the pilots get out and the fire stops.

I can only conclude, therefore, that as soon as the pilots get out of the helicopter the AI stops counting it as a threat and switches targets. Is there a way to force the AI pilots to stay in the helicopter so they can be shot to pieces in a glorious and fantastic explosion?

Thank you kindly,

Bashkire.

Share this post


Link to post
Share on other sites

Thank you for the suggestion, Rumsfield, but those commands don't seem to be working. The pilots still decide to exit their helicopter.

Share this post


Link to post
Share on other sites

see if this works Vehiclename AllowCrewInImmobile True

Share this post


Link to post
Share on other sites

hmmm it's weird that the AI get out of the helo. You have simply placed a parked AI helo on the ground with engines off? Have you tried giving the helo a "hold" waypoint right in front of them, or perhaps spawn an empty helo and use the MoveInDriver commands to the helo pilots with the above "disableAI" functions? Or perhaps give them a enableSimulation false, maybe they won't be able to move?

Share this post


Link to post
Share on other sites

F2K Sel, no that's not working either. Regardless, I've come up with a work around for my workaround:

Event handlers.

init.sqf

eventTargetHeloHit = targetHelo addEventHandler ["hit", {_this exec "Scripts\Events\targetHeloHit.sqf"}];

targetHeloHit.sqf

sleep 2;

targetHelo setDamage 1;

Messy, yet simplistic. For anyone who's confused about what this does, eventTargetHeloHit is the variable name of my event, targetHelo is my helicopter. Once targetHelo has been hit by something (in this case, cannon fire from helo1) the event will be triggered and will activate a script I have created that will wait 2 seconds and then destroy targetHelo.

As I say, simplistic and a tad messy, but it works.

Many thanks to you two who helped out.

Bashkire

Share this post


Link to post
Share on other sites

yes I just checked Vehiclename AllowCrewInImmobile True only works for tracked or wheeled vehicles.

Another way would be to use the getout eventhandler and just pop them back in if they try and get out.

placed in the vehicles init

this addEventHandler ["GETOUT",{_this select 2 moveindriver (_this select 0);_this select 2 moveincargo (_this select 0)} ]

Edited by F2k Sel

Share this post


Link to post
Share on other sites

Or use this wrokaround, kinda what I proposed you in your other post:

https://www.dropbox.com/s/0hc8megkwhpg2mg/airport%2520attack%2520test.Stratis.rar

It is a workaround, using one singe unit, and hiding it is completely optional, indeed it does not hide in vehicles... weird.

But you will be able to establish order of destruction.... Take in count accurancy is not the same everytime you try, sometimes the helo diez in 1 second, other takes 10... Combine it with "hit" eventhandler and your results will be more or less the same on every try...

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  

×