Jump to content
Stalamite

AI disembark when see an enemy

Recommended Posts

Hi,

 

I created a mission where I have a vehicle (van) and a group of opfor inside. They have to move in front a house. I added a waypoint ''move'' so they can go there. I also placed a group of blufor in the same place. So everything is okay, the van move but when they saw the ennemies (blufor) they disembark from the vehicle and not exactly from the waypoint ''move''. I try everything like this script : this setUnloadInCombat [FALSE,FALSE]; this allowCrewInImmobile true;

 

But It did't work :( 

I also try to put in careless or safe, to lock the vehicle but same things. I have a team leader (it's the driver), and 8 passengers

Any tips please ? 

Thanks 

Share this post


Link to post
Share on other sites

Locking the vehicle won't do the trick, but at least you are thinking logically haha.

 

Maybe some combination of these commands? I would expect the first 2 to do it. If not, try playing with the different options for disableAI, as it is possible that if the units are not seeking to target or engage, they may not seek to disembark. 

{_x assignAsCargo yourVehicle} forEach units yourGroup;
{[_x] orderGetIn true} forEach units yourGroup;
{
	_x disableAI "ALL";
} forEach units yourGroup;

And the nuclear option:

{
	_x enableSimulationGlobal false;
} forEach units yourGroup;

For all of these options, you will need to eventually counter them with the opposite command when you do want the units to disembark/engage. 

  • Thanks 1

Share this post


Link to post
Share on other sites

Thanks for the script but I'm a bit beginner in arma 3 and I think it's outside of my skills. Do you think you can give me an exemple for the first script like what I have to put in ''yourVehicle'' and also if  I have to put the script in the vehicle or in my group ? Thanks

 

Share this post


Link to post
Share on other sites
8 minutes ago, Stalamite said:

Thanks for the script but I'm a bit beginner in arma 3 and I think it's outside of my skills. Do you think you can give me an exemple for the first script like what I have to put in ''yourVehicle'' and also if  I have to put the script in the vehicle or in my group ? Thanks

 

 

I strongly recommend you take a look at the many tutorials made available for ArmA scripting. A good start would be in the tutorial/newcomer stickies in this forum.

 

In my example, yourVehicle is just a placeholder name. In the editor, when you fill out the Variable Name field, you are effectively defining a global variable (accessible anywhere) with the value being that object (in this case, I had named the subject vehicle yourVehicle, and can therefore reference it in scripts using the global variable yourVehicle). For the most part, you can name it whatever you want.

 

I assume you have 8 soldiers that you have grouped together. I also assume you want them in the vehicle on mission start. Knowing this, the quick way is to just put the example code in the init field of one of those units. However, because yourGroup is not defined, you will need to either:

A) The first statement needs to define yourGroup

yourGroup = group this;

B) Replace yourGroup with group this

{_x assignAsCargo yourVehicle} forEach units group this;
{[_x] orderGetIn true} forEach units group this;
{
	_x disableAI "ALL";
} forEach units group this;

 

Keep in mind, you still need to "counter" all of the above commands whenever you want your units to actually disembark and fight. But give the above a test and make sure it is working first. That will also help you build your understanding.

 

Next, the preferred method for doing this is probably a standalone script. 

1. Create "init.sqf" and put it in your mission folder

2. In init.sqf, put the following:

[] execVM "vanScript.sqf";

3. Create "vanScript.sqf" and put it in your mission folder

4. In vanScript.sqf, insert the code example I have provided. Again, you will have to define what yourGroup is one way or another, by using either the group command or object name. 

 

That is all a very basic start to executing a script. Again, I strongly recommend you take a look at the tutorials and guides made available. They are not long reads, and often give you a way to "follow along" in your own scripts. If you have not seen or do not understand any of the commands I have mentioned, look them up in the Biki. See something on the Biki page you do not understand? Look it up again! 

 

Good luck!

  • Thanks 1

Share this post


Link to post
Share on other sites

Thank you very much for all this explanations ! It's very nice to see people take care to explain in beginner like me how it works . Also I will take a look of tutorial in scripting . I think I have a lot to learn :icon_biggrin:.

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

×