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:
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):
To this:
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
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 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: