[DayZ Spawn Selection] Setup Completed, please wait... forever on my mod.

Yuvalino

New Member
Okey. So in my mod, I edited the DayZ Spawn Selection.
I did it in 2 stages.

In the first stage I made all the custom *.paa files and edited the display with the *.hpp config.
Until then everything was fine (Except for the spawn locations being at the sea because I'm using a custom map.).

after I tested this stage everything was fine.

In the 2nd stage I actually scripted the spawn points.

I did it by scripting a new array in init.sqf that contains all spawnpoints like this:
Code:
spawnarray = [
/*Location 1*/ [[X,Y,Z],[X,Y,Z]],
/*Location 2*/ [[X,Y,Z],[X,Y,Z]],
/*Location 3*/ [[X,Y,Z],[X,Y,Z]],
/*Random Locations*/ [[X,Y,Z],[X,Y,Z]]
];
So basicly, on server_playerSetup, the server will determine which location to choose by using the variable _spawnSelection (the variable which contains the location a player chose in the selection), and then will choose a random spawn point that is set around that place (where you see 2 coordinates in the code above, it's actually 20 in my script -_-).

So to do that, I changed this script (in server_playerSetup):
Code:
if (_randomSpot) then {
    private["_counter","_position","_isNear","_isZero","_mkr"];
    if (!isDedicated) then {
        endLoadingScreen;
    };
    if (worldName in ["dzhg", "panthera2", "Sara", "Utes", "Dingor", "namalsk", "isladuala", "Tavi", "dayznogova","tasmania2010"]) then { _IslandMap = true; } else { _IslandMap = false; };

    //spawn into random
    _findSpot = true;
    _mkr = [];
    _position = [0,0,0];
    for [{_j=0},{_j<=100 AND _findSpot},{_j=_j+1}] do {
        if (_spawnSelection == 9) then {
        // random spawn location selected, lets get the marker and spawn in somewhere
            if (dayz_spawnselection == 1) then { _mkr = getMarkerPos ("spawn" + str(floor(random 6))); } else { _mkr = getMarkerPos ("spawn" + str(floor(random 5))); };
        } else {
            // spawn is not random, lets spawn in our location that was selected
            _mkr = getMarkerPos ("spawn" + str(_spawnSelection));
        };
        _position = ([_mkr,0,1400,10,0,2,1] call BIS_fnc_findSafePos);
        if ((count _position >= 2) // !bad returned position
            AND {(_position distance _mkr < 1400)}) then { // !ouside the disk
            _position set [2, 0];
            if (((ATLtoASL _position) select 2 > 2.5) //! player's feet too wet
            AND {({alive _x} count (_position nearEntities ["Man",150]) == 0)}) then { // !too close from other players/zombies
                _pos = +(_position);
                _isIsland = false;        //Can be set to true during the Check
                // we check over a 809-meter cross line, with an effective interlaced step of 5 meters
                for [{_w = 0}, {_w != 809}, {_w = ((_w + 17) % 811)}] do
                {
                    //if (_w < 17) then { diag_log format[ "%1 loop starts with _w=%2", __FILE__, _w]; };
                    _pos = [((_pos select 0) - _w),((_pos select 1) + _w),(_pos select 2)];
                    if((surfaceisWater _pos) and (!_IslandMap)) exitWith {
                        _isIsland = true;
                    };
                };
                if (!_isIsland) then {_findSpot = false};
            };
        };
        //diag_log format["%1: pos:%2 _findSpot:%3", __FILE__, _position, _findSpot];
    };
    if ((_findSpot) and (!_IslandMap)) exitWith {
        diag_log format["%1: Error, failed to find a suitable spawn spot for player. area:%2",__FILE__, _mkr];
    };
    _worldspace = [0,_position];
};

To this:

Code:
if (_randomSpot) then {
    private["_position"];
    if (!isDedicated) then {
    endLoadingScreen;
    };
    _position = [0,0,0];
    for [{_j=0},{_j<=100 AND _findSpot},{_j=_j+1}] do {
 
        _arr_spawnPos = (survivorspawnpoints select _spawnSelection); // THE SPAWN ARRAY

        while {_findSpot} do {
            _position = _arr_spawnPos select (round(random ((count _arr_spawnPos) - 1)));
        };
     
        _worldspace = [0,_position];
    };
};

The array survivorspawnpoints is the array I set in init.sqf

Now each time I join my server with the mod and map loaded, I stay in the Setup Complete, please Wait message when loading the game.

When I reverted back my server_playerSetup.sqf to the original one it worked fine. But I've been looking at it in the last 5 hours and couldn't find the problem...........

I've tested everything I could...

I've also notice this problem happens even if my character is already alive (where the selection is not needed and I spawn instantly in my last location and last character).

PLEASE HELP ME.
I'm losing my mind.

EDIT: 1 problem get solved and another pops up. I added _position = [_position select 0, _position select 1, 0]; after the 5th line from the end. I seem to spawn now but in the sea, with the message cant count magazine popping up. HELP
 
Last edited:
Did you edit your init.sqf and allow spawn selection?
Did you call the player_monitor.fsm manually from the mission Folder?
Did you edit the player_monitor.fsm to actually create the spawn selection?


In init.sqf place:

PHP:
dayz_spawnselection = 1;
Step 1: In Mission Folder create a new Folder named "custom".

Step 2: Open init.sqf (Mission Folder) and change the Player Monitor Path:
PHP:
if (!isDedicated) then {
    //Run the player monitor
    _id = player addEventHandler ["Respawn", {_id = [] spawn player_death;}];
    _playerMonitor =     [] execVM "custom\player_monitor.sqf";
};

Step 3: create custom\player_monitor.sqf:
PHP:
if (isServer) then {
    waitUntil{dayz_preloadFinished};
};
_id = [] execFSM "custom\player_monitor.fsm";
if (DZE_R3F_WEIGHT) then {
    _void = [] execVM "\z\addons\dayz_code\external\R3F_Realism\R3F_Realism_Init.sqf";
};

Step 4: Download the FSM Editor.

Step 5: Ediot player_monitor.fsm to fit your needs. Will provide mine as example:
https://www.dropbox.com/s/h0u22s3upf0fecr/player_monitor.fsm

Step 6: Open the player_monitor.fsm and delete what you don't need.
tYdUahr.png


Step 7: After deleting the Items you mist re-link the Selector:
QP6LLuc.png


Step 8: Fit the Selector to match your names:
3EMN7jT.png


Step 9: Save and finish.
In Order to actually get the selction you must add a Action to your class. Here an example of mine:
Code:
class RscSelectedRegion1 : RscActiveText
        {
            idc = -1;
            style = 48;
            text = "Test";
            x = 0.524899 * safezoneW + safezoneX;
            y = 0.591199 * safezoneH + safezoneY;
            w = 0.234287 * safezoneW;
            h = 0.3044 * safezoneH;
            colorBackground[] = {-1,-1,-1,0};
            color[] = { 0.5, 0.5, 0.5, 1 };
            colorActive[] = { 1, 1, 1, 1 };
            action = "closeDialog 0;dayz_selectRegion = 1;";
            onMouseEnter = "ctrlSetFocus (_this select 0)";
 
What do you mean? I am using the the regular DayZ 1.8.0.3 server and client files. dayz_spawnSelection is enabled (set to 1). I didn't touch player_monitor. I only edited the RscDisplaySpawnSelector.hpp config file to set the textures straight, edited init.sqf inside the @dayz_code to add the survivorspawnpoints array and edited server_playerSetup.sqf like I've shown above to make my spawns work. I didn't touch player_monitor at all and I can't understand why would I do that either.
 
edited init.sqf inside the @dayz_code to add the survivorspawnpoints array

That's wrong. You do not want to edit the dayz_code.pbo, because that means you'll have a custom Client and everybody who wants to connect to your server must download that custom client from your homepage or something.

The only way to do it is via the missions. That's why you want to create a custom player_monitor.sqf and player_monitor.fsm.

If using Chernarus Map you can copy the files from here:

http://epochmod.com/forum/index.php?/topic/6332-howto-add-chernarus-spawnselection/
 
That's wrong. You do not want to edit the dayz_code.pbo, because that means you'll have a custom Client and everybody who wants to connect to your server must download that custom client from your homepage or something.

The only way to do it is via the missions. That's why you want to create a custom player_monitor.sqf and player_monitor.fsm.

If using Chernarus Map you can copy the files from here:

http://epochmod.com/forum/index.php?/topic/6332-howto-add-chernarus-spawnselection/

Nooo man you don't get me :D. It's a mod! I want to minimize the download from server side (mpmissions) as much as possible. I don't want a custom server. I want to create my own mod, so I could play with it and maybe even release it one day.

So how do I fix my problem now?
 
Aye, i got you. But you still have to edit the player_monitor.fsm file, but you can keep it in the current loaction tho. It's neccessary and as far as i know there's no other way, because the setup runs trought that monitor every time and if you change the setup you'll have to monitor it to.

Ofc i can be wrong and there is another way, but i don't know bout it.


PS: Did you try to just read the marker position from mission.sqm File and spawn the player there? Could do it for example with a scroll wheel menu every once the player freshly spawned ((if freshspawn == 2) then { addaction };)
 
Aye, i got you. But you still have to edit the player_monitor.fsm file, but you can keep it in the current loaction tho. It's neccessary and as far as i know there's no other way, because the setup runs trought that monitor every time and if you change the setup you'll have to monitor it to.

Ofc i can be wrong and there is another way, but i don't know bout it.


PS: Did you try to just read the marker position from mission.sqm File and spawn the player there? Could do it for example with a scroll wheel menu every once the player freshly spawned ((if freshspawn == 2) then { addaction };)

But what to edit? Which section? Can you tell me?
 
I don't think I need to edit it because it's all the same, and my spawn selections work perfect. It's just when I spawn, my client is stuck on "Setup Completed, please wait". Fix me if I'm wrong?

In your Code you're using a selection
PHP:
_arr_spawnPos = (survivorspawnpoints select _spawnSelection); // THE SPAWN ARRAY

_spawnSelection... Obviously it's all cool - just untill it actually wants to spawn the player. It find the array and bla, but there is no _spawnSelection, because you'll have to set that in the .fsm.

Try:
PHP:
if(!_spawnSelection) then {
_spawnSelection = 1;
_arr_spawnPos = (survivorspawnpoints select _spawnSelection); // THE SPAWN ARRAY
};

Just to see, if that fixed your problem.
 
In your Code you're using a selection
PHP:
_arr_spawnPos = (survivorspawnpoints select _spawnSelection); // THE SPAWN ARRAY

_spawnSelection... Obviously it's all cool - just untill it actually wants to spawn the player. It find the array and bla, but there is no _spawnSelection, because you'll have to set that in the .fsm.

Try:
PHP:
if(!_spawnSelection) then {
_spawnSelection = 1;
_arr_spawnPos = (survivorspawnpoints select _spawnSelection); // THE SPAWN ARRAY
};

Just to see, if that fixed your problem.

I will give you results tomorrow! Should I replace my line with it or put it under my line?
 
Back
Top