Jump to content
  • 0

Custom Spawn and Respawn Positions


CloudLEL

Question

Hello,

 

I've seen it done around, but I was wondering how you get custom spawn positions as well as re-spawn positions. So for example, I don't want to spawn in that room with the tubes and the bodies, I'd like to spawn on the coast somewhere, preferably randomized. And as for re spawning, when you die, you should also spawn in a random position.

 

I've tried stripping out the code for the debug area, as well as changing the coordinates, but nothing seems to work.

 

Can anyone shed some light?

 

Thanks!

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

This is what i use for respawning at random location.

 

You can use this for a random location on the map not in water for random respawn position.

_pos = ["water","out"] call BIS_fnc_randomPos;

Or you can use this to respawn at a random location that you have selected around the map.

_coord = [
                [14522.3, 2256.46, 0.00130463],
                [14522.3, 2256.46, 0.00130463],
                [14522.3, 2256.46, 0.00130463],
                [14522.3, 2256.46, 0.00130463],
                [14522.3, 2256.46, 0.00130463],
                [14522.3, 2256.46, 0.00130463],
                [14522.3, 2256.46, 0.00130463],
                [14522.3, 2256.46, 0.00130463],
                [14522.3, 2256.46, 0.00130463],
                [14522.3, 2256.46, 0.00130463]
            ] call BIS_fnc_selectRandom;

And this is how my spawn.sqf looks like:

//Custom loadout
private ["_player","_pos"];

if (!isServer) then {
    waitUntil {!isNull player};
    waitUntil {player == player};
    
    while {true} do {
            _player = player;
            player addEventHandler ["Respawn", {

            _PistolANDmag = [["hgun_Pistol_heavy_02_Yorris_F","6Rnd_45ACP_Cylinder"],["hgun_Pistol_heavy_02_F","6Rnd_45ACP_Cylinder"],["hgun_Pistol_heavy_01_MRD_F","11Rnd_45ACP_Mag"],["hgun_Pistol_heavy_01_snds_F","11Rnd_45ACP_Mag"],["hgun_Pistol_heavy_01_F","11Rnd_45ACP_Mag"],["hgun_ACPC2_snds_F","9Rnd_45ACP_Mag"],["hgun_ACPC2_F","9Rnd_45ACP_Mag"],["hgun_Rook40_snds_F","16Rnd_9x21_Mag"],["hgun_Rook40_F","16Rnd_9x21_Mag"],["hgun_P07_snds_F","16Rnd_9x21_Mag"],["hgun_P07_F","16Rnd_9x21_Mag"]] call BIS_fnc_selectRandom;
            _pistol = _PistolANDmag select 0;
            _mag = _PistolANDmag select 1;
            _item = "FAK";
            _food = ["FoodBioMeat","FoodMeeps","FoodSnooter","FoodWalkNSons","sardines_epoch","meatballs_epoch","scam_epoch","sweetcorn_epoch"] call BIS_fnc_selectRandom;
            _drink = ["ItemSodaRbull","ItemSodaOrangeSherbet","ItemSodaPurple","ItemSodaMocha","ItemSodaBurst","FoodWalkNSons","WhiskeyNoodle"] call BIS_fnc_selectRandom;
            _uniform = ["U_C_Journalist","U_C_WorkerCoveralls","U_C_Poor_1","U_C_Poloshirt_redwhite","U_C_Poloshirt_salmon","U_C_Poloshirt_tricolour","U_C_Poloshirt_burgundy","U_C_Poloshirt_blue","U_C_Poloshirt_stripped"] call BIS_fnc_selectRandom;
            _vest = ["V_16_EPOCH","V_15_EPOCH","V_14_EPOCH","V_13_EPOCH","V_12_EPOCH","V_11_EPOCH","V_10_EPOCH","V_9_EPOCH","V_8_EPOCH","V_7_EPOCH","V_6_EPOCH","V_5_EPOCH","V_4_EPOCH","V_3_EPOCH","V_2_EPOCH","V_1_EPOCH"] call BIS_fnc_selectRandom;
            _pos = ["water","out"] call BIS_fnc_randomPos;
/*            _coord = [
                [14522.3, 2256.46, 0.00130463],
                [14522.3, 2256.46, 0.00130463],
                [14522.3, 2256.46, 0.00130463],
                [14522.3, 2256.46, 0.00130463],
                [14522.3, 2256.46, 0.00130463],
                [14522.3, 2256.46, 0.00130463],
                [14522.3, 2256.46, 0.00130463],
                [14522.3, 2256.46, 0.00130463],
                [14522.3, 2256.46, 0.00130463],
                [14522.3, 2256.46, 0.00130463]
            ] call BIS_fnc_selectRandom;
*/
            player addVest _vest;
            player addWeapon _pistol;
            player addMagazine _mag;
            player addMagazine _item;
            player addMagazine _food;
            player addMagazine _drink;
            player addWeapon "EpochRadio0";
            player setPos _pos;
            EPOCH_playerCrypto = 10;
            EPOCH_playerEnergy = 100;
            
                _Male = (typeOF player == "Epoch_Male_F");    
        // Male Model
                if (_Male) then {
                    player forceAddUniform _uniform;
                    1 fadeSound 1;
                    1 fadeMusic 1;
                    earplugsout=true;
                    radio=true;
                    playMusic "";
        // Female Model
                }else{
                    player forceAddUniform "U_BasicBodyFemale";
                    1 fadeSound 1;
                    1 fadeMusic 1;
                    earplugsout=true;
                    radio=true;
                    playMusic "";
                };
        }]; waitUntil {_player != player};
    };
};

 

