Jump to content

Random Spawn Script


Matijs

Recommended Posts

That's fine, there aren't that many maps...

 

Use this array that owner can define as many/few as they want:

_spawnpointsarray = [
[1745,2107,0.1],
[2737,1980,0.1],
[3663,2130,0.1]
];

Then make this use the array to pick coords, and then the findsafepos call to put the player within 1500m of it:

_selectspawnpoint = _spawnpointsarray select floor random count _spawnpointsarray;
thePlayer setPos _selectspawnpoint;

Possible?

Link to comment
Share on other sites

That's fine, there aren't that many maps...

 

Use this array that owner can define as many/few as they want:

_spawnpointsarray = [
[1745,2107,0.1],
[2737,1980,0.1],
[3663,2130,0.1]
];

Then make this use the array to pick coords, and then the findsafepos call to put the player within 1500m of it:

_selectspawnpoint = _spawnpointsarray select floor random count _spawnpointsarray;
thePlayer setPos _selectspawnpoint;

Possible?

_selectspawnpoint = _spawnpointsarray call BIS_fnc_selectRandom;

better btw : ) instead of select floor random count

Link to comment
Share on other sites

This is what i´ve done and tested so far

 

Change in mission.sqm (distance of <50) leads to unwanted ports when approaching the spawn-area (eg on stratis)

	class Sensors
    {
        items=1;
        class Item0
        {
            position[]={1719.4357,5.5,5120.9775}; //Spawnpoint coords (same as respawn_west & east)
            activationBy="ANY";
            repeating=1;
            interruptable=1;
            age="UNKNOWN";
            name="SPAWNPOINT";
            expCond="(player distance SPAWNPOINT) < 10;";
            expActiv="inSpawnPoint = true;";
            expDesactiv="inSpawnPoint = false;";
            class Effects
            {
            };
        };
    };

init.sqf

if(toLower worldName in ["chernarus","chernarus_summer"])then{
	([4654.62,9593.63,0] nearestObject 145259) setDamage 1;
	([4654.62,9593.63,0] nearestObject 145260) setDamage 1;
};	//Fix for something, find out ;)

[] execVM "scripts\randomspawn.sqf";

randomspawn.sqf (enhanced with clothes on start ^^ )

if (isNil "inSpawnPoint") then {
	inSpawnPoint = false;
};
 
while {true} do {
	waitUntil { inSpawnPoint };
	waitUntil { player == vehicle player };
	thePlayer = vehicle player;
	_sP = [
		[1839,2991,0.1],
		[1862,3928,0.1],
		[2656,1623,0.1],
		[3377,2474,0.1],
		[4127,2525,0.1],
		[3998,3449,0.1],
		[5116,4294,0.1],
		[5732,6157,0.1],
		[4203,6795,0.1],
		[3255,7295,0.1],
		[2980,4945,0.1]
	];  //Stratis
	_selectedSp = _sP call BIS_fnc_selectRandom;
	_randPos = [_selectedSp,0,1000,1,0,25,0] call BIS_fnc_findSafePos; //off shore
//      _randPos = [_selectedSp,0,1000,1,0,25,1] call BIS_fnc_findSafePos; //on shore only (need spawnpoints near a coast)
	_posX = _randPos select 0;
	_posY = _randPos select 1;
	_spawnpoint = [_posX,_posY,0.1];
	sleep 1;
	// uncomment if you want to add some gear as well, check how to add 

	/*
	_uniform = ["U_C_Poloshirt_blue","U_C_Poloshirt_burgundy","U_C_Poloshirt_stripped","U_C_Poloshirt_tricolour","U_C_Poloshirt_salmon","U_C_Poloshirt_redwhite"] call BIS_fnc_selectRandom;
	player forceAddUniform _uniform;
	player addVest "V_41_EPOCH";				
	player addWeapon "ItemMap";
	*/
	thePlayer setPos _spawnpoint;

	waitUntil { !inSpawnPoint };
};

BattlEye

scripts.txt 

line 1 add: !"selectRandom"

(when using startgear)
line 45 add: !="forceAddUniform _uniform"

new position selection time is ~1-2 sec. 

 

