Jump to content

Random Spawn Script


Matijs

Recommended Posts

This might be not the way to do this, but I dont reallly care, because it works.

This script was made for a server to be able to have random spawns. (Spawn points given by the administrator.)

Make a script called spawnpoints.sqf:

 
if (isNil "inSpawnPoint") then {
inSpawnPoint = false;
};
 
while {true} do {
waitUntil { inSpawnPoint };
titleText [format["Entering Spawn Point."],"PLAIN DOWN"]; titleFadeOut 4;
 
waitUntil { player == vehicle player };
 
thePlayer = vehicle player;

_spawnpointsarray = [
[1745,2107,0.1],
[2737,1980,0.1],
[3663,2130,0.1],
[4109,2317,0.1],
[4813,2086,0.1],
[5825,2023,0.1],
[6357,2082,0.1],
[7198,2533,0.1],
[7226,2187,0.1],
[8045,2835,0.1],
[8577,2320,0.1],
[9286,1902,0.1],
[9840,1786,0.1],
[10466,1886,0.1],
[10243,1576,0.1],
[10857,2275,0.1],
[11939,3402,0.1],
[11105,3009,0.1],
[13509,6166,0.1],
[13081,7804,0.1],
[12940,9326,0.1],
[13170,10292,0.1]
];

systemChat "[DeadZ] Selecting spawn point...";
_selectspawnpoint = _spawnpointsarray select floor random count _spawnpointsarray;
sleep 1;
systemChat "[DeadZ] Spawn point selected. Spawning...";
sleep 1;
thePlayer setPos _selectspawnpoint;

 
waitUntil { !inSpawnPoint };
 
titleText [format["Exiting Spawn Point. Have fun."],"PLAIN DOWN"]; titleFadeOut 4;

 
};
In the init.sqf add this:
if (!isDedicated) then {
	[] execVM "spawnpoints.sqf";
};
In your mission sqm, create a sensor called SPAWNPOINT like this:
class Sensors
	{
		items=1;
		class Item0
		{
			position[]={6325.6772,0,7807.7412}; //Spawnpoint coords (same as respawn_west & east)
			activationBy="ANY";
			repeating=1;
			interruptable=1;
			age="UNKNOWN";
			name="SPAWNPOINT";
			expCond="(player distance SPAWNPOINT) < 50;";
			expActiv="inSpawnPoint = true;";
			expDesactiv="inSpawnPoint = false;";
			class Effects
			{
			};
		};
	};
And it should spawn you automaticaly after 2 seconds randomly.

Also you need to remove your portals, or place them -x in the ground.

Tell me if you like it.

This is very nooby, but it works, so no hate.

EDIT: I think you can remove the sleep 1;, im not sure about this, I just added it in for safety, so the player is definetaly going to a new location.

Greetings,

Matijs

Link to comment
Share on other sites

how do ya remove the portals?

 

You know how to configure overpoch, but you dont know how to hide the portals? Unpack your server settings pbo, config.cpp file, scroll down to class Chernarus, edit the first positions of the portals, set the height, last one, to -50 instead of 0

Link to comment
Share on other sites

some things are easy (calling a server overpoch for haing 300+ weapons and extra vehicles)

 

dont mean i know everything though ;)

 

also guess it can go pretty much anywhere in the mission.sqm ya?

 

tyvm been needing this for a while hated this spawn system :P

Link to comment
Share on other sites

can you just add this anywhere in mission.sqm

 

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

Link to comment
Share on other sites

