Jump to content

[RELEASE] Vehicle Key Changer - For making Masterkey - V 1.4 (Updated 06/15/2014)


OtterNas3

Recommended Posts

Again is some problem. 

When i walk around and i have some gold in my inventory. (to claim vehicle need 2 gold)

So if i have in my inventory 8 golds, and i look at 4 diferent cars and menu show me to claim vehicle, when i claim vehicle on last car i dont pay 2 golds but all 8 golds what i have, becose before i was looking to those first 3 vehicle where i dont use menu with claim vehicle,

 

b_560_95_1.png

Link to comment
Share on other sites

i followed the simple instructions and added the fix that was listed later on in the forums and all worked like a charm. Simple. However since the newest arma 2 update all of a sudden cars are moving sometimes to an earlier state. no duping or anything funny that way... just sometimes you buy a car master key it and move it to your base on restart it goes back to trader. 

Link to comment
Share on other sites

EDIT : Ive found the awnser to my problem. finally I had a folder in my host file where I was able to edit my dayz_server.pbo so now the script seems to work. Ive not tested the script enough to make sure its all working properly but I already have problems claiming a vehicle. the option to claim in the scroll menu simply doesnt appear. any ideas?

 

Hi! I have read all 10 pages and I realized there is a small problem for some users only that is still unawnsered.


 
I am using Vilayer to host my server and it is blocking any change I made in my dayz_server.pbo so I had to call the file server_updateObject.sqf in my init.sqf to read from its new location witch in my case is : custom/server_updateObject.sqf
 
part of my init.sqf...

86  if (isServer) then {

87      //key shit
88      _nil = [] execVM "custom\server_updateObject.sqf";
89      //Compile vehicle configs
90      call compile preprocessFileLineNumbers "fixes\dynamic_vehicle.sqf";
91      // Add trader citys
92      _nil = [] execVM "trader\mission.sqf";
93
94      _serverMonitor = [] execVM "\z\addons\dayz_code\system\server_monitor.sqf";
95  };

 

Then I realized that nothing in the keychanger file was made to call a ''modified'' server_updateObject.sqf in the mission file... And I found this part of code in VehicleKeyChanger.sqf witch apparently call the function in dayz_server/compile/server_updateObject.sqf 

 

VehicleKeyChanger.sqf line 135 to 137 (Gwandoya's files)

/* This calls the custom update function which we put it in server_updateObject.sqf */
PVDZE_veh_Update = [_targetVehicle, "vehiclekey", player, _targetVehicleClassname, keyNumberSelect, keyNameSelect, _targetVehicleID, _targetVehicleUID];
publicVariableServer "PVDZE_veh_Update";

 

This is where I need your help figuring out how to call the file in its new location in this script!

 

Thanks

 

Link to comment
Share on other sites

  • 2 weeks later...

Update 1.4

 

See first Post for changelog

 

 

Moo,

Otter

 

Thank you for updating and clear things out.

Only one thing is missing for claiming mission vehicles:

 

_object call fnc_veh_ResetEH;

 

after

 

_object setVariable ["BTC_Cannot_Lift",true,true];

Link to comment
Share on other sites

Yes, true, I checked the code several times.

It's about adding the event handler for mission spawned vehicles, updating 'all' when player gets in or out of a vehicle.

This event handler is added by epoch when loads the server spawned vehicles from database.

But if I claim a mission spawned vehicle, which has no event handlers added (because it will not be saved in database), I need to add it, otherwise if player moves vehicle its position won't be updated in database, and he will find his vehicle after next server restart where mission spawned it.

 

/***********************************************************
ASSIGN DAMAGE HANDLER TO A UNIT
- Function fnc_veh_ResetEH
- unit call fnc_veh_ResetEH
************************************************************/

_this removeAllEventHandlers "HandleDamage";
_this removeAllEventHandlers "Killed";
_this addeventhandler ["HandleDamage",{ _this call vehicle_handleDamage } ];
_this addeventhandler ["Killed",{ _this call vehicle_handleKilled } ];

if (isServer) then {
    _this removeAllEventHandlers "GetOut";
    _this removeAllEventHandlers "GetIn";
    _this addEventHandler ["GetOut", {[(_this select 0),"all"] call server_updateObject;}];
    _this addEventHandler ["GetIn", {[(_this select 0),"all"] call server_updateObject; _this call server_checkIfTowed;}];

};

Link to comment
Share on other sites

Maybe you did not seen it in my first post:

 

THIS DOES NOT HOWEVER INCLUDE MISSIONVEHICLES THAT ARE NOT SPAWNED CORRECTLY!

IF YOU WANT TO BE ABLE TO CLAIM MISSIONVEHICLES, TELL THE MISSION DEVELOPER TO SETUP HIS SPAWNCODE FOR VEHICLES TO A CORRECT WAY!

 

So the fix you posted would be for the Mission-Mod and not for this one.

Please post it there that the developer can add it to his "Save-Vehicle-To-Database" script

 

 

 

Moo,

Otter

Link to comment
Share on other sites

Oki, if you wish to discuss :)

 

