Jump to content
  • 0

Way to spawn vehicles at specific places?


FragZ

Question

I tried using editor (that was dumb) which made us blow up upon entry.


I tried using judge bread's method and it did not work for me, and made server lag:

I am lost right now. I want vehicles that respawns at a certain location every restart (survival city).

any help?

Link to comment
Share on other sites

12 answers to this question

Recommended Posts

  • 0

This code will spawn 2 vehicles at the nwaf, edit it to your liking and BOOM vehicles spawn in the same position each restart.

 

Vroom vroom.

 

 

if (isServer) then {
private ["_object","_uniqueid"];

_vehicle_9998 = objNull;
if (true) then
{
  _this = createVehicle ["MH6J_DZ", [4828.4443, 9768.4717], [], 0, "CAN_COLLIDE"];
  _vehicle_9998 = _this;
  _this setDir -210.79807;
  _this setPos [4828.4443, 9768.4717];
  _object setVariable ["MalSar",1,true];
  _uniqueid = str(round(random 999999));
  _object setVariable ["ObjectID", _uniqueid, true];
  _object setVariable ["ObjectUID", _uniqueid, true];
};

_vehicle_9999 = objNull;
if (true) then
{
  _this = createVehicle ["SUV_TK_CIV_EP1", [4819.5127, 9761.2656, 3.0517578e-005], [], 0, "CAN_COLLIDE"];
  _vehicle_9999 = _this;
  _this setDir -208.42464;
  _this setPos [4819.5127, 9761.2656, 3.0517578e-005];
  _object setVariable ["MalSar",1,true];
  _uniqueid = str(round(random 999999));
  _object setVariable ["ObjectID", _uniqueid, true];
  _object setVariable ["ObjectUID", _uniqueid, true];
};

};

Link to comment
Share on other sites

  • 0

This code will spawn 2 vehicles at the nwaf, edit it to your liking and BOOM vehicles spawn in the same position each restart.

 

Vroom vroom.

 

 

if (isServer) then {

private ["_object","_uniqueid"];

_vehicle_9998 = objNull;

if (true) then

{

  _this = createVehicle ["MH6J_DZ", [4828.4443, 9768.4717], [], 0, "CAN_COLLIDE"];

  _vehicle_9998 = _this;

  _this setDir -210.79807;

  _this setPos [4828.4443, 9768.4717];

  _object setVariable ["MalSar",1,true];

  _uniqueid = str(round(random 999999));

  _object setVariable ["ObjectID", _uniqueid, true];

  _object setVariable ["ObjectUID", _uniqueid, true];

};

_vehicle_9999 = objNull;

if (true) then

{

  _this = createVehicle ["SUV_TK_CIV_EP1", [4819.5127, 9761.2656, 3.0517578e-005], [], 0, "CAN_COLLIDE"];

  _vehicle_9999 = _this;

  _this setDir -208.42464;

  _this setPos [4819.5127, 9761.2656, 3.0517578e-005];

  _object setVariable ["MalSar",1,true];

  _uniqueid = str(round(random 999999));

  _object setVariable ["ObjectID", _uniqueid, true];

  _object setVariable ["ObjectUID", _uniqueid, true];

};

};

Tyvm kind sir. Will give feed back!

Link to comment
Share on other sites

  • 0

This code will spawn 2 vehicles at the nwaf, edit it to your liking and BOOM vehicles spawn in the same position each restart.

 

Vroom vroom.

 

 

if (isServer) then {

private ["_object","_uniqueid"];

_vehicle_9998 = objNull;

if (true) then

{

  _this = createVehicle ["MH6J_DZ", [4828.4443, 9768.4717], [], 0, "CAN_COLLIDE"];

  _vehicle_9998 = _this;

  _this setDir -210.79807;

  _this setPos [4828.4443, 9768.4717];

  _object setVariable ["MalSar",1,true];

  _uniqueid = str(round(random 999999));

  _object setVariable ["ObjectID", _uniqueid, true];

  _object setVariable ["ObjectUID", _uniqueid, true];

};

_vehicle_9999 = objNull;

if (true) then

{

  _this = createVehicle ["SUV_TK_CIV_EP1", [4819.5127, 9761.2656, 3.0517578e-005], [], 0, "CAN_COLLIDE"];

  _vehicle_9999 = _this;

  _this setDir -208.42464;

  _this setPos [4819.5127, 9761.2656, 3.0517578e-005];

  _object setVariable ["MalSar",1,true];

  _uniqueid = str(round(random 999999));

  _object setVariable ["ObjectID", _uniqueid, true];

  _object setVariable ["ObjectUID", _uniqueid, true];

};

};

