Home   Help Search Login Register  

Author Topic: HELP: Spawning troops from heli on battlefield ? ? ?  (Read 3061 times)

0 Members and 1 Guest are viewing this topic.

Offline CaptainBravo

  • Members
  • *
Hey everyone,

I have searched for a certain spawn script and having diffuculty locating it.

I am making a mission where Helicopters will continue landing and unloading troops as soon as it lands and take off again to and come back again carring more troops battle field. If a helicopter is shut down no more troops.

Any ideas on how to achieve that?

Thanks for any help.
« Last Edit: 29 Aug 2009, 10:38:31 by CaptainBravo »

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Spawning troops from heli on battlefield
« Reply #1 on: 26 Aug 2009, 14:15:04 »
Yes, basically you have a cycle waypoint for the chopper, so that it starts from a position, goes to another where it gets out any cargo inside and goes back to the original WP. In the original WP you may add as action associated with the WP the execution of a script that creates a group of soldiers ans moves it in cargo, this group of soldiers must also have a WP created somewhere in the battle area.

So, each time the Chopper pass through WP1, the soldier group is created and moved in cargo, the chopper moves to WP2 and unloads it and returns to WP1, and so on forever while the chopper is flying.

Offline CaptainBravo

  • Members
  • *
Re: Spawning troops from heli on battlefield
« Reply #2 on: 26 Aug 2009, 14:45:56 »
Thanks Mandoble for your quick response.

It does sound simpler than I thought .. but since I am a first grade scripter I am not sure how to implement    :scratch:

I usually use (more like copy and paste) Norrin's spawn script (usually spawn on marker)

Any detailed answer for 1st graders on where to start is highly appreciated  :whistle:

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Spawning troops from heli on battlefield
« Reply #3 on: 26 Aug 2009, 19:54:50 »
Hope this helps.

Code: [Select]
// CreateAndCargo.sqf
// [chopper, side, group unit classes, destination] execVM "CreateAndCargo.sqf";
// group unit classes is an array of soldier classes, one class per each member of the group
// destination is a position where the group will move once unloaded

private["_chopper", "_targetpos", "_group_i", "_i", "_unit", "_wp", "_side"];
_chopper         = _this select 0;
_side              = _this select 1;
_infantrytypes  = _this select 2;
_targetpos       = _this select 3;



_group_i = createGroup _side;
_i = 0;
{
    if (_i == 0) then
    {
        _unit = _group_i createUnit [_x,[0,0,30], [], 0, "NONE"];
        _unit setCombatMode "RED";
        _unit setBehaviour "AWARE";
        _unit setRank "CORPORAL";
        _group_i selectLeader _unit;
    }
    else
    {
        _unit = _group_i createUnit [_x,[0,0,30], [], 0, "NONE"];
        _unit setCombatMode "RED";
        _unit setBehaviour "AWARE";
        _unit setRank "PRIVATE";
    };
    _unit setskill 0.5;
    _unit moveInCargo _plane;
    _i = _i + 1;
} forEach _infantrytypes;

_wp = _group_i addWaypoint [_targetpos, 0];
[_group_i, 1] showWaypoint "NEVER";
[_group_i, 1] setWaypointType "MOVE";

Offline CaptainBravo

  • Members
  • *
Re: Spawning troops from heli on battlefield
« Reply #4 on: 27 Aug 2009, 11:23:23 »
Thanks Mandoble for your detailed response. I shall look work on it tonight and hopefully get it to work.

I understand the concept it is the details I am bit skitchy about :)

Spawning the troops is what I am a bit unclear about. How are you specifying how many and what type of soldiers to be spawned?

Thanks again for your helpful answers.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Spawning troops from heli on battlefield
« Reply #5 on: 27 Aug 2009, 13:44:19 »
By the array of soldier classes, lets suppose you want to have a group of 3 soldiers of type "sol1" and one soldier of type "sol3", then for the third parameter of the script you would use ["sol1","sol1","sol1", "sol3"];

Ex:
Code: [Select]
[chopper1, west, ["USMC_Soldier_Officer", "USMC_Soldier_Medic", "USMC_Soldier_MG", "USMC_Soldier_MG", "USMC_Soldier_MG"], getPos my_gl_target1]execVM"CreateAndCargo.sqf";

In this case the group will have 5 members, an officer, a medic and three mgs.

For a list of ArmA2 unit types check Arma2 CfgVehicles.

Offline CaptainBravo

  • Members
  • *
Re: Spawning troops from heli on battlefield
« Reply #6 on: 28 Aug 2009, 00:03:27 »
Thanks Mandoble for your great help.

I have attahced sample mission of helicopter with waypoints but no troops spwaning when it reaches WP. I am almost there yet I am messing up somewhere  :scratch:

If you can take a look at it whenever you get a chance I would be highly appreciative and I will owe you a drink whenever you are in London!  :)

Thanks again for your great help.
« Last Edit: 29 Aug 2009, 10:36:16 by CaptainBravo »

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Spawning troops from heli on battlefield
« Reply #7 on: 28 Aug 2009, 00:23:27 »
Please, attach only missions editor-friendly, not PBOs, just compress your example mission folder and attach it.

Offline CaptainBravo

  • Members
  • *
Re: Spawning troops from heli on battlefield
« Reply #8 on: 28 Aug 2009, 00:42:37 »
Sorry about that. I have attached editor sample. Thanks again for taking the time to look at it.

---------

Hi Mandoble, have you had a chance to figure out what I left off for script to work??

Thanks.
« Last Edit: 29 Aug 2009, 10:37:09 by CaptainBravo »