Jump to content
Sign in to follow this  
wiggum2

Get a spawned group out of a spawned vehicle

Recommended Posts

Hi,

i try to get a spawned group out of a spawned vehicle and give them another waypoint where they defend a location.

This is my script:

// spawn_vcl.sqf
// JULY 2009 - norrin

if (isServer) then {

_type 		= _this select 0;
_marker_pos = _this select 1;

// Create Vehicle
_vcl_new = _type createVehicle (getMarkerPos _marker_pos);

[i]// Create Crew
_group = createGroup WEST; 
"ACE_usarmy_crew" createUnit [(getMarkerPos _marker_pos), _group];
"ACE_usarmy_crew" createUnit [(getMarkerPos _marker_pos), _group];

_unitsGroup = units _group;[/i]

[b]// Create Cargo
_groupCargo = createGroup WEST;
"ACE_usarmy_teamleader" createUnit [(getMarkerPos _marker_pos), _groupCargo];
"ACE_usarmy_ar" createUnit [(getMarkerPos _marker_pos), _groupCargo];
"ACE_usarmy_rifleman_1" createUnit [(getMarkerPos _marker_pos), _groupCargo];
"ACE_usarmy_rifleman_2" createUnit [(getMarkerPos _marker_pos), _groupCargo];

_unitsGroupCargo = units _groupCargo;[/b]

[i] // Move crew in Vehicle
for [{ _loop = 0 },{ _loop < count  _unitsGroup},{ _loop = _loop + 1}] do
{	
_guy = _unitsGroup select _loop;
_guy setSkill 0.8;
if (_loop == 0) then {_guy moveInDriver _vcl_new};
if (_loop == 1) then {_guy moveInGunner _vcl_new};	
if (_loop == 2) then {_guy moveInCargo _vcl_new}; 

sleep 0.1;
};[/i]

[b]// Move cargo in Vehicle
for [{ _loop = 0 },{ _loop < count  _unitsGroupCargo},{ _loop = _loop + 1}] do
{	
_guy = _unitsGroupCargo select _loop;
_guy setSkill 0.8;
_guy moveInCargo _vcl_new;
_guy assignAsCargo _vcl_new; 
sleep 0.005;
};[/b]

sleep 1;

[i]// Add waypoints
_waypoint0 = _group addwaypoint[getmarkerpos"WP1",0];
_waypoint0 setwaypointtype"Move"; [/i]

[i]_waypoint1 = _group addwaypoint[getmarkerpos"WP2",0];
_waypoint1 setwaypointtype"Move"; [/i]

[b]_waypoint2 = _groupCargo addwaypoint[getmarkerpos"WP3",0];
_waypoint2 setwaypointtype"GETOUT";

_waypoint3 = _groupCargo addwaypoint[getmarkerpos"WP3",0];
_waypoint3 setwaypointtype"MOVE"; 
};[/b]

You should see whats for the "crew" and what is for the "Cargo Group".

My problem is that the Cargo Group did not "GETOUT" of the vehicle...

I also tried "UNLOAD" and TR UNLOAD" (with _group) but they dont get out...

Share this post


Link to post
Share on other sites

Is using a trigger to get them out an option? Beacuse im pretty sure that would work. Making it so that when the trigger gets activated you just add in the onact field to get them to unload. Sorry if I didnt help you its really late here and I can barely think but Im pretty sure that would work.

EDIT: Post started 2010 ..

Damnit, im stupid.. This was on the top as in the latest post and i didnt bother to check that.,

Strike one :(

Edited by Green|

Share this post


Link to post
Share on other sites

I see an issue with the way your scripting.

Your not leaving any space between some of the commands.

_waypoint0 = _group addwaypoint[getmarkerpos"WP1",0];

_waypoint0 setwaypointtype"Move";

should be

_waypoint0 = _group addwaypoint[getmarkerpos "WP1",0];

_waypoint0 setwaypointtype "Move";

ect.

Ouch just realized thread started 2010...

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  

×