Jump to content
Sign in to follow this  
macusercom

Triggering setCaptive inside a certain vehicle

Recommended Posts

Hey there!

I want to make a script that people inside a MEDEVAC won't get hurt by enemy AIs. This should work with the setCaptive command, but I have some problems at the moment.

I found a script for this, but I want to either use it for a certain vehicle names or that it automatically detects MEDEVACs (in ACE).

private ["_ldr","_i","_unit"];

_ldr = _this select 0;

while {count (units group _ldr) >=1} do {

for [{_i=0},{_i<count (units group _ldr)},{_i=_i+1}] do {
	_unit = (units group _ldr) select _i;
	if (vehicle _unit == _unit) then {
		if (captive  _unit) then {_unit setcaptive false};
	} else {
		if (! captive  _unit) then {_unit setcaptive true};
	};
	sleep 0.01;
};
sleep 1;
};

I tried this one, but it doesn't seem to work. In this example I wanted to tell the script that the player should be inside the vehicle which HAS to be named "UH60". I guess I'm not the best in scripting oO

PLEASE DELETE IT, IT'S IN THE WRONG CATEGORY!

private ["_ldr","_i","_unit"];

_ldr = _this select 0;

while {count (units group _ldr) >=1} do {

for [{_i=0},{_i<count (units group _ldr)},{_i=_i+1}] do {

_unit = (units group _ldr) select _i;

if (vehicle _unit == _unit) and ((vehicle _unit) is "UH60") then {

if (captive _unit) then {_unit setcaptive false};

} else {

if (! captive _unit) then {_unit setcaptive true};

};

sleep 0.01;

};

sleep 1;

};

Edited by Macusercom

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  

×