to hide the teleporters in @epochhive\addons\a3_epoch_server_settings\config.cpp look for 

		telePos[] = {
				

according to the mapo you use and change the coordinates to -50 (ill recommend to keep them in case the script has an error or BIS_fnc_findSafePos; returns crap)

//{ "Transport_C_EPOCH", { 1719.32, 5129.06, 0.233428 }, "", { 4089.82, 4597.71, 0.00143433 } }
{ "Transport_C_EPOCH", { 1719.32, 5129.06, -50 }, "", { 4089.82, 4597.71, -50 } }

all credits to Matijs and MisterT (Loadout)

Link to comment
Share on other sites

I created a "paraspawn.sqf" and execVM it from my init. Works so far but....

Only works for Respawn, not for Firstspawn...

 

Edited the mission.sqm:

	class Markers
	{
		items = 3;
		class Item0
		{
			position[] = {0,0,0};  <-- Debugbox spawn on the down left corner of Altis, under the water. Dont know how to delete this awful Box
			name = "center";
			type = "Empty";
		};
		class Item1
		{
			position[] = {30677.363,0.943605,49.77726};   <-- added a spawnpoint on down right corner
			name = "respawn_east";
			type = "Empty";
		};
		class Item2
		{
			position[] = {30677.363,0.943605,49.77726};  <-- added a spawnpoint on down right corner
			name = "respawn_west";
			type = "Empty";
		};
	};
	class Sensors
	{
		items = 1;
		class Item0
		{
			position[] = {30677.363,0.943605,49.77726};  <-- added a spawnpoint on down right corner
			activationBy = "ANY";
			repeating = 1;
			interruptable = 1;
			age = "UNKNOWN";
			name = "SPAWNPOINT";
			expCond = "(player distance SPAWNPOINT) < 15;";
			expActiv = "inSpawnPoint = true;";
			expDesactiv = "inSpawnPoint = false;";
			class Effects{};
		};
	};
};

So, the DebugBox is under water on the lowest left point of the map.

The Teleporters are under water too, on the right corner of the map, Respawn-Point is also there (added a concrete block above the water).

At respawn you stay there about 1-2 seconds, then fall from sky by random spawnpoints...

 

The only problem I have, for the very first spawn of a Player, he will spawn in the Debugbox under water and have to die, after that he will always spawn on my custom spawnpoint and teleportet up in the sky to paraspawn.

 

What about the parachute from this sqf, will that spawn on firstspawn? Couldnt test this out, cause dying in that shitbox isnt my custom spawnpoint ;-)

Is there a fix for that "first-spawn-problems" ?

 

Here is the paraspawn.sqf:

if (isNil "inSpawnPoint") then {
inSpawnPoint = false;
};
 
while {true} do {
	waitUntil { inSpawnPoint };
	waitUntil { player == vehicle player };
	thePlayer = vehicle player;

	_spawnpointsarray = [
							[10023.472,8366.1191,2000.1],
							[12023.906,7761.9434,2000.1],
							[5189.5854,12610.742,2000.1],
							[9698.1689,13380.817,2000.1],
							[7410.7407,15953.412,2000.1],
							[5382.9995,17883.539,2000.1],
							[4689.397,21186.277,2000.1],
							[8228.4189,20619.447,2000.1],
							[10139.456,18300.783,2000.1],
							[12032.15,15852.623,2000.1],
							[12864.482,20235.555,2000.1],
							[14235.159,22017.207,2000.1],
							[14000.715,17873.449,2000.1],
							[16704.998,17319.727,2000.1],
							[26614.645,23035.543,2000.1],
							[23408.016,21761.07,2000.1],
							[25165.869,19772.121,2000.1],
							[22925.09,19347.297,2000.1],
							[20027.535,18401.098,2000.1],
							[22925.09,16373.529,2000.1],
							[20529.775,15601.121,2000.1],
							[18250.365,13998.377,2000.1],
							[20201.387,11758.393,2000.1],
							[17593.588,10908.744,2000.1],
							[19718.461,8958.417,2000.1],
							[21283.141,6332.2305,2000.1],
							[8553.2139,25101.734,2000.1],
							[10909.893,11198.399,2000.1],
							[13633.596,12183.219,2000.1],
							[18134.467,7181.8799,2000.1]
						];
			_selectspawnpoint = _spawnpointsarray call BIS_fnc_selectRandom;
				thePlayer setPos _selectspawnpoint;
				
					_uniform = ["U_C_Poloshirt_blue","U_C_Poloshirt_burgundy","U_C_Poloshirt_stripped","U_C_Poloshirt_tricolour","U_C_Poloshirt_salmon","U_C_Poloshirt_redwhite"] call BIS_fnc_selectRandom;
						player forceAddUniform _uniform;
						player addBackpack "B_Parachute";
						
	waitUntil { !inSpawnPoint };
};
Link to comment
Share on other sites