class Markers
{
items = 3;
class Item0
{
position[] = {6968.658,324.48145,8345.914};
name = "center";
type = "Empty";
};
class Item1
{
position[] = {1024.82,0,2023.51};
name = "respawn_east";
type = "Empty";
angle = 23.608498;
};
class Item2
{
position[] = {1024.8502,5.858802,2023.5204};
name = "respawn_west";
type = "Empty";
angle = 23.608498;
};
};
};
class Sensors
{
items = 1;
class Item0
{
position[] = {6325.6772,0,7807.741};
activationBy = "ANY";
repeating = 1;
interruptable = 1;
age = "UNKNOWN";
name = "SPAWNPOINT";
expCond = "(player distance SPAWNPOINT) < 50;";
expActiv = "inSpawnPoint = true;";
expDesactiv = "inSpawnPoint = false;";
class Effects{};
};
};
 
 
is that correct cause this aint working for me :/
Link to comment
Share on other sites

 

class Markers
{
items = 3;
class Item0
{
position[] = {6968.658,324.48145,8345.914};
name = "center";
type = "Empty";
};
class Item1
{
position[] = {1024.82,0,2023.51};
name = "respawn_east";
type = "Empty";
angle = 23.608498;
};
class Item2
{
position[] = {1024.8502,5.858802,2023.5204};
name = "respawn_west";
type = "Empty";
angle = 23.608498;
};
};
};
class Sensors
{
items = 1;
class Item0
{
position[] = {6325.6772,0,7807.741};
activationBy = "ANY";
repeating = 1;
interruptable = 1;
age = "UNKNOWN";
name = "SPAWNPOINT";
expCond = "(player distance SPAWNPOINT) < 50;";
expActiv = "inSpawnPoint = true;";
expDesactiv = "inSpawnPoint = false;";
class Effects{};
};
};
 
 
is that correct cause this aint working for me :/

 

 

Behind the last "};" is there another "};" ?

Link to comment
Share on other sites

class Markers
{
items = 3;
class Item0
{
position[] = {6968.658,324.48145,8345.914};
name = "center";
type = "Empty";
};
class Item1
{
position[] = {1024.82,0,2023.51};
name = "respawn_east";
type = "Empty";
angle = 23.608498;
};
class Item2
{
position[] = {1024.8502,5.858802,2023.5204};
name = "respawn_west";
type = "Empty";
angle = 23.608498;
};
};
};
class Sensors
{
items=1;
class Item0
{
position[]={6325.6772,0,7807.7412}; //Spawnpoint coords (same as respawn_west & east)
activationBy="ANY";
repeating=1;
interruptable=1;
age="UNKNOWN";
name="SPAWNPOINT";
expCond="(player distance SPAWNPOINT) < 50;";
expActiv="inSpawnPoint = true;";
expDesactiv="inSpawnPoint = false;";
class Effects
{
};
};
};
class Intro
 
 
 
so that should work? sorry about this :p
Link to comment
Share on other sites

Hump the coords are wrong in the file he posted so you'll never be near the sensor when you spawn.

 

Change that to the respawn east or west coords in the markers so it matches, then you'll spawn, and will be within the 25m and the script will execute.

Link to comment
Share on other sites

so if i dont make my mission.sqm crypted again my server wont let anyone join......

 

class Markers
{
items = 3;
class Item0
{
position[] = {6968.658,324.48145,8345.914};
name = "center";
type = "Empty";
};
class Item1
{
position[] = {1024.82,0,2023.51};
name = "respawn_east";
type = "Empty";
angle = 23.608498;
};
class Item2
{
position[] = {1024.8502,5.858802,2023.5204};
name = "respawn_west";
type = "Empty";
angle = 23.608498;
};
};
class Sensors
{
items=1;
class Item0
{
position[]={1024.8502,5.858802,2023.5204}; //Spawnpoint coords (same as respawn_west & east)
activationBy="ANY";
repeating=1;
interruptable=1;
age="UNKNOWN";
name="SPAWNPOINT";
expCond="(player distance SPAWNPOINT) < 50;";
expActiv="inSpawnPoint = true;";
expDesactiv="inSpawnPoint = false;";
class Effects
{
};
};
};
 
 
that is my coding but if i dont put another ); between the last ); from markers and sensors i cant re-crpt it
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
×
×
  • Create New...