Jump to content

[How to] Add custom vehicles and remove weapons


Recommended Posts

Hi again, guys. My apologies if I am posting this in a wrong forum, but I couldn't find a better suited one.

 

I would love to share tutorial on how to add custom vehicles, that would normally be overpowered and remove weapons so your players can still enjoy them.

Idea behind this is mostly for admin events, bandit islands and all other awesome stuff that players have to compete for.

 

In this video I am adding F35 and L39 jets to a panthera map, in my scenario, for example, it could be bandit island that rewards people with a jet they can fly around to show off their victory, only difference is - no weapons. Vehicles will reset position on restart.

 

What's in it for you?:

*Add custom vehicles or aircraft to your server using 3D editor

*Make it so only server spawns these vehicles

*Editing server side scripts to make these vehicles stay without being deleted instantly

*Properly whitelisting new vehicles without disabling code that lets hackers spawn vehicles.

*All code you see in the video is well explained and should give you ability to maintain your own work yourself.

 

The downside:

Hackers will be able to spawn your whitelisted vehicles, if they know what they are doing.

 

 

EDIT: this is old tutorial and was made before I actually had any clue what I am doing, lol

To do this properly, you need to add your vehicle to DZE_SafeVehicles array in your variables.sqf

If using infistar, you need to set ObjectID to 0 and ObjectUID to 1 (or any number that is not 0), best case scenario - generate a random number

   	_this setVariable ["ObjectID", "0", true];
   	_this setVariable ["ObjectUID", "100000", true];
Edited by raymix
Link to comment
Share on other sites

requires additional client downloads?

if you mean external mods, then no.

As long as you only add vehicles that are originally in Arma 2 OA and Dayz Epoch it will work fine. To make sure it works, just follow the first part in the video - join your own server, disconnect to main menu and press Alt+E, then select the map.

Link to comment
Share on other sites

  • 4 weeks later...

I am trying to get this working but its not spawning the jets....  OH and how to use spoilers  I see this 

 

code [ /spoiler] soo  
then code then [ /spoiler]   ????????????????

in init.sqf

[] execVM "map\jets.sqf";

jets.spf is in maps folder 

 

 

 server_updateObject..............................................................

 

private ["_myCustom","_object","_type","_objectID","_uid","_lastUpdate","_needUpdate","_object_position","_object_inventory","_object_damage","_isNotOk","_parachuteWest","_firstTime","_object_killed","_object_repair","_isbuildable"];
_object = _this select 0;

if(isNull(_object)) exitWith {
diag_log format["Skipping Null Object: %1", _object];
};

_type = _this select 1;
_parachuteWest = ((typeOf _object == "ParachuteWest") or (typeOf _object == "ParachuteC"));
_myCustom = ((typeOf _object == "A10") or (typeOf _object == "F35B") or (typeOf _object == "Su25_Ins"));
_isbuildable = (typeOf _object) in dayz_allowedObjects;
_isNotOk = false;
_firstTime = false;

_objectID = _object getVariable ["ObjectID","0"];
_uid = _object getVariable ["ObjectUID","0"];

if ((typeName _objectID != "string") || (typeName _uid != "string")) then
{ 
    diag_log(format["Non-string Object: ID %1 UID %2", _objectID, _uid]);
    //force fail
    _objectID = "0";
    _uid = "0";
};
// Epoch Admin Tools
if (_object getVariable "MalSar" == 1) exitWith {};
if (!_myCustom and !_parachuteWest and !(locked _object)) then {
if (_objectID == "0" && _uid == "0") then
{
_object_position = getPosATL _object;
    _isNotOk = true;
};
};

 