^co-signed. lol

 

But nah, I wan running the paraspawn points directly from the central, east and west spawn portals, only you have to grab a chute from a start box at the debug area. It is still set up that way on the legion chern server if u want to see how it works. players like having the option on where they are being dropped from.

 

 

Only problem i found with altis, is the damn weird wind factor always killing players when they tried landing, and the wind would blow them 50km/p backwards. So i took it out.

Link to comment
Share on other sites

Only problem i found with altis, is the damn weird wind factor always killing players when they tried landing, and the wind would blow them 50km/p backwards. So i took it out.

Happens on Cherno, reason i removed it, they moaned and moaned because they kept dying, the weather and wind changes so sometimes it's easy, others it's not.

Link to comment
Share on other sites

I was hoping to override the teleports completely but still have a West, central and East.

 

Was thinking of putting in 3 placeholder positions where the portals teleport you to, with a sensor on each which would then place you randomly at one of several spawn points along the West coast, Central coastal areas and East coast depending which teleport pad you picked, almost like they have on Breaking Point. Think one of these scripts could do that?

Link to comment
Share on other sites

....make three different spawnpoints.sqf (spawnpoints1.sqf, spawnpoints2.sqf....)

In your init:

if (!isDedicated) then {
    [] execVM "spawnpoints1.sqf";

    [] execVM "spawnpoints2.sqf";

    [] execVM "spawnpoints3.sqf";
};

 

In spawnpoints1.sqf put in the code like from tutorial from first page, but do a little change:

change every inSpawnPoint to inSpawnPoint_1 ..... in spawnpoints2.sqf change to inSpawnPoint_2 and so on..

if (isNil "inSpawnPoint_1") then {
inSpawnPoint_1 = false;

.

.

waitUntil { inSpawnPoint_1 };

.

.

.

.

.

waitUntil { !inSpawnPoint_1 };

 

 

And in your mission add three Sensors, like this:

 

class Sensors
    {
        items=3;
        class Item0
        {
            position[]={6325.6772,0,7807.7412}; //Spawnpoint coords left TP
            activationBy="ANY";
            repeating=1;
            interruptable=1;
            age="UNKNOWN";
            name="SPAWNPOINT1";
            expCond="(player distance SPAWNPOINT1) < 2;";
            expActiv="inSpawnPoint_1 = true;";
            expDesactiv="inSpawnPoint_1 = false;";
            class Effects
            {
            };
        };

        class Item1
        {
            position[]={6325.6772,0,7807.7412}; //Spawnpoint coords middle TP
            activationBy="ANY";
            repeating=1;
            interruptable=1;
            age="UNKNOWN";
            name="SPAWNPOINT2";
            expCond="(player distance SPAWNPOINT2) < 2;";
            expActiv="inSpawnPoint_2 = true;";
            expDesactiv="inSpawnPoint_2 = false;";
            class Effects
            {
            };
        };

        class Item2
        {
            position[]={6325.6772,0,7807.7412}; //Spawnpoint coords right TP
            activationBy="ANY";
            repeating=1;
            interruptable=1;
            age="UNKNOWN";
            name="SPAWNPOINT3";
            expCond="(player distance SPAWNPOINT3) < 2;";
            expActiv="inSpawnPoint_3 = true;";
            expDesactiv="inSpawnPoint_3 = false;";
            class Effects
            {
            };
        };
    };

 

Hope you understand the way i´m thinking....

You have the three Teleporter already in this Box, but the player couldnt use it, cause the Sensor on the TP is about 2m, wich is activate the spawnpoints.sqf.

And in the three spawnpoints.sqf you take the coords you wanna have

So this is only basic, not testet, but if you spend a little time for test, youll figure out how to make this work....

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...