Specific Vehicles Re-spawn At Restart?

z1218beast

New Member
Hello I am wondering if I can make certain vehicles re-spawn at restart? Dose anyone have a script for that or know how to get that? Thanks in Advance
 
What sukkaed mentioned works great, and you can even put the sqf server side and change at will without having to have your players redownload "updated" client pbo's.

Just for God's sake put a repeating server message or such letting players know lol...can't tell you how many times after restarts I hear "I just LOST my car and ALL my gear"! Apparently peeps skip over "reading" any server info you pass long until it hits the fan... :rolleyes:
 
Here's how I do it on my server:

Step 1:
By using the 3D Editor I place a chosen vehicle I want to be "taxi's" (i.e. The lovely decorated lada's) that people spawning in or respawning in can use and abuse to get around the map. I place a fair amount but not 100's as to not clutter up the roadways. (There are plenty of posting in the forums on how to use the 3D Editor, worth the lookup)

Step 2:
Then I save out the edited mission and grab the "mission.sqf" file from the folder the 3D Editor make:
example: C:\Users\Bob\Documents\ArmA 2 Other Profiles\Bobby\missions\TAXIS.Chernarus
Inside is the two files the editor creates (mission.biedi & mission.sqf) You just need to copy the SQF file.

Step 3:
You need to make a few small edits to the mission.sqf file to make it loadable by your server. Open the file in notepad++ and Remove:
Code:
activateAddons [
  "dayz_vehicles"
];
 
activateAddons ["dayz_vehicles"];
initAmbientLife;
 
_this = createCenter west;
_center_0 = _this;
 
_group_0 = createGroup _center_0;
 
_unit_0 = objNull;
if (true) then
{
  _this = _group_0 createUnit ["Bandit1_DZ", [109.83083, 1595.2533, 0], [], 0, "CAN_COLLIDE"];
  _unit_0 = _this;
  _this setUnitAbility 0.60000002;
  if (true) then {_group_0 selectLeader _this;};
  if (true) then {selectPlayer _this;};
};
And replace with:
Code:
if (isServer) then {
Then at the very bottom of the file Delete:
Code:
processInitCommands;
runInitScript;
finishMissionInit;
And add a second closing bracket:
Code:
_vehicle_125 = objNull;
if (true) then
{
  _this = createVehicle ["Lada2_TK_CIV_EP1", [13089.339, 10291.344, 2.6702881e-005], [], 0, "CAN_COLLIDE"];
  _vehicle_125 = _this;
  _this setPos [13089.339, 10291.344, 2.6702881e-005];
};
};  <===== Add This
Save the file with a name like "taxis.sqf"

Step 4:
In your Dayz_Server.pbo create a new folder, in my case I have a folder named "Buildings" for all my extras I create that I want loaded including the taxi's.
Step 5:
Copy the newly created taxis.sqf into the "Buildings" folder and in the server.pbo open up:
dayz_server\init\server_functions.sqf
Below:
Code:
server_spawnCrashSite  =    compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_spawnCrashSite.sqf";
Create:
Code:
[] execVM "\z\addons\dayz_server\Buildings\Taxis.sqf";

Step 5:
Repack your dayz_server.pbo and upload to your Server.

Step 6:
Load in game and you should have the "taxi's" at the locations you picked when placing them in the editor. Just remember that the Vehicles are TEMPS and let your players know that Every Restart the Taxi's Respawn back to their starting points new and without their gear in the trunk!!

Here's an example Taxis.sqf you can use if you want and you can simple replace the "Lada2_TK_CIV_EP1" with any vehicle you so chose to use.
Code:
if (isServer) then {

_vehicle_2 = objNull;
if (true) then
{
  _this = createVehicle ["Lada2_TK_CIV_EP1", [738.67548, 1885.6089, -6.6757202e-006], [], 0, "CAN_COLLIDE"];
  _vehicle_2 = _this;
  _this setDir 51.440807;
  _this setPos [738.67548, 1885.6089, -6.6757202e-006];
};

_vehicle_6 = objNull;
if (true) then
{
  _this = createVehicle ["Lada2_TK_CIV_EP1", [1698.5905, 2197.3474, 3.8146973e-006], [], 0, "CAN_COLLIDE"];
  _vehicle_6 = _this;
  _this setDir 109.65331;
  _this setPos [1698.5905, 2197.3474, 3.8146973e-006];
};

_vehicle_11 = objNull;
if (true) then
{
  _this = createVehicle ["Lada2_TK_CIV_EP1", [2759.6497, 2005.2544, 1.0490417e-005], [], 0, "CAN_COLLIDE"];
  _vehicle_11 = _this;
  _this setDir 84.41227;
  _this setPos [2759.6497, 2005.2544, 1.0490417e-005];
};

_vehicle_16 = objNull;
if (true) then
{
  _this = createVehicle ["Lada2_TK_CIV_EP1", [3802.4829, 2583.9788, 2.4318695e-005], [], 0, "CAN_COLLIDE"];
  _vehicle_16 = _this;
  _this setDir 149.01744;
  _this setPos [3802.4829, 2583.9788, 2.4318695e-005];
};

_vehicle_20 = objNull;
if (true) then
{
  _this = createVehicle ["Lada2_TK_CIV_EP1", [4883.6416, 2292.0439, 2.3841858e-006], [], 0, "CAN_COLLIDE"];
  _vehicle_20 = _this;
  _this setDir 120.52782;
  _this setPos [4883.6416, 2292.0439, 2.3841858e-006];
};

_vehicle_25 = objNull;
if (true) then
{
  _this = createVehicle ["Lada2_TK_CIV_EP1", [6193.9766, 2100.3113, -1.4305115e-006], [], 0, "CAN_COLLIDE"];
  _vehicle_25 = _this;
  _this setDir 45.098427;
  _this setPos [6193.9766, 2100.3113, -1.4305115e-006];
};

_vehicle_43 = objNull;
if (true) then
{
  _this = createVehicle ["Lada2_TK_CIV_EP1", [7103.8047, 2174.4094, -7.1525574e-006], [], 0, "CAN_COLLIDE"];
  _vehicle_43 = _this;
  _this setPos [7103.8047, 2174.4094, -7.1525574e-006];
};

_vehicle_44 = objNull;
if (true) then
{
  _this = createVehicle ["Lada2_TK_CIV_EP1", [7001.6553, 2800.6548, 3.3855438e-005], [], 0, "CAN_COLLIDE"];
  _vehicle_44 = _this;
  _this setPos [7001.6553, 2800.6548, 3.3855438e-005];
};

_vehicle_50 = objNull;
if (true) then
{
  _this = createVehicle ["Lada2_TK_CIV_EP1", [6699.5181, 2997.9763, 8.9168549e-005], [], 0, "CAN_COLLIDE"];
  _vehicle_50 = _this;
  _this setDir 60.952045;
  _this setPos [6699.5181, 2997.9763, 8.9168549e-005];
};

_vehicle_55 = objNull;
if (true) then
{
  _this = createVehicle ["Lada2_TK_CIV_EP1", [7682.3325, 3220.0525, 6.1511993e-005], [], 0, "CAN_COLLIDE"];
  _vehicle_55 = _this;
  _this setDir 103.19455;
  _this setPos [7682.3325, 3220.0525, 6.1511993e-005];
};

_vehicle_60 = objNull;
if (true) then
{
  _this = createVehicle ["Lada2_TK_CIV_EP1", [8630.7715, 2598.4631, 7.8678131e-005], [], 0, "CAN_COLLIDE"];
  _vehicle_60 = _this;
  _this setDir 158.54411;
  _this setPos [8630.7715, 2598.4631, 7.8678131e-005];
};

_vehicle_65 = objNull;
if (true) then
{
  _this = createVehicle ["Lada2_TK_CIV_EP1", [9395.9766, 1911.0852, 7.3432922e-005], [], 0, "CAN_COLLIDE"];
  _vehicle_65 = _this;
  _this setDir 120.48695;
  _this setPos [9395.9766, 1911.0852, 7.3432922e-005];
};

_vehicle_71 = objNull;
if (true) then
{
  _this = createVehicle ["Lada2_TK_CIV_EP1", [10208.447, 2114.877, -2.8610229e-006], [], 0, "CAN_COLLIDE"];
  _vehicle_71 = _this;
  _this setPos [10208.447, 2114.877, -2.8610229e-006];
};

_vehicle_74 = objNull;
if (true) then
{
  _this = createVehicle ["Lada2_TK_CIV_EP1", [9955.5322, 1633.0813, 4.196167e-005], [], 0, "CAN_COLLIDE"];
  _vehicle_74 = _this;
  _this setDir 73.324432;
  _this setPos [9955.5322, 1633.0813, 4.196167e-005];
};

_vehicle_86 = objNull;
if (true) then
{
  _this = createVehicle ["Lada2_TK_CIV_EP1", [10828.481, 2324.3542, 0.00031852722], [], 0, "CAN_COLLIDE"];
  _vehicle_86 = _this;
  _this setPos [10828.481, 2324.3542, 0.00031852722];
};

_vehicle_90 = objNull;
if (true) then
{
  _this = createVehicle ["Lada2_TK_CIV_EP1", [11092.255, 3096.1494, 0.00016021729], [], 0, "CAN_COLLIDE"];
  _vehicle_90 = _this;
  _this setPos [11092.255, 3096.1494, 0.00016021729];
};

_vehicle_98 = objNull;
if (true) then
{
  _this = createVehicle ["Lada2_TK_CIV_EP1", [12843.266, 3697.4448, -0.00011348724], [], 0, "CAN_COLLIDE"];
  _vehicle_98 = _this;
  _this setPos [12843.266, 3697.4448, -0.00011348724];
};

_vehicle_102 = objNull;
if (true) then
{
  _this = createVehicle ["Lada2_TK_CIV_EP1", [13507.997, 4634.5259, 6.3896179e-005], [], 0, "CAN_COLLIDE"];
  _vehicle_102 = _this;
  _this setPos [13507.997, 4634.5259, 6.3896179e-005];
};

_vehicle_110 = objNull;
if (true) then
{
  _this = createVehicle ["Lada2_TK_CIV_EP1", [13455.646, 6400.0952, 2.2888184e-005], [], 0, "CAN_COLLIDE"];
  _vehicle_110 = _this;
  _this setPos [13455.646, 6400.0952, 2.2888184e-005];
};

_vehicle_116 = objNull;
if (true) then
{
  _this = createVehicle ["Lada2_TK_CIV_EP1", [13060.004, 7709.832, 0.00014352798], [], 0, "CAN_COLLIDE"];
  _vehicle_116 = _this;
  _this setPos [13060.004, 7709.832, 0.00014352798];
};

_vehicle_120 = objNull;
if (true) then
{
  _this = createVehicle ["Lada2_TK_CIV_EP1", [12829.105, 8859.3232, 1.6212463e-005], [], 0, "CAN_COLLIDE"];
  _vehicle_120 = _this;
  _this setPos [12829.105, 8859.3232, 1.6212463e-005];
};

_vehicle_122 = objNull;
if (true) then
{
  _this = createVehicle ["Lada2_TK_CIV_EP1", [12917.891, 9513.377, 0.00010156631], [], 0, "CAN_COLLIDE"];
  _vehicle_122 = _this;
  _this setPos [12917.891, 9513.377, 0.00010156631];
};

_vehicle_125 = objNull;
if (true) then
{
  _this = createVehicle ["Lada2_TK_CIV_EP1", [13089.339, 10291.344, 2.6702881e-005], [], 0, "CAN_COLLIDE"];
  _vehicle_125 = _this;
  _this setPos [13089.339, 10291.344, 2.6702881e-005];
};
};

NOTE: Because I use SARGE'S fix for exploding vehicles I can get away with this method, otherwise the damn things blow up in your face when you get in..!!
 
Here's how I do it on my server:

Hey there, when I try this my cars disappear when I get close to them and if I am able to even get in, it simply kills me. I used default dayz class ID vehicles so nothing custom (using this on Fallujah 1.5 which runs 1.7.6.1 dayz code). What can I do to not make them disappear and not kill me when I enter vehicles? thanks :)
 
