Jump to content
Sign in to follow this  
Deathcon5

action script error

Recommended Posts

I am trying to set up a mission where, as the Commander, I can order my choppers into position, then use an addAction to set off a script that tells the chopper to land and tells the soldiers (a different group) to get out of the chopper. Seems simple enough. The addAction works fine and activates the script but then I get an error.

getting this error message:

Error in expression <gnvehicle _x;

_x action ["getout", ch22 _x];

sleep 0.5;

} foreach units group bl>

Error position: <_x];

sleep 0.5;

} foreach units group bl>

Error Missing ]

this is the section of script below. BluInf22 is the infantry group, ch22 is the name of the chopper. FYI the pilot's name is ch22p, but from what I understand you use the vehicle name.

if ((getPos ch22 select 2) > 2) then {

ch22 land "getout";
sleep 5;

} else {
unassignvehicle _x;
_x action ["getout", ch22 _x];
sleep 0.5;
} foreach units group bluInf22;

Any ideas?

Share this post


Link to post
Share on other sites

Try this.

if ((getPos ch22 select 2) > 2) then {
ch22 land "getout";
sleep 5;
} else {
unassignvehicle _x;
_x action ["getout", ch22];
sleep 0.5;
} foreach (units (group bluInf22));

The "_x action ["getout", ch22]" tells that your AI _x has to get out of the chopper.

Share this post


Link to post
Share on other sites

Seems to be missing a } somewhere. Either on the else or the forEach statement. I've never seen it before, but I don't think you can have else { ...code... } forEach ...

Not tried, but...

if ((getPos ch22 select 2) > 2) then {
ch22 land "getout";
sleep 5;
} else {
{
	unassignvehicle _x;
	_x action ["getout", ch22];
	sleep 0.5;
} foreach (units (group bluInf22));
};

Share this post


Link to post
Share on other sites
Seems to be missing a } somewhere. Either on the else or the forEach statement. I've never seen it before, but I don't think you can have else { ...code... } forEach ...

Not tried, but...

if ((getPos ch22 select 2) > 2) then {
ch22 land "getout";
sleep 5;
} else {
{
	unassignvehicle _x;
	_x action ["getout", ch22];
	sleep 0.5;
} foreach (units (group bluInf22));
};

Shouldn't script late at night here, didn't even see the forEach there lol.

Edited by Benny.

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  

×