With this method I can drive fine for like 1 minute, then you die from it... just like the rest But like delayed.

Help!@

Link to comment
Share on other sites

  • 0

The best and most obvious way to make vehicles safe is by adding them to the PVDZE_serverObjectMonitor array, also the _object variable is nothing. At no point in that code does it get assigned any value whatsoever.

Try using this -

if (isServer) then {

    _vehicle_9998 = objNull;
    if (true) then
    {
        _this = createVehicle ["MH6J_DZ", [4828.4443, 9768.4717], [], 0, "CAN_COLLIDE"];
        _vehicle_9998 = _this;
        _this setDir -210.79807;
        _this setPos [4828.4443, 9768.4717];
        _this setVariable ["ObjectID",str(round(random 999999)), true];
        _this setVariable ["ObjectUID",str(round(random 999999)), true];
        if (!isNil "PVDZE_serverObjectMonitor") then {PVDZE_serverObjectMonitor set [(count PVDZE_serverObjectMonitor),_this];};
    };

    _vehicle_9999 = objNull;
    if (true) then
    {
        _this = createVehicle ["SUV_TK_CIV_EP1", [4819.5127, 9761.2656, 3.0517578e-005], [], 0, "CAN_COLLIDE"];
        _vehicle_9999 = _this;
        _this setDir -208.42464;
        _this setPos [4819.5127, 9761.2656, 3.0517578e-005];
        _this setVariable ["ObjectID",str(round(random 999999)), true];
        _this setVariable ["ObjectUID",str(round(random 999999)), true];
        if (!isNil "PVDZE_serverObjectMonitor") then {PVDZE_serverObjectMonitor set [(count PVDZE_serverObjectMonitor),_this];};
    };

};
Link to comment
Share on other sites

  • 0
if (isServer) then {

    _vehicle_9998 = objNull;
    if (true) then
    {
        _pos1 = [0.0.0];
        _pos2 = [0.0.0];
        _pos3 = [0.0.0];
        _pos4 = [0.0.0];
        _pos5 = [0.0.0];
        _pos6 = [0.0.0];
        _position = [_pos1, _pos2, _pos3, _pos4, _pos5, _pos6] call BIS_fnc_selectRandon;
        _this = createVehicle ["MH6J_DZ", [_position], [], 0, "CAN_COLLIDE"];
        _vehicle_9998 = _this;
        _this setDir -210.79807;
        _this setPos [_position];
        _this setVariable ["ObjectID",str(round(random 999999)), true];
        _this setVariable ["ObjectUID",str(round(random 999999)), true];
        if (!isNil "PVDZE_serverObjectMonitor") then {PVDZE_serverObjectMonitor set [(count PVDZE_serverObjectMonitor),_this];};
    };

    _vehicle_9999 = objNull;
    if (true) then
    {
        _pos1 = [0.0.0];
        _pos2 = [0.0.0];
        _pos3 = [0.0.0];
        _pos4 = [0.0.0];
        _pos5 = [0.0.0];
        _pos6 = [0.0.0];
        _position = [_pos1, _pos2, _pos3, _pos4, _pos5, _pos6] call BIS_fnc_selectRandon;
        _this = createVehicle ["SUV_TK_CIV_EP1", [_position], [], 0, "CAN_COLLIDE"];
        _vehicle_9999 = _this;
        _this setDir -208.42464;
        _this setPos [_position];
        _this setVariable ["ObjectID",str(round(random 999999)), true];
        _this setVariable ["ObjectUID",str(round(random 999999)), true];
        if (!isNil "PVDZE_serverObjectMonitor") then {PVDZE_serverObjectMonitor set [(count PVDZE_serverObjectMonitor),_this];};
    };

};

Keep it interesting, Move them around a bit. Just fill in the coords in the "[0.0.0]" 

 

_sideeffect1 = insanity;

_sideeffect2 = drug_abuse;

_sideeffect3 = violence;

_boring = [_sideeffect1, _sideeffect2, _sideeffect3] call BIS_fnc_selectRandom;

_predictability = _boring

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
  • Advertisement
  • Discord

×
×
  • Create New...