Jump to content

[How to] Add custom vehicles and remove weapons


Recommended Posts

  • 4 weeks later...

@raymix, hi! ur work is cool)

i know english bad, so cant understand all information.

 

just a question, is it possible to make new bags\cars\weapons with edited cofigurations, but with the same textures\sounds\models. so players dont need to download special mod?

 

thx

Link to comment
Share on other sites

  • 7 months later...

After some "tooling" about I figured out the fix for this:

 

1) Person gets into vehicle and it explodes or vanishes.

2) Person places anything into vehicle and closed the inventory screen and the vehicle vanishes.

 

Raymix's video works perfectly just need to do this as well.

 

You define your custom variable that will hold the vehicles you are putting into the game via the the map edit. The numbers before the code are the related line numbers in the .sqf.  this is a fast overview of what was covered in the video.

 

server_updateObject.sqf

@Dayz_Epoch\addons\dayz_server\compile\    - file location

8 private ["_myCustom",.....

 

18_myCustom = ((typeOf _object == "policecar,") || (typeOf _object == "TT650_TK_EP1"));

NOTE: "||" =  "&&"  as seen in the video that Raymix does his code changes. Both are just different way of doing "and". 

 

variables.sqf

@DayZ_Epoch\addons\dayz_code\init\ - file location

643 DZE_safeVehicle = ["policecar","TT650_TK_EP1", "ParachuteWest","ParachuteC"];

 

I am using a police car and a standard motorcycle (tt650). The video is about jets (same concept)

 

call_this_whatever.sqf

if (isServer) then {
 
private ["_object","_uniqueid"];
 
_vehicle_30516 = objNull;
if (true) then
{
  _this = createVehicle ["policecar", [4736.2217, 10187.732], [], 0, "CAN_COLLIDE"];
  _vehicle_30516 = _this;
  _this setDir 149.55269;
  _this setPos [4736.2217, 10187.732];
  _this setVariable ["malsar",1,true];
  _uniqueid = str(round(random 999999));
  _this setVariable ["ObjectID", _uniqueid, true];
  _this setVariable ["ObjectUID", _uniqueid, true];
};
 
_vehicle_30517 = objNull;
if (true) then
{
  _object = createVehicle ["TT650_TK_EP1", [4728.0039, 10182.728], [], 0, "CAN_COLLIDE"];
  _vehicle_30517 = _object;
  _object setDir 145.62102;
  _object setPos [4728.0039, 10182.728];
  _object setVariable ["malsar",1,true];
  _uniqueid = str(round(random 999999));
  _object setVariable ["ObjectID", _uniqueid, true];
  _object setVariable ["ObjectUID", _uniqueid, true];
};
 
};

 

Here are the called vehicles.  I have them in a separate SQF file. You can leave them in your mapedit SQF just add the following bolded lines under your placed vehicle(s):

 

You will see people using _this or _object doesn't really matter long as it looks like the above two examples.  The "policecar" example fits exactly with your mapedit mission.sqf file will look like.

 

So you add your vehicle to the map you are making.  Edit the code (mission.sqf) add in the bold lines as defined above. Save your file as whatever you wish to call it.  nwaf.sqf. Call it from your init.sqf or server side whichever works for you.

 

This method works. tried it several times with myself and friends. If anyone catches a mistake I will correct / edit / re-post this.

 

IF you wish to REMOVE weapons, please follow what Raymix tells you in his video.  This post is only serves to cover the exploding / vanishing due to infistar.

 

==================================================================================

how to know if infistar or not? look at your RPT log for something like this:

"infiSTAR.de Log: Just_R (765xxx) | DELETED Vehicle with Invalid ID(0): TT650_TK_EP1 @123027"

 

"["PVAHR_0_pvndjgof",["Just_R","765xxxxx","DELETED Vehicle with Invalid ID(0): TT650_TK_EP1 @123027"]]"

 

 

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];

 

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...