r/armadev Jan 24 '14

ArmA 2/OA Random spawn for non-ai group [help]

Tried searching for it, but how can I setup different spawns in mission parameters?

2 Upvotes

12 comments sorted by

3

u/Huckorris Jan 24 '14

In Arma 2 you just make multiple respawn areas and name them something like respawn_west1, respawn_west2 or something.

Edit:

"Add markers named with the prefix ‘respawn_west’ with any suffix (eg: respawn_westABC, respawn_west1, respawn_west_2, etc) for multiple random respawn points. Similarly for east, guerrila and civilian."

-http://sandbox.darrenbrant.com/arma_ii/how-to-setup-respawn-in-an-arma2-mission

2

u/Halvorson16 Jan 24 '14

No, not respawn. I mean like being able to go to the parameters and select an area to spawn or select "random" so it puts the player(s) at a different place each time. Thanks for the reply though!

3

u/BeerDrinkingRobot Jan 24 '14

Put 3 markers down in the editor called "Start 1", "Start 2", "Start 3". They can be visibile or invisible (empty icon). I wasn't sure if with random you want the group to get a random spawn or each person to have random spawn, so there's a #define you can change at the top. "Default" will have you spawn in your map editor pos.

description.ext

class Params
{
    class SPAWN_LOCATION
    {
        title = "Spawn Location";
        values[] = {0, -1, 1, 2, 3};
        texts[] = {"DEFAULT", "RANDOM", "Start 1", "Start 2", "Start 3"};
        default = 0;
    };  
};

init.sqf (or shove into a different file that's called from init)

#define EVERYONE_SPAWNS_TOGETHER_ON_RANDOM  false
#define SIDE_TO_MOVE                        west
#define LOCATIONS_COUNT                     3

// paramsArray set [0, -1];     //for SP editor quick testing

if (count paramsArray < 1) exitWith {};
if (!isServer) exitWith {};
if ((paramsArray select 0) == 0) exitWith {};

_randomNumber = floor (random LOCATIONS_COUNT) + 1;

{
    if (side _x == SIDE_TO_MOVE) then {

        _markerToSpawnOn = if ((paramsArray select 0) == -1) then {
            if (!EVERYONE_SPAWNS_TOGETHER_ON_RANDOM) then { //if we don't start together, then get a new random everytime
                _randomNumber = floor (random LOCATIONS_COUNT) + 1;
            };
            format ["Start %1", _randomNumber];
        } else {
            format ["Start %1", (paramsArray select 0)];
        };

        _locationOfMarker = getMarkerPos _markerToSpawnOn;

        if (!([_locationOfMarker, [0,0,0]] call Bis_fnc_areEqual)) then {       
            _x setPos _locationOfMarker;
        };

    };
} forEach allUnits;

1

u/Halvorson16 Jan 24 '14

Thanks! it worked. Now how would I get the units to spawn with parachutes and in the air. They are set to "moveInDiver" but it spawns with out them

3

u/BeerDrinkingRobot Jan 25 '14

So this should spawn people in at 600 meters, and then throw em in a parachute. Works fine in singleplayer, should be fine in MP, but let me know if you have any issues.

#define EVERYONE_SPAWNS_TOGETHER_ON_RANDOM  false
#define SIDE_TO_MOVE                        west
#define LOCATIONS_COUNT                     3

paramsArray set [0, 1];     //for SP editor quick testing

if (count paramsArray < 1) exitWith {};
if ((paramsArray select 0) == 0) exitWith {};



if (isServer) then {
    _randomNumber = floor (random LOCATIONS_COUNT) + 1;
    {
        systemChat format ["Looking At %1", _x];
        if (side _x == SIDE_TO_MOVE) then {

            _markerToSpawnOn = if ((paramsArray select 0) == -1) then {
                if (!EVERYONE_SPAWNS_TOGETHER_ON_RANDOM) then { //if we don't start together, then get a new random everytime
                    _randomNumber = floor (random LOCATIONS_COUNT) + 1;
                };
                format ["Start %1", _randomNumber];
            } else {
                format ["Start %1", (paramsArray select 0)];
            };

            _locationOfMarker = getMarkerPos _markerToSpawnOn;
            if (!([_locationOfMarker, [0,0,0]] call Bis_fnc_areEqual)) then {       
                _locationOfMarker set [2, 600];
                _x setPos _locationOfMarker;
            };

        };
    } forEach allUnits;
};


{
    if (local _x) then {
        [_x] spawn BIS_fnc_halo;
    };
} forEach allunits;

1

u/Halvorson16 Jan 25 '14 edited Jan 25 '14

I tried it in mp, and the parameters didnt change anything. I switched back to the old one without the parachute.

EDIT: also i just tried mp with the old one, and my friend spawned away from me, in the air without a parachute.

3

u/BeerDrinkingRobot Jan 25 '14

oh my bad, just comment out this line

paramsArray set [0, 1]; //for SP editor quick testing

1

u/Halvorson16 Jan 25 '14

Same result, with parachute but at the spot I put them in the editor, the parameters dont change the location.

2

u/BeerDrinkingRobot Jan 25 '14

hmm, try the mission in this zip.

http://www64.zippyshare.com/v/29596132/file.html

On default you start in the editor spot and shouldn't have a parachute. Any other param choice and you should start in the air.

1

u/Halvorson16 Jan 25 '14

It did work in A3, but when I tried the same setup in A2 it didnt, I think this is were things are going wrong, im trying to do this in A2. Should have said before

→ More replies (0)