Link to comment
Share on other sites

  • 0

Sadly yes, the first time you log in to the server, you will spawn at the big box. It will only work after you respawn/die.

 

I think you will also spawn in the big box if you die and don't make a new character just before a server restart.

 

At least it's a start and hope it helps you find what you looking for.

 

You could maybe take it as an advantage and place some special thing in that big box for when new poeple join and such.

Link to comment
Share on other sites

  • 0

This is what i use for respawning at random location.

 

You can use this for a random location on the map not in water for random respawn position.

_pos = ["water","out"] call BIS_fnc_randomPos;
Or you can use this to respawn at a random location that you have selected around the map.

_coord = [
                [14522.3, 2256.46, 0.00130463],
                [14522.3, 2256.46, 0.00130463],
                [14522.3, 2256.46, 0.00130463],
                [14522.3, 2256.46, 0.00130463],
                [14522.3, 2256.46, 0.00130463],
                [14522.3, 2256.46, 0.00130463],
                [14522.3, 2256.46, 0.00130463],
                [14522.3, 2256.46, 0.00130463],
                [14522.3, 2256.46, 0.00130463],
                [14522.3, 2256.46, 0.00130463]
            ] call BIS_fnc_selectRandom;
And this is how my spawn.sqf looks like:

//Custom loadout
private ["_player","_pos"];

if (!isServer) then {
    waitUntil {!isNull player};
    waitUntil {player == player};
    
    while {true} do {
            _player = player;
            player addEventHandler ["Respawn", {

            _PistolANDmag = [["hgun_Pistol_heavy_02_Yorris_F","6Rnd_45ACP_Cylinder"],["hgun_Pistol_heavy_02_F","6Rnd_45ACP_Cylinder"],["hgun_Pistol_heavy_01_MRD_F","11Rnd_45ACP_Mag"],["hgun_Pistol_heavy_01_snds_F","11Rnd_45ACP_Mag"],["hgun_Pistol_heavy_01_F","11Rnd_45ACP_Mag"],["hgun_ACPC2_snds_F","9Rnd_45ACP_Mag"],["hgun_ACPC2_F","9Rnd_45ACP_Mag"],["hgun_Rook40_snds_F","16Rnd_9x21_Mag"],["hgun_Rook40_F","16Rnd_9x21_Mag"],["hgun_P07_snds_F","16Rnd_9x21_Mag"],["hgun_P07_F","16Rnd_9x21_Mag"]] call BIS_fnc_selectRandom;
            _pistol = _PistolANDmag select 0;
            _mag = _PistolANDmag select 1;
            _item = "FAK";
            _food = ["FoodBioMeat","FoodMeeps","FoodSnooter","FoodWalkNSons","sardines_epoch","meatballs_epoch","scam_epoch","sweetcorn_epoch"] call BIS_fnc_selectRandom;
            _drink = ["ItemSodaRbull","ItemSodaOrangeSherbet","ItemSodaPurple","ItemSodaMocha","ItemSodaBurst","FoodWalkNSons","WhiskeyNoodle"] call BIS_fnc_selectRandom;
            _uniform = ["U_C_Journalist","U_C_WorkerCoveralls","U_C_Poor_1","U_C_Poloshirt_redwhite","U_C_Poloshirt_salmon","U_C_Poloshirt_tricolour","U_C_Poloshirt_burgundy","U_C_Poloshirt_blue","U_C_Poloshirt_stripped"] call BIS_fnc_selectRandom;
            _vest = ["V_16_EPOCH","V_15_EPOCH","V_14_EPOCH","V_13_EPOCH","V_12_EPOCH","V_11_EPOCH","V_10_EPOCH","V_9_EPOCH","V_8_EPOCH","V_7_EPOCH","V_6_EPOCH","V_5_EPOCH","V_4_EPOCH","V_3_EPOCH","V_2_EPOCH","V_1_EPOCH"] call BIS_fnc_selectRandom;
            _pos = ["water","out"] call BIS_fnc_randomPos;
/*            _coord = [
                [14522.3, 2256.46, 0.00130463],
                [14522.3, 2256.46, 0.00130463],
                [14522.3, 2256.46, 0.00130463],
                [14522.3, 2256.46, 0.00130463],
                [14522.3, 2256.46, 0.00130463],
                [14522.3, 2256.46, 0.00130463],
                [14522.3, 2256.46, 0.00130463],
                [14522.3, 2256.46, 0.00130463],
                [14522.3, 2256.46, 0.00130463],
                [14522.3, 2256.46, 0.00130463]
            ] call BIS_fnc_selectRandom;
*/
            player addVest _vest;
            player addWeapon _pistol;
            player addMagazine _mag;
            player addMagazine _item;
            player addMagazine _food;
            player addMagazine _drink;
            player addWeapon "EpochRadio0";
            player setPos _pos;
            EPOCH_playerCrypto = 10;
            EPOCH_playerEnergy = 100;
            
                _Male = (typeOF player == "Epoch_Male_F");    
        // Male Model
                if (_Male) then {
                    player forceAddUniform _uniform;
                    1 fadeSound 1;
                    1 fadeMusic 1;
                    earplugsout=true;
                    radio=true;
                    playMusic "";
        // Female Model
                }else{
                    player forceAddUniform "U_BasicBodyFemale";
                    1 fadeSound 1;
                    1 fadeMusic 1;
                    earplugsout=true;
                    radio=true;
                    playMusic "";
                };
        }]; waitUntil {_player != player};
    };
};

A quick question does ur player crypto work ? For some reason players loose their crypto on purchasing items, any reason y this happens

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...