Jump to content
Sign in to follow this  
Chocolate

Help: Multiple Unit Spawn and moveInCargo

Recommended Posts

I have spent an unhealthy amount of time watching scripting videos, forum searching and reading BI Wiki pages. After close to 13 hours (I don't claim to be a genius; I'm trying) straight working on a map with a spawn in vehicles/units trigger I am only one step away from figuring it out.

I have three units that I want to spawn in attached to a trigger.

The trigger is working, and I have been able to get the Two vehicle w/ crew to spawn in and move on their waypoints as intended.

One BMP and one Orca

The Orca spawn-in-point also calls in a team of SUD_RU_ReconTeam

then (they) _squad2 are suppose to moveInCargo _tport (Orca)

The Orca has an TRANSPORT UNLOAD waypoint marker ontop of an invisible helipad. The team is not spawning and appearing inside the helo, so the helo just moves to its next waypoint Search and Destroy

I have double checked marker names, unit names, cfg directories. There has to be a syntax error but I can't figure it out.

I know the spawngroup for the ReconTeam works independently from the rest of the script, so I doubt that is incorrect.

Below is my script (using SUD Russians):

_crew = [];

_BMP = [];

if (isServer) then

{

_crew = creategroup independent;

_BMP = [getMarkerPos "spawnpoint1", 140, "RU_APC_BTR100_F", _crew] call BIS_fnc_spawnVehicle;

_wp1 = _crew1 addWaypoint [(getmarkerpos "wp2a"), 0];

_wp1 setWaypointType "MOVE"; _wp1 setWaypointSpeed "FULL";

_wp2 = _crew addWaypoint [(getmarkerpos "wp2b"), 0];

_wp2 setWaypointType "SAD";

_wp2 setWaypointSpeed "NORMAL";

};

_crew2 = [];

_tport = [];

_squad2 = [];

if (isServer) then

{

_crew2 = creategroup independent;

_tport = [getMarkerPos "spawnpoint2", 140, "SUD_KA60_RU", _crew] call BIS_fnc_spawnVehicle;

_squad2 = [getMarkerPos "spawnpoint2", independent, (configfile >> "CfgGroups" >> "Indep" >> "SUD_RU" >> "SpecOps" >> "SUD_ReconTeam")] call BIS_fnc_spawnGroup;

_squad2 moveInCargo _tport;

_wp1 = _squad2 addWaypoint [getMarkerPos "wp1c", 0];

_wp1 setWaypointType "SAD"; _wp1 setWaypointSpeed "FULL";

_wp1 setWaypointBehaviour "AWARE";

_wp1 setWaypointFormation "VEE";

_wp1 = _crew1 addWaypoint [(getmarkerpos "wp1a"), 0];

_wp1 setWaypointType "TRANSPORT UNLOAD"; _wp1 setWaypointSpeed "FULL";

_wp2 = _crew addWaypoint [(getmarkerpos "wp1b"), 0];

_wp2 setWaypointType "SAD";

_wp2 setWaypointSpeed "NORMAL";

};

Share this post


Link to post
Share on other sites

This spawns an Orca and a recon team, the helicopter then moves to a marker named wp1.

if (isServer) then {
_spawnVeh = [getMarkerPos "spawnMrk", 180, "O_Heli_Light_02_F", EAST] call bis_fnc_spawnvehicle;
_heli  = _spawnVeh select 0;
_crew  = _spawnVeh select 1;
_group = _spawnVeh select 2;

_grp1 = [getMarkerPos "spawnMrk", EAST, (configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> "OI_reconPatrol")] call BIS_fnc_spawnGroup;
{
	_x assignAsCargo _heli;
	_x moveInCargo _heli;
} forEach (units _grp1);

_wp1 = _group addWaypoint [getMarkerPos "wp1", 0];
_wp1 setWaypointType "MOVE"; 
_wp1 setWaypointSpeed "FULL";
};

Share this post


Link to post
Share on other sites

Well I didn't expect someone to write a script. Thank you.

02/16/2014: I have debuged your code and it does not work. I have now succeeded in spawning all of my units, but the ReconTeam does not want to spawn Inside the vehicle. I am beginning to think that this is a bug with the helo, because the command/line to spawn groups in cargo is the same everywhere I have looked. I have the right commands.

Edited by Chocolate

Share this post


Link to post
Share on other sites

Russians

https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&ved=0CCYQFjAA&url=http%3A%2F%2Fwww.armaholic.com%2Fpage.php%3Fid%3D18836&ei=askBU6DRHIKRygH5joCoCw&usg=AFQjCNFgt3L7gtXdHFnI9VZc-gFsa2A3Qg&bvm=bv.61535280,d.aWc

I sincerely appreciate your help, but I setup with your script and ran it with no results. I modified it and have both the helo and the recon team spawn in at the spawnpoint, but the team should be in the helo. Since both the helo and recon team's first waypoint is a Transport Unload/get out position they do not move once they spawn.

I created an all in editor version of what I am writing. Placed down a helo, put it in flight. placed down a recon team somewhere else on the map. Helo's first in editor waypoint was Transport unload, and Team's first way point was get out. Then in the Init field of the Recon Team members I assigned and moved to cargo. Everything worked like a charm. Recon Team was in cargo. The helo flew to the drop point and landed. Team got out, and they both went on their separate ways.

Yet, assign and movincargo/ forEach group has no effect when my sqf is executed.

Share this post


Link to post
Share on other sites

I would suggest to try with vanilla units first before trying with mod units.

There's a typo in your script. You create a group called crew but your waypoint refers to crew1

_crew = creategroup independent;

_BMP = [getMarkerPos "spawnpoint1", 140, "RU_APC_BTR100_F", _crew] call BIS_fnc_spawnVehicle;

_wp1 = _crew1 addWaypoint [(getmarkerpos "wp2a"), 0];

Share this post


Link to post
Share on other sites

Tested with the addon you are using, worked fine for me.

if (isServer) then {
   _spawnVeh = [getMarkerPos "spawnMrk", 180, "SUD_KA60_RU", INDEPENDENT] call bis_fnc_spawnvehicle;
   _heli  = _spawnVeh select 0;
   _group = _spawnVeh select 2;

   _recongrp = [getMarkerPos "spawnMrk", INDEPENDENT, (configfile >> "CfgGroups" >> "Indep" >> "SUD_RU" >> "SpecOps" >> "SUD_ReconTeam")] call BIS_fnc_spawnGroup;

   {
       _x assignAsCargo _heli;
_x moveInCargo _heli;
   } forEach (units _recongrp);

   _wp1 = _group addWaypoint [getMarkerPos "wp1", 0];
   _wp1 setWaypointType "MOVE"; 
   _wp1 setWaypointSpeed "FULL";
};

Share this post


Link to post
Share on other sites
I would suggest to try with vanilla units first before trying with mod units.

There's a typo in your script. You create a group called crew but your waypoint refers to crew1

_crew = creategroup independent;

_BMP = [getMarkerPos "spawnpoint1", 140, "RU_APC_BTR100_F", _crew] call BIS_fnc_spawnVehicle;

_wp1 = _crew1 addWaypoint [(getmarkerpos "wp2a"), 0];

Yeah, I caught that, but thanks.

cobra4v320. That is awesome if it works, but I would be damned if I can explain why it works for you and not myself. I will take your new code today and plug it in. See if everything goes correctly. I have already ran code that as far as I could tell is exactly what you have above with no luck. Since I am new to this I am sure its my fault. I just wish I new wtf I was doing wrong.

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  

×