You need to set a variable for them and then have it exclude vehicles with that variable from server_cleanup.fsm and server_updateObject.sqf.

If it's not excluded updateObject then it will dissapear when you get near it.
If it's not excluded from server_cleanup it will kill anyone who gets into it. (you will see in the log KILLING A HACKER: Username)
 
That method works because instead of adding variables to exclude the vehicles, you are instead removing the cleanup on vehicles entirely.

The correct way would be to do something like this:
Code:
_vehicle_11 = objNull;
if (true) then
{
  _this = createVehicle ["Lada2_TK_CIV_EP1", [2759.6497, 2005.2544, 1.0490417e-005], [], 0, "CAN_COLLIDE"];
  _vehicle_11 = _this;
  _this setDir 84.41227;
  _this setPos [2759.6497, 2005.2544, 1.0490417e-005];
  _this setVariable ["Sarge",1,true];
};

And then edit server_cleanup to something like:
Code:
if(vehicle _x != _x && (vehicle _x getVariable [""Sarge"",0] != 1) && !(vehicle _x in _safety) && (isPlayer _x) && !((typeOf vehicle _x) in DZE_safeVehicle)) then {" \n

And add this in the correct location in server_updateObject.sqf
Code:
if (_object getVariable "Sarge" == 1) exitWith {};

That way if you don't have an antihack or yours fails to catch a hacker, who then spawns themselves a tank, it'll disappear and kill them when if they manage to get in it.
 
Back
Top