Jump to content
Sign in to follow this  
Luft08

Spawning units that show up in the lobby

Recommended Posts

I want to spawn a convoy and then allow players to select any unit in that convoy they wish to play. I have a script that spawns a convoy that gets run in the initServer script. The LFT_CreateConvoy function uses BIS_fnc_spawnVehicle for each vehicle type which produce an array [vehicle, crewArray, group] which I pushBack into a global array LFT_Convoy:

if(!isServer) exitWith {};

private _vehicleTypes = ["B_APC_Wheeled_01_cannon_F", "B_Truck_01_ammo_F", "B_Truck_01_medical_F", "B_Truck_01_fuel_F", "B_Truck_01_Repair_F", "B_Truck_01_transport_F", "B_MRAP_01_hmg_F"];
private _side = west; 

private _startPos = [11328.6,3241.32,0];
private _spacing = 25; 
private _direction = 304.631;
LFT_Convoy = [_vehicleTypes, _startPos, _side, _spacing, _direction] call LFT_CreateConvoy;

{
    // Extract the crew array from the current element of Lft_Convoy
    private _crewArray = _x select 1;

    // Iterate over each element in the crew array
    {
        // Set the variable "playable" to true for each crew member
        _x setVariable ["playable", true];
    } forEach _crewArray;

} forEach Lft_Convoy;

This code gets run in the initServer script. I believe that is before the lobby but when the lobby is displayed there are no slots available. Can spawned units be made to appear in the lobby?

Share this post


Link to post
Share on other sites
6 hours ago, Luft08 said:

Can spawned units be made to appear in the lobby?

 

I'm fairly sure that lobby slots are derived from the mission sqm, so No... but I also haven't tried. If someone has succeeded please do tell.

 

In the meantime your best bet is to place playable units and move them into the correct seat as the player loads in (initPlayerLocal). You can hide it behind a loading screen if you wish, the player won't know the difference if you do it right.

  • Like 2

Share this post


Link to post
Share on other sites

To my knowledge to mess with the lobby and how it functions you cant do that with EventScripts you will have to make a custom mod for that. There is a way to create custom lobby and do what you want but its way to trublesome to be created for 1 time use.
Here is a example of custom lobby that commy2 made but this was made 7 years ago and i am almost 100% certian that somethings might be broken but if you want to continue this way its a good place to start:
https://github.com/commy2/Arma-3-Scripted-Lobby

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  

×