Jump to content
Sign in to follow this  
BMRX

Dynamic Zombie Sandbox on Utes - Players Respawn in Water

Recommended Posts

Hello, as the title says me and a few friends wish to play the Dynamic Zombie Sandbox mission on Utes, and it works. Until you die. Once this happens we always respawn in the north eastern corner of the map very far away from land. Causing us to abort and reconnect in order to respawn.

You could say "Why not play on Chernarus?" and that's because of the simple fact that we are an 8 person server and Utes is more than big enough for us and the smaller map in fact does make it a lot of fun.

I've looked over the scripts but I am unaware of what language it is written in and I could not begin to experiment with it. The problem seems to lie in a custom script that has players respawn in random parts of the map (which is preferred) can anyone here help me?

Share this post


Link to post
Share on other sites

So from my very limited understanding of the scripting side of things. My guess is that this:

/*
Player Respawn script, beta testing version 5 [Friday, July 27]
by Craig
*/


private ["_townnumber","_town","_townpos","_group","_logic","_newPos","_building","_thing","_things","_checkVar","_dist","_dir","_pos","_check1","_check2","_armPos","_centPos","_unit","_towns"];
StartLoadingScreen["Loading Mission Components","RscLoadScreenCustom"];
_unit = _this select 0;

   _towns= townlist;
   if (CVG_playerstart == 50) then {
       if ((count _towns) != 0) then {
           _townnumber = floor (random (count _towns));
           _town = _towns select _townnumber;
           _townpos = (position _town);
           _group = createGroup sideLogic;
           _logic = _group createUnit ["Logic",_townpos, [], 100, "NONE"];  
           _newPos = position _logic;
		if (_newPos select 0 != 0) then {
           _unit setposATL _newPos;
		} else {
		_unit setpos _townPos
		};
           if (CVG_debug == 2) then {
               _unit sidechat format ["location chosen, %1",_town]
           };
       }
       else
       {
           if ((count buildings) != 0) then {
               _building = (round(random(count buildings)));
               _newpos = position (buildings select _building);
               _newpos = [_newPos,0,50,1,0,20,0] call BIS_fnc_findSafePos;
               _unit setpos _newpos;
           }
           else
           {
               _things = nearestObjects [_unit, [], 200000];
               if ((count _things) != 0) then {
                   _thing = (round(random(count _things)));
                   _newpos = position (_things select _thing);
                   _unit setpos _newpos;
               }
               else
               {
                   _newpos = [(random 1000),(random 1000),0];
                   _unit setpos _newpos;
               };
           };
       };

deleteVehicle _logic;
   };

   if (CVG_playerstart == 100) then {
       _townnumber = floor (random (count _towns));
       _town = _towns select _townnumber;
       _townpos = getpos _town;
       _checkVar = 0;
       _armPos = getArray(configFile >> "CfgWorlds" >> worldName >> "Armory" >> "positionStart");
       _centPos = getArray(configFile >> "CfgWorlds" >> worldName >> "centerPosition");

       while {_checkVar < 1} do{
           _dist = 1500;
           _dir = random 360;
           _pos = [(_townpos select 0) + (sin _dir) * _dist, (_townpos select 1) + (cos _dir) * _dist, 0];
           _pos = [_pos,0,40,4,0,20,0] call BIS_fnc_findSafePos;
           _check1 = [_pos, _armPos] call arrayCompare;
           _check2 = [_pos,_centPos] call arrayCompare;
           if ((!_check1) && (!_check2) && ((_pos distance (getpos _town)) > 1000)) then { _checkVar = 1};
       };
       _unit setpos _pos;
       _newpos = _pos;
       if (CVG_debug == 2) then {_unit sidechat format ["location chosen, %1",_pos]};
   };

   if (CVG_playerstart == 150) then {
	_unit setpos newPos;
       if (CVG_debug == 2) then {
           _unit sidechat format ["location chosen, %1",_pos];
       };
   };

diag_log format ["Respawn: %1 respawned at %2",name _unit, _newpos];


if (CVG_fog == 1) then {
   null=[_unit,100,11,30,3,7,-0.3,0.1,0.5,1,1,1,13,12,15,false,2,2.1,0.1,1,1,0,0,24] execFSM "Fog.fsm";
};

if (CVG_playerWeapons == 1) then {
   if (CVG_debug == 2) then {
       _unit sidechat "picking starting weapon";
   };
   removeAllWeapons _unit;
   [_unit] execVM "craigs_scripts\randomUnitWeapons.sqf";
};

if (CVG_playerWeapons == 2) then 
{
   removeAllWeapons _unit;
if (currentWeapon _unit != "") then {
	diag_log "First try at removing weapons failed. Trying again";
	while {currentWeapon _unit != ""} do {
		removeAllWeapons _unit;
		diag_log "Trying to remove weapons again";
	};
};
diag_log "Weapons Successfully Removed";
};


