Jump to content
Sign in to follow this  
patpowercat

What's wrong with my script?

Recommended Posts

I'm a novice at scripting, but I have been working on modifying a script I found. Instead of spawning a single group in a helicopter, I want to spawn 2 in the helicopter. It works great with a single group, but when I try and add in the second group, I get an error that I am missing a "{". Any ideas?

 

Script with two groups:

_crew1 = [];
_airframe1 = [];
_mygroup = [];
_mygroup2 =[];

if (isServer) then {

_crew1 = creategroup WEST; 
_airframe1 = [getMarkerPos "Mk1", 140, "B_Heli_Transport_03_F", _crew1] call BIS_fnc_spawnVehicle;

_wp1 = _crew1 addWaypoint [(getmarkerpos "Max"), 0];
_wp1 setWaypointType "TR UNLOAD";
_wp1 setWaypointSpeed "FAST";
_wp1 setwaypointstatements ["this land 'land'"];

_wp2 = _crew1 addWaypoint [(getmarkerpos "Mk1"), 0];
_wp2 setWaypointType "MOVE";
_wp2 setWaypointSpeed "FAST";
_wp2 setWaypointStatements ["true", "{deleteVehicle _x;} forEach crew (vehicle this) + [vehicle this];"]; 


_mygroup = [getMarkerPos "Mk1", WEST, (configfile >> "CfgGroups" >> "West" >> "BLU_F" >> "Infantry" >> "BUS_InfAssault")] call BIS_fnc_spawnGroup;
_wp1a = _mygroup addWaypoint [getmarkerpos "Max1", 0];
_wp1a setWaypointType "LOITER";

_mygroup2 = [getMarkerPos "Mk1", WEST, (configfile >> "CfgGroups" >> "West" >> "BLU_F" >> "Infantry" >> "BUS_ReconTeam")] call BIS_fnc_spawnGroup;
_wp1b = _mygroup2 addWaypoint [getmarkerpos "Max2", 0];
_wp1b setWaypointType "LOITER";

sleep .5;
_mygroup = _mygroup;
{ _x assignAsCargo (_airframe1 select 0); _x moveIncargo (_airframe1 select 0);} foreach units _mygroup;
}; 
_mygroup2 = _mygroup2;
{ _x assignAsCargo (_airframe1 select 0); _x moveIncargo (_airframe1 select 0);} foreach units _mygroup2;
}; 

Spawn with one group: (working)

_crew1 = [];
_airframe1 = [];
_mygroup = [];


if (isServer) then {

_crew1 = creategroup WEST; 
_airframe1 = [getMarkerPos "Mk1", 140, "B_Heli_Transport_03_F", _crew1] call BIS_fnc_spawnVehicle;

_wp1 = _crew1 addWaypoint [(getmarkerpos "Max"), 0];
_wp1 setWaypointType "TR UNLOAD";
_wp1 setWaypointSpeed "FAST";
_wp1 setwaypointstatements ["this land 'land'"];

_wp2 = _crew1 addWaypoint [(getmarkerpos "Mk1"), 0];
_wp2 setWaypointType "MOVE";
_wp2 setWaypointSpeed "FAST";
_wp2 setWaypointStatements ["true", "{deleteVehicle _x;} forEach crew (vehicle this) + [vehicle this];"]; 


_mygroup = [getMarkerPos "Mk1", WEST, (configfile >> "CfgGroups" >> "West" >> "BLU_F" >> "Infantry" >> "BUS_InfAssault")] call BIS_fnc_spawnGroup;
_wp1a = _mygroup addWaypoint [getmarkerpos "Max1", 0];
_wp1a setWaypointType "LOITER";

sleep .5;
_mygroup = _mygroup;
{ _x assignAsCargo (_airframe1 select 0); _x moveIncargo (_airframe1 select 0);} foreach units _mygroup;
}; 
_mygroup2 = _mygroup2;
{ _x assignAsCargo (_airframe1 select 0); _x moveIncargo (_airframe1 select 0);} foreach units _mygroup2;
}; 

I don't understand why I am getting this error. 

Share this post


Link to post
Share on other sites

Delete the extra }; that is the 4th line from the bottom.

 

Consider using Notepad++ as your editor.  You can get a .sqf extension for it (google for it), and it makes spotting missing or extra brackets and parentheses really easy.  It also colors variables and commands differently, making the code easier to read while you are working on it.

Share this post


Link to post
Share on other sites

...that script looks familiar.

  • Like 1

Share this post


Link to post
Share on other sites

...that script looks familiar.

 

Who cares. This script is so basic, my mom could have written it.

  • Like 2

Share this post


Link to post
Share on other sites

Who cares. This script is so basic, my mom could have written it.

I ve great respect for ur mom now...

  • Like 1

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  

×