DZAI Mission vehicles not being able to sell after epoch patch

Flosstradamus

New Member
Basically the title is what explains my situation. After patching to 1.0.4 I am not able to sell any vehicles from a mission to the trader.

Any idea's?
 
The wrong classnames. You need to make sure the vehicles you are using with the missions are the same classnames the traders vehicles or they wont buy them.

Also, since when does DZAI have a mission system?
 
I found the problem in the core code of epoch 1.0.4.
The condition to sell a vehicle is that it must have ObjectID and ObjectUID.
\z\dayz_code\actions\trade_any_vehicle.sqf
line #217:
Code:
_objectID    = _obj getVariable ["ObjectID","0"];
_objectUID   = _obj getVariable ["ObjectUID","0"];

_notSetup = (_objectID == "0" && _objectUID == "0");

if(local _obj and !isNull _obj and alive _obj and !_notSetup) then {
...
};
} else {
    cutText [(localize "str_epoch_player_245"), "PLAIN DOWN"];
};

I solved it by modifing player_traderMenu.sqf and saved it under MPMissions\<instance>\fixes\player_traderMenu.sqf:
line #107:
Code:
if (_afile=="trade_any_vehicle") then {
    _File = "fixes\" + _afile + ".sqf";
} else {
    _File = "\z\addons\dayz_code\actions\" + _afile + ".sqf";
};

and modified trade_any_vehicle.sqf and saved it under MPMissions\<instance>\fixes\trade_any_vehicle.sqf:
line #222:
Code:
if(local _obj and !isNull _obj and alive _obj) then {
     if(_okToSell) then {
         if(_objectID != "0" && _objectUID != "0") then {

         PVDZE_obj_Delete = [_objectID,_objectUID,_activatingPlayer];
         publicVariableServer "PVDZE_obj_Delete";
         };
         deleteVehicle _obj;
         // payout
         _canAfford = [[[_part_out,_qty_out]],1] call epoch_returnChange;

         cutText [format[(localize "str_epoch_player_181"),_qty_in,_textPartIn,_qty_out,_textPartOut], "PLAIN DOWN"];
    
        
     } else {
         cutText [format[(localize "str_epoch_player_182"),_textPartIn] , "PLAIN DOWN"];
     };
} else {
     cutText [(localize "str_epoch_player_245"), "PLAIN DOWN"];
};

Then I placed the compile code in my custom comple.sqf (this file is called from init.sqf):
Code:
if (!isDedicated) then {
   // trader menu code fix
   call compile preprocessFileLineNumbers "fixes\player_traderMenu.sqf";
   };
 
Last edited:
^Easier way is to just set a random object UID and ID on the vehicle like this:

Code:
     _object = "Old_bike_TK_INS_EP1" createVehicle (position player);
     _uniqueid = str(round(random 999999));
     _object setVariable ["ObjectID", _uniqueid, true];
     _object setVariable ["ObjectUID", _uniqueid, true];

This also prevents it from being deleted by server_updateObject.sqf, but does not make it save after restart.

Where does this go then? On top of the trade_any_vehicle.sqf
And do you have put every not possible vehicle sell there [_object = "Old_bike_TK_INS_EP1" createVehicle (position player);] there like the bike?
 
Back
Top