jets.sqf.................................................
if (isServer) then {
_vehicle_0 = objNull;
if (true) then
{
  _this = createVehicle ["A10", [16755.811, 10430.455, -3.8146973e-005], [], 0, "CAN_COLLIDE"];
  _vehicle_0 = _this;
  _this setDir -93.791054;
  _this setVehicleInit "this removeWeapon ""BombLauncherA10"";this removeWeapon""FFARLauncher_14"";this removeWeapon""GAU8"";this removeWeapon""MaverickLauncher"";this removeWeapon""SidewinderLaucher_AH1Z"";this addWeapon ""M240_veh"";this addMagazine ""1200Rnd_762x51_M240"";";
  _this setPos [16755.811, 10430.455, -3.8146973e-005];
};

_vehicle_2 = objNull;
if (true) then
{
  _this = createVehicle ["A10", [16755.053, 10378.483], [], 0, "CAN_COLLIDE"];
  _vehicle_2 = _this;
  _this setDir -93.791054;
  _this setVehicleInit "this removeWeapon ""BombLauncherA10"";this removeWeapon""FFARLauncher_14"";this removeWeapon""GAU8"";this removeWeapon""MaverickLauncher"";this removeWeapon""SidewinderLaucher_AH1Z"";this addWeapon ""M240_veh"";this addMagazine ""1200Rnd_762x51_M240"";";
  _this setPos [16755.053, 10378.483];
};

_vehicle_4 = objNull;
if (true) then
{
  _this = createVehicle ["F35B", [16753.357, 10331.82, 2.2888184e-005], [], 0, "CAN_COLLIDE"];
  _vehicle_4 = _this;
  _this setDir -90.572632;
  _this setVehicleInit "this removeWeapon ""SidewinderLaucher_F35"";this removeWeapon""GAU12"";this removeWeapon""BombLauncherF35"";this addWeapon ""M240_veh"";this addMagazine ""1200Rnd_762x51_M240"";";
  _this setPos [16753.357, 10331.82, 2.2888184e-005];
};

_vehicle_6 = objNull;
if (true) then
{
  _this = createVehicle ["F35B", [16757.016, 10281.367, 7.6293945e-006], [], 0, "CAN_COLLIDE"];
  _vehicle_6 = _this;
  _this setDir -90.572632;
  _this setVehicleInit "this removeWeapon ""SidewinderLaucher_F35"";this removeWeapon""GAU12"";this removeWeapon""BombLauncherF35"";this addWeapon ""M240_veh"";this addMagazine ""1200Rnd_762x51_M240"";";
  _this setPos [16757.016, 10281.367, 7.6293945e-006];
};

_vehicle_8 = objNull;
if (true) then
{
  _this = createVehicle ["Su25_Ins", [16758.828, 10231.088, 2.6702881e-005], [], 0, "CAN_COLLIDE"];
  _vehicle_8 = _this;
  _this setDir -93.78788;
  _this setVehicleInit "this removeWeapon ""AirBombLauncher"";this removeWeapon""GSh301"";this removeWeapon""R73Launcher_2"";this removeWeapon""S8Launcher"";this addWeapon ""M240_veh"";this addMagazine ""1200Rnd_762x51_M240"";";
  _this setPos [16758.828, 10231.088, 2.6702881e-005];
};
};

Link to comment
Share on other sites

use

 

The code looks fine, what do you see in RPT log? Any errors at all? Or is there anything else deleting them? Maybe they are blacklisted in Antihack?

still dont get spoilers ?? I have no space

20:07:32 Cannot create entity with abstract type A10 (scope = private?)

20:07:32 Cannot create non-ai vehicle A10,
20:07:32 Cannot create entity with abstract type A10 (scope = private?)
20:07:32 Cannot create non-ai vehicle A10,
20:07:32 Unrecognized CfgVehicles simulation  in bin\config.bin/CfgVehicles/F35B/
20:07:32 Cannot create entity with abstract type F35B (scope = private?)
20:07:32 Cannot create non-ai vehicle F35B,
20:07:32 Cannot create entity with abstract type F35B (scope = private?)
20:07:32 Cannot create non-ai vehicle F35B,
20:07:32 Unrecognized CfgVehicles simulation  in bin\config.bin/CfgVehicles/Su25_Ins/
20:07:32 Cannot create entity with abstract type Su25_Ins (scope = private?)
20:07:32 Cannot create non-ai vehicle Su25_Ins,

