Jump to content
avibird 1

how to you stop AI units from using a empty vehicle on the map.

Recommended Posts

How do I stop AI units from getting into a vehicle and using it. I have a chopper that spawns in and a crew that will jump in the chopper using the get in waypoint followed by a SD waypoint with a cycle waypoint. The chopper will spawn back in 5 minutes as well as the crew (PILOTE AND GUNNER) on the ground  and the all the waypoints. Works great. however I have a few squads around the AO that use UPMONS script to give way points. I think there is a way to stop UPMONS units to use vehicles but I don't really want to stop them I just want to make the chopper use only for the pilote and gunner the spawn at the same time. I don't want to lock the chopper one of the objectives is to steal the chopper lol old school OFP days for anyone that played. Avibird 1

Share this post


Link to post
Share on other sites
_vehicle addEventHandler ["GetIn", 
{
private ["_veh", "_pos", "_unit", "_namesArray"];
_veh = _this select 0;
_pos = _this select 1;
_unit = _this select 2;
_namesArray = ["John", "_spiderMan_", "CowGirl"];

if !(name _unit in _namesArray) then
{
_unit action ["Eject", vehicle _unit];
};
}];
  • Like 1

Share this post


Link to post
Share on other sites
1 hour ago, fernandolvferreira said:

_vehicle addEventHandler ["GetIn", 
{
private ["_veh", "_pos", "_unit", "_namesArray"];
_veh = _this select 0;
_pos = _this select 1;
_unit = _this select 2;
_namesArray = ["John", "_spiderMan_", "CowGirl"];

if !(name _unit in _namesArray) then
{
_unit action ["Eject", vehicle _unit];
};
}];

Didn't try it but from my experience, there is no way this would work. You need to unassign them at least. Sometimes you can use 10 different commands to keep them out but they still go right back in.

Share this post


Link to post
Share on other sites
1 hour ago, theend3r said:

Didn't try it but from my experience, there is no way this would work. You need to unassign them at least. Sometimes you can use 10 different commands to keep them out but they still go right back in.

 

Yep... I was just wondering, they'd go into a nasty loop of getting in and getting kicked out...

 

Did you try to set the vehicle locked and unlocking it with a trigger grouped to the pilot?

Share this post


Link to post
Share on other sites

Lock it and have it unlock when players are within 5 metres of it?

Share this post


Link to post
Share on other sites

Yes upmon has a noveh element but I did not want to use it on all empty vehicles on the map only the gunship at this helicopters outpost in my misdion.

Share this post


Link to post
Share on other sites

 

19 hours ago, theend3r said:

Lock has no effect on AI.  allowGetIn would work. UPS doesn't have AI use vehicles either, afaik.


https://community.bistudio.com/wiki/setVehicleLock

This is what I meant.

EDIT:

LockHelicopter.sqf

//Not tested on dedicated Server
helicopter1 setVehicleLock "LOCKED";

waituntil {

	sleep 3;

	(	{_x distance (getPos Helicopter1) < 10} count allPlayers) > 0;
	
};

helicopter1 setVehicleLock "UNLOCKED";

 

Share this post


Link to post
Share on other sites
6 hours ago, MKD3-FHI said:

 


https://community.bistudio.com/wiki/setVehicleLock

This is what I meant.

EDIT:

LockHelicopter.sqf


//Not tested on dedicated Server
helicopter1 setVehicleLock "LOCKED";

waituntil {

	sleep 3;

	(	{_x distance (getPos Helicopter1) < 10} count allPlayers) > 0;
	
};

helicopter1 setVehicleLock "UNLOCKED";

 

Yes, no effect on AI, afaik.

Share this post


Link to post
Share on other sites

The issues is upmon AI will look for combat vehicles and use them. It's build into the script ): 

Share this post


Link to post
Share on other sites

There is the  LockDriver and associated commands and https://community.bistudio.com/wiki/lockDriver

That works on AI in SP I don't know about MP. The problem is that it also locks the player out.

You would need to add an action to unlock the positions or check the player distance and have it auto lock/unlock.

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

×