Mission vehicles are created with ObjectID="0" and ObjectUID=call dayz_objectUID; they are in PVDZE_serverObjectMonitor, and Arma updates their positions correctly, but they will not be saved in DB.

I don't need to use fnc_veh_ResetEH or server_updateObject, because these mission vehicles are not intended to be saved in db and will disappear after restart.

However, with your great script players have the opportunity to claim and save mission vehicles as well. :) (I just need to update their positions after they are claimed.)

 

Cheers,

Gwan

Link to comment
Share on other sites

Okay now i get your point you want to be able to claim Vehicles from Missions that are NOT saved in the Database!

Thats another situation ^^

 

Then for sure you would need to add that call after the claim, i thought the Missionvehicle is stored to the Database already :rolleyes:

Misunderstood ya a bit!

 

See, discussions are productive sometimes ^^

 

 

Have fun,

Otter

Link to comment
Share on other sites

Great work again OtterNas3 your scripts are always awesome. As it stands when you go to try and claim a vehicle the player has to have the exact cost amount to get the claim vehicle action to pop up. So say I have "ItemBriefcase100oz" in my inventory but the claim cost is "ItemGoldBar10oz" it won't pop up because it can't do the conversion. I am planning on fixing this in the next couple of days is it cool if a post the revision to you and you update the script overall with it?

Link to comment
Share on other sites

No there is no vehiclefunctions.sqf needed

 

99% of the guys that asked me in Teamspeak about "why i get no menu entry" had not the right requirements in their inventory or messed up the config part.

 

For example:

If you have this block in your VehicleKeyChanger_Init.sqf

/////////////////////////////////////////////////
/////////////////////////////////////////////////
// Edit these settings to fit your needs/likes //
/////////////////////////////////////////////////
/////////////////////////////////////////////////
/// Claim Vehicles that does not yet need Key ///
///////// 0 = Not allowed | 1 = Allowed /////////
vkc_claiming = 1;
/////////////////////////////////////////////////
//////// Claim Vehicles costs this Item /////////
/// Any Item can be used here, some examples: ///
//// ItemTinBar, ItemSilverBar, ItemGoldBar, ////
////// ItemSilverBar10oz, ItemGoldBar10oz, //////
///// ItemBriefcase20oz, ItemBriefcase100oz /////
//////// set to "0" to disable the costs ////////
vkc_claimingPrice = "ItemGoldBar10oz";
/////////////////////////////////////////////////
////////// Change Key costs this Item ///////////
////////////// see above examples ///////////////
//////// set to "0" to disable the costs ////////
vkc_Price = "ItemSilverBar";
/////////////////////////////////////////////////
/////// Need KeyKit to use this function ////////
////////// 0 = Not needed | 1 = Needed //////////
vkc_needKeykit = 1;
/////////////////////////////////////////////////
/////////////////////////////////////////////////
/////////////// DONT EDIT BELOW ! ///////////////
/////////////////////////////////////////////////

To change a vehicle's Key you need:

  • KeymakersKit
  • ItemSilverBar
  • Key the vehicle is using at this moment
  • Another Key where you wanna put the Vehicle on

To Claim a vehicle that does not yet needs a Key you need:

  • KeymakersKit
  • ItemGoldBar10oz
  • A Key where you wanna put the Vehicle on

For the price, you need the exact given item in your inventory, so having a ItemBriefcase100oz will not work as the Mod doesnt handle the change itself!

 

 

vkc_claimingPrice = "ItemGoldBar10oz";

vkc_Price = "ItemSilverBar";

 

Dont forget to put the item between " " as it would not work if you just have it like this:

 

vkc_claimingPrice = ItemGoldBar10oz;

vkc_Price = ItemSilverBar;

 

 

 

Moo,

Otter

Link to comment
Share on other sites

Hey!

I give a try to the update but i have always the same Problem. same as in v1.3

if i made a master key on some vehicles they duplicate on Server restart inclusive all gear in them.

i see duplicating now on Armored Suv, and some Cargo Trucks.

also a issue is that some key id. seems to overlap with other ones.

example. a guy had an LAV.  a other guy have a BTR40.  the guy with the BTR 40 sell his car but Keep the key in his inventory. after the Server restart the LAV from the other guy teleportet to the Position where the guy with the BTR40 key has logged out.

also some vehicles was changing. example:

i guy bought a UH1Y. he dont made a master key or copy his key. after the Server restart the UH1Y was gone and instead of the UH1Y now is a LAV on exact the same Position. i searched the whole database for the UH1Y but cant find it there.

some realy strange things happened when i has your script activated. if i deactivate the script all run as normal. no cars teleport around. no cars duping themselve or transform themselfe.

i also has no rpt Errors.

strange or?

 

i run chernarus on 1.0.4.2

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
×
×
  • Create New...