Link to comment
Share on other sites

I found the problem.

They are banned in overwatch and I have an overpoch server...

edited the banned vehicles file and all is good.

 

Except after entering a A10 it blows up and killed me ;(

 

 

would it have something to do with this

 

server_checkHackers = {
if (DZE_DYN_AntiStuck2nd > 3) then { DZE_DYN_HackerCheck = nil; DZE_DYN_AntiStuck2nd = 0; };
if(!isNil "DZE_DYN_HackerCheck") exitWith {  DZE_DYN_AntiStuck2nd = DZE_DYN_AntiStuck2nd + 1;};
DZE_DYN_HackerCheck = true;
{
// Epoch Admin Tools
    if(vehicle _x != _x && !(vehicle _x in PVDZE_serverObjectMonitor) && (isPlayer _x)  && !((typeOf vehicle _x) in DZE_safeVehicle) && (vehicle _x getVariable ["MalSar",0] !=1)) then {
diag_log ("CLEANUP: KILLING A HACKER " + (name _x) + " " + str(_x) + " IN " + (typeOf vehicle _x));
(vehicle _x) setDamage 1;
_x setDamage 1;
sleep 0.25;
};
sleep 0.001;
} forEach allUnits;
DZE_DYN_HackerCheck = nil;
};

Link to comment
Share on other sites

I found the problem.

They are banned in overwatch and I have an overpoch server...

edited the banned vehicles file and all is good.

 

Except after entering a A10 it blows up and killed me ;(

dayz_server.pbo > init > server_functions.sqf

 

around line 805:

			//diag_log ("CLEANUP: KILLING A HACKER " + (name _x) + " " + str(_x) + " IN " + (typeOf vehicle _x));
			(vehicle _x) setDamage 0;
			_x setDamage 0;
Link to comment
Share on other sites

Good tutorial, but I have to question where fighter jets, and the skills to fly and maintain them and their fuel would be found among survivors of a zombie exodus :P There is too much tinkering with the minimalism and realism of DayZ in too many servers :angry:

Link to comment
Share on other sites

yah I fixed that just now.

 

however they still have the weapons ;(

 

// Epoch Admin Tools
    if(vehicle _x != _x && !(vehicle _x in PVDZE_serverObjectMonitor) && (isPlayer _x)  && !((typeOf vehicle _x) in DZE_safeVehicle) && !(_myCustom) && (vehicle _x getVariable ["MalSar",0] !=1)) then {
diag_log ("CLEANUP: KILLING A HACKER " + (name _x) + " " + str(_x) + " IN " + (typeOf vehicle _x));
(vehicle _x) setDamage 1;
_x setDamage 1;
sleep 0.25;
};
sleep 0.001;
} forEach allUnits;
DZE_DYN_HackerCheck = nil;
Link to comment
Share on other sites

Good tutorial, but I have to question where fighter jets, and the skills to fly and maintain them and their fuel would be found among survivors of a zombie exodus :P There is too much tinkering with the minimalism and realism of DayZ in too many servers :angry:

 

Well, I live in holland. Good luck finding firearms here :D

Link to comment
Share on other sites

Good tutorial, but I have to question where fighter jets, and the skills to fly and maintain them and their fuel would be found among survivors of a zombie exodus :P There is too much tinkering with the minimalism and realism of DayZ in too many servers :angry:

this is what keeps dayz alive. if it were not for tinkering and customizing,in my opinion dayz woulda died long ago....

Link to comment
Share on other sites

  • 2 months later...
Have a problem. I watched a video back in 1.0.4.2 called:
Epoch: Tutorial - Adding custom vehicles/jets and removing weapons by Raymix.
I was using the jets until the update 1.0.5.1 and at that time players getting into the jets got killed or the plane just disppeared.
 
So i  let some time go by before i would try to get some help. We have 6 servers and finally got catch up.
I contacted Raymix and asked if he knew what was going on. He told me to try the following and see if that would work:
 
you will need to add code line inside init line to assign ID.
Works like this:
_this setVariable ["ObjectID", 1, true];_this setVariable ["ObjectUID", 1, true];What happens is cleanup code looks for hacked vehicles that were spawned in and do not exist within whitelisted vehicles (like buildable objects) in variables.sqf You could whitelist them, but that's a bad idea. Since that also allows hackers to spawn them.
But if you create your own plane in 3D editor and assign an ID to it, you don't need to whitelist anything anymore, it will be a legit vehicle.
 
I tried  the following and they still disappear, i didn't  have a non admin on to see if it would kill them
 

if (isServer) then {

 
_vehicle_0 = objNull;
if (true) then
{
  _this = createVehicle ["L39_TK_EP1", [14573.688, 16697.984, -1.1444092e-005], [], 0, "CAN_COLLIDE"];
  _vehicle_0 = _this;
  _this setDir 46.61084;
  _this setVariable ["ObjectID", 1, true];
  _this setVariable ["ObjectUID", 1, true];
  _this setVehicleArmor 0.75039393;
  _this setFuel 0.50078815;
  _this setVehicleAmmo 0;
  _this setVehicleInit "this removeWeapon ""GSh23L_L39""; this removeWeapon ""57mmLauncher"";";
  _this setPos [14573.688, 16697.984, -1.1444092e-005];
};
 
_vehicle_6 = objNull;
if (true) then
{
  _this = createVehicle ["Su25_CDF", [14530.488, 16749.627, -0.27939826], [], 0, "CAN_COLLIDE"];
  _vehicle_6 = _this;
  _this setDir -307.75769;
  _this setVariable ["ObjectID", 1, true];
  _this setVariable ["ObjectUID", 1, true];
  _this setVehicleArmor 0.75039423;
  _this setFuel 0.49553338;
  _this setVehicleAmmo 0;
  _this setVehicleInit "this removeWeapon ""S8Launcher""; this removeWeapon ""R73Launcher_2""; this removeWeapon ""GSh301""; this removeWeapon ""AirBombLauncher"";";
  _this setPos [14530.488, 16749.627, -0.27939826];
};
 
_vehicle_9 = objNull;
if (true) then
{
  _this = createVehicle ["A10_US_EP1", [14553.075, 16721.111, -0.034083627], [], 0, "CAN_COLLIDE"];
  _vehicle_9 = _this;
  _this setDir 48.706741;
  _this setVariable ["ObjectID", 1, true];
  _this setVariable ["ObjectUID", 1, true];
  _this setVehicleArmor 0.72149235;
  _this setFuel 0.48765102;
  _this setVehicleAmmo 0;
  _this setVehicleInit "this removeWeapon ""BombLauncherA10""; this removeWeapon ""FFARLauncher_14""; this removeWeapon ""GAU8""; this removeWeapon ""MaverickLauncher""; this removeWeapon ""SidewinderLaucher_AH1Z"";";
  _this setPos [14553.075, 16721.111, -0.034083627];
 
};
 
};

 
Anyone have an ideal?
Link to comment
Share on other sites

Admins would still get killed even with god mode on. The way "killing hacker" code works is - it looks for vehicles with wrong character ID and when someone gets in, both vehicle and player gets damage set to 1. This kills everyone.

Best thing to do is having a local server to test these things out.

 

https://github.com/vbawol/DayZ-Epoch/blob/master/SQF/dayz_server/init/server_functions.sqf#L807

 

If you look at that code, it also checks for safe vehicles before executing your dudes. 

Open your custom variables.sqf if you have one and look for this line:

https://github.com/vbawol/DayZ-Epoch/blob/master/SQF/dayz_code/init/variables.sqf#L644

 

Add your vehicles there, this should work, too if giving vehicle a character ID did not work.

Link to comment
Share on other sites

  • 3 weeks later...
raymix

Admins would still get killed even with god mode on. The way "killing hacker" code works is - it looks for vehicles with wrong character ID and when someone gets in, both vehicle and player gets damage set to 1. This kills everyone.

Best thing to do is having a local server to test these things out.

 

https://github.com/v...ctions.sqf#L807

 

If you look at that code, it also checks for safe vehicles before executing your dudes. 

Open your custom variables.sqf if you have one and look for this line:

https://github.com/v...iables.sqf#L644

 

Add your vehicles there, this should work, too if giving vehicle a character ID did not work.

Dont know how to set a vehicle character ID. If you have the time could you please tell me how or point me in the right dir. to set a character ID. 

I will try the above also.

Thank you

Link to comment
Share on other sites

2 things: set up server and I found this in the RPT file

 

 

12:59:14 "infiSTAR.de PVAH_WriteLog: [b 1-1-B:1 (Thug ) REMOTE,"Thug  TP infront of you ON"]"

12:59:16 "infiSTAR.de PVAH_WriteLog: [b 1-1-B:1 (Thug ) REMOTE,"Thug  G_o_d ON"]"
12:59:19 "infiSTAR.de PVAH_WriteLog: [b 1-1-B:1 (Thug ) REMOTE,"Thug  No Zed Aggro - On"]"
12:59:27 "infiSTAR.de AdminReq: [1,B 1-1-B:1 (Thug ) REMOTE,[4865.82,9584.03,0]]"
12:59:27 "infiSTAR.de AdminReqProceed: B 1-1-B:1 (Thug ) REMOTE"
12:59:27 "infiSTAR.de PVAH_WriteLog: [b 1-1-B:1 (Thug ) REMOTE,"Thug  Teleport to [4865.82,9584.03,0](@048057)"]"
12:59:41 "0 Active ground units"
12:59:41 "0 Active emplacement units"
12:59:41 "0 Active chopper patrol units (Crew)"
12:59:41 "0 Active vehicle patrol units (Crew)"
12:59:41 "0 Active ground units"
12:59:41 "0 Active emplacement units"
12:59:41 "0 Active chopper patrol units (Crew)"
12:59:41 "0 Active vehicle patrol units (Crew)"
12:59:45 "Deleting object A10_US_EP1 with invalid ID at pos [4863.2,9603.81,0.0844116]"
13:00:15 "Deleting object L39_TK_EP1 with invalid ID at pos [4841.98,9588.95,0.0189514]"
13:00:33 "infiSTAR.de AdminReq: [1,B 1-1-B:1 (Thug ) REMOTE,[4756.83,2468.6,0]]"
13:00:33 "infiSTAR.de AdminReqProceed: B 1-1-B:1 (Thug ) REMOTE"
13:00:33 "infiSTAR.de PVAH_WriteLog: [b 1-1-B:1 (Thug ) REMOTE,"Thug  Teleport to [4756.83,2468.6,0](@047128)"]"
13:00:45 "Deleting object A10_US_EP1 with invalid ID at pos [4768.29,2434.88,0.0844231]"
13:01:01 "CLEANUP: INITIALIZING CLEANUP SCRIPT"
13:01:10 "Deleting object L39_TK_EP1 with invalid ID at pos [4789.07,2427.07,0.019762]"
13:01:10 "Deleting object L39_TK_EP1 with invalid ID at pos [4789.07,2427.07,0.019762]"

13:01:10 "Deleting object L39_TK_EP1 with invalid ID at pos [4789.07,2427.07,0.019762]"

Link to comment
Share on other sites

  • 4 weeks later...

Thanks to everyone that has given me infor. i had to really work hard on this on. BUT I got it. Not one person had the whole answer or would not give it to me. maybe they wanted to make me work for it. If that was the case, im glad they did.

Just with this script i have learned how server side works with mission side. THANK YOU ALL

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

×
×
  • Create New...