if (CVG_playerItems == 2) then 
{
_unit removeWeapon "itemMap";
if (_unit hasWeapon "itemMap") then {
	diag_log "Removing Map Failed, Trying again";
	while {_unit hasWeapon "itemMap"} do {
		_unit addWeapon "itemMap";
		diag_log "Trying to remove Map again";
	};
};
diag_log "Map removed successfully";
};

if (CVG_ZombieTowns == 4) then {
[] execVM "craigs_scripts\zombieGenerator.sqf";
};

endLoadingScreen;

sleep 5;
if (CVG_NVG == 1) then {
_unit addWeapon "NVgoggles";
if (!(_unit hasWeapon "NVgoggles")) then {
	diag_log "Adding NV Goggles Failed, Trying again";
	while {!(_unit hasWeapon "NVgoggles")} do {
		_unit addWeapon "NVgoggles";
		diag_log "Trying to add NV Goggles again";
	};
};
diag_log "Player has Night vision";
};



_messages = ["Escape this hellhole!","Survive","Lock and load","Get ready, Zombies are coming","Pillage and steal","The higher, the better","Enjoy your stay!","Like Dead Island, but better in every way","Headshots are better!!","craigvandergalien@gmail.com","Unite or Fight. Play your way"];

// words at start, dedicated can't run it
if (!isDedicated) then {
_pos = (getPosATL player);
_words = _messages call BIS_fnc_selectRandom;
waitUntil {_pos distance (getPosATL player) > .1};
   [str ("DZS:Dynamic Zombie Sandbox") ,  str (format ["%1", name player]), _words] spawn BIS_fnc_infoText;
};

Is the player random respawn, script. I am also guessing that a way to fix players re spawning in the ocean would be to use: community.bistudio.com/wiki/surfaceIsWater

Now if I knew how to properly implement it, I would.

Share this post


Link to post
Share on other sites

What is the variable "CVG_playerstart" supposed to be? Put a hint in there to see what it's value is. BIS_fnc_findsafePos function prevents you from spawning in the water, so the only time it's not being called is when CVG_playerstart == 50.

It's just using the location of the logic to set the unit, which has a 100m radius. If you're spawning in the water <100m from a town, which on Utes is likely, then that might explain why you're spawning in water. If this seems like the cause then just change the 100 to something smaller in the line "_logic = _group createUnit ["Logic",_townpos, [], 100, "NONE"]; "

Oh, and i just noticed this line

_newpos = [(random 1000),(random 1000),0];
_unit setpos _newpos;"

That could be your culprit too. It just picks a random X and Y location. Replace it with a BIS_fnc_findSafePos

You'll have to stick hints in each "If then" section to find out which one is being called when you spawn in the water. Anywhere you see SetPos without checking if it's water you'll have that problem.

Edited by kentrel

Share this post


Link to post
Share on other sites

It seems that we are actually respawning off map. Craig (the author of DZS) sent me a new script but it doesn't seem to work either. I'll try your suggestions.

When you say replace with BIS_fnc_findSafePos what do you mean? I'm not sure how to write that.

I went ahead and wrote it as

_newpos = [(random 1000),(random 1000),0 call BIS_fnc_findSafePos];
_unit setpos _newpos;

This seemed to not fix the issue. Though I probably went and wrote it wrong.

Edited by BMRX

Share this post


Link to post
Share on other sites

No, that won't work. Call FindSafePos the same way it's called there.

Your problem is probably very simple to fix, but it depends which part of the code is being called.

Anywhere you see a SetPosATL or a BIS_fnc_FindSafePos command just stick this in the line before it.

hint format["PlayerStart: %1  Buildings:%2",CVG_playerstart,count buildings];

This will help you figure out which part of the code is being called when you spawn in the water.

You should also definitely reduce this 200000 number to something more realistic to Utes, like 2000.

_things = nearestObjects [_unit, [], 200000];

Share this post


Link to post
Share on other sites

according to the original author the script isn't even being run. If this is true then I'm not sure why it works on Chernarus and not Utes.

EDIT/

It seems that after making the changes you suggested. I now (sometimes) spawn on map a few hundred meters away from floating fire lol and a boat. But if I try to respawn again, it's off the map.

Spawning on land did not happen once in the twenty respawns I did.

I'm starting to wonder if exact random respawn is the best way to go. Maybe have ten or twenty "spawn points" that players randomly spawn on instead. Though if this can be done I have no clue how.

Edited by BMRX

Share this post


Link to post
Share on other sites

I'm starting to wonder if exact random respawn is the best way to go. Maybe have ten or twenty "spawn points" that players randomly spawn on instead. Though if this can be done I have no clue how.

Yeah, pretty easily. You create your markers in the editor. Call them "One", "Two", etc

newPos = getmarkerpos (["ONE","TWO"] call BIS_fnc_selectRandom);
_unit setPos newPos;

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  

×