KamikazeXeX Posted May 1, 2014 Report Share Posted May 1, 2014 So i want to add this to a right click menu, as per Cen's earlier comment i get that i can cut out the stuff in fn_selfActions and just setup a ExtraRc like this to deploy? class ExtraRc { class ItemToolbox { class DeployBike { text = "Deploy Bike"; script = "execVM 'scripts\deploys\bike\deploy.sqf'"; Although...... I still want it to question whether the user has said parts in their inventory before they build it, and i guess dropping the code from fn_selfActions would loose that? Thats my first issue! Issue 2 is so what if i wanted to have a single script that would manage packing any one of the vehicles that are deployable? saving an extra 2 options in the toolbox context menu? Either way, glad i stumbled upon this will go nicely on my LAN server :D Dave 1 Link to comment Share on other sites More sharing options...
Donnovan Posted May 2, 2014 Report Share Posted May 2, 2014 Delete cursorTarget is bad method anyway. Even if you check if the target is what it needs to be. Best way is to set variable to that vehicle when it's build and use it later to delete the object. I see, Sukkaed, But with "delete it later" you mean a clean it in the MySql database? This is ok, but you will need to kill the re-pack-bike option, since it can't be done without removing the bike. By the way, i loved the idea to add the bike to the MySql database and don't let it disapear after server restart. You know how we can do that? Thankyou in advance. Link to comment Share on other sites More sharing options...
TheFarix Posted May 3, 2014 Report Share Posted May 3, 2014 Ok. It is easy enough to adapt the deploy functions to use the right-click menu code. But what needs to remain with the packing functions? And can they be consolidated into one function?It would also be nice to be able to configure the packing distance, whether you can pack a locked vehicle, how much fuel the vehicle starts out with, whether the vehicle is armed (Mozzie's grenades), and what parts are needed for each vehicle. I would also like a sanity check to make sure the vehicle isn't occupied when it is packed. Link to comment Share on other sites More sharing options...
booternet Posted May 3, 2014 Report Share Posted May 3, 2014 hello all i would like to ask what do i do if i dont have a variables file or location in any folder and ive ran a search on my server and cannot find it anywhere to be able to add this deploy bike, ive got a managed server via gaming deluxe, anyone got any ideas? Link to comment Share on other sites More sharing options...
TheFarix Posted May 4, 2014 Report Share Posted May 4, 2014 I've been trying to work on a universal packing script and have came up with this. I haven't tested it, but it should work.1. Open your custom fn_selfActions.sqf and undo step 4 from the original mod.2. Search for: //Repairing Vehicles if ((dayz_myCursorTarget != _cursorTarget) and _isVehicle and !_isMan and _hasToolbox and (damage _cursorTarget < 1) and !_isDisallowRepair) then { Above it, add the following: //Pack Vehicles _isPackable = _typeOfCursorTarget in ["MMT_Civ","TT650_Civ","CSJ_GyroC","MH6J_EP1"]; if (_isPackable and _hasToolbox and !(locked _cursorTarget) and (damage _cursorTarget < 1)) then { if (s_player_packvehicle < 0) then { s_player_packvehicle = player addAction ["Pack Vehicle", "custom\deployables\pack.sqf",_cursorTarget, 0, false, true, "",""]; }; } else { player removeAction s_player_packvehicle; s_player_packvehicle = -1; }; 3. Search for: player removeAction s_player_fuelauto2; s_player_fuelauto2 = -1; Below it, add the following: player removeAction s_player_packvehicle; s_player_packvehicle = -1; 4. Create a new pack.sqf in the main deployables folder. Open the file with a text editor and past the following inside: if (dayz_combat == 1) exitwith { cutText ["You are in combat and cannot perform that action!", "PLAIN DOWN"]}; private ["_obj","_materials","_animState","_started","_finished"]; if(DZE_ActionInProgress) exitWith { cutText ["Vehicle packing already in progress." , "PLAIN DOWN"]; }; DZE_ActionInProgress = true; player removeAction s_player_packVehicle; s_player_packVehicle = 1; _obj = _this select 3; switch (typeOf _obj) do { case "MMT_Civ": { _materials = [["PartGeneric", 1], ["PartWheel", 2]]; }; case "TT650_Civ": { _materials = [["PartGeneric", 2], ["PartEngine", 1], ["PartWheel", 2]]; }; case "CSJ_GyroC": { _materials = [["PartGeneric", 2], ["PartEngine", 1], ["PartVRotor", 1], ["ItemJerrycanEmpty", 1]]; }; case "MH6J_EP1": { _materials = [["PartGeneric", 2], ["PartEngine", 1], ["PartVRotor", 1], ["ItemFuelBarrelEmpty", 1], ["PartGlass", 2]]; } }; cutText ["Packing vehicle started", "PLAIN DOWN"]; [1,1] call dayz_HungerThirst; player playActionNow "Medic"; [player,"repair",0,false] call dayz_zombieSpeak; [player,50,true,(getPosATL player)] spawn player_alertZombies; r_interrupt = false; _animState = animationState player; r_doLoop = true; _started = false; _finished = false; while {r_doLoop} do { _animState = animationState player; _isMedic = ["medic",_animState] call fnc_inString; if (_isMedic) then { _started = true; }; if (_started and !_isMedic) then { r_doLoop = false; _finished = true; }; if (r_interrupt) then { r_doLoop = false; }; sleep 0.1; }; r_doLoop = false; if (_finished) then { // Double check that object is not null if(!isNull(_obj)) then { _ipos = getPosATL _obj; //Delete from hive _objectID = _obj getVariable ["ObjectID","0"]; _objectUID = _obj getVariable ["ObjectUID","0"]; _activatingPlayer = player; PVDZE_obj_Delete = [_objectID,_objectUID,_activatingPlayer]; publicVariableServer "PVDZE_obj_Delete"; deleteVehicle _obj; if (_ipos select 2 < 0) then { _ipos set [2,0]; }; _radius = 1; // give refund items if((count _materials) > 0) then { _item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"]; { _itemOut = _x select 0; _countOut = _x select 1; if (typeName _countOut == "ARRAY") then { _countOut = round((random (_countOut select 1)) + (_countOut select 0)); }; _item addMagazineCargoGlobal [_itemOut,_countOut]; } forEach _materials; _item setposATL _iPos; player reveal _item; player action ["Gear", _item]; }; } else { cutText [(localize "str_epoch_player_91"), "PLAIN DOWN"]; }; } else { r_interrupt = false; player switchMove ""; player playActionNow "stop"; cutText ["Canceled packing vehicle", "PLAIN DOWN"]; }; DZE_ActionInProgress = false; s_player_packVehicle = -1; 5. You may now delete the other pack.sqf in the subdirectories to save space. My next steps will be to create a universal deploy script using maca134's Right Click Options To Items method and add some additional sanity checks (such as if the vehicle is unoccupied and for ownership). After that is reviewed and tested, I will repost it in it's own topic threat. Updated May 6, 2014. ispan55 1 Link to comment Share on other sites More sharing options...
TheFarix Posted May 6, 2014 Report Share Posted May 6, 2014 Packing script updated after some testing and an extensive rewrite. Link to comment Share on other sites More sharing options...
shiftd Posted May 8, 2014 Report Share Posted May 8, 2014 I'm trying to implement this on a Vilayer server and I am encountering an error. The vehicles kill the rider. I did edit the variables.sqf and re-upload the dayz_code.pbo but the Vilayer server eats that and replaces it with the original. Any help would be great. EDIT: I have tried to upload variables.sqf separately and place it in a mission folder and edit init.sqf to point to it. This resulted in a black and white screen with no character model and all the status indicators not working. Link to comment Share on other sites More sharing options...
Taszi Posted May 8, 2014 Report Share Posted May 8, 2014 I'm trying to implement this on a Vilayer server and I am encountering an error. The vehicles kill the rider. I did edit the variables.sqf and re-upload the dayz_code.pbo but the Vilayer server eats that and replaces it with the original. Any help would be great. EDIT: I have tried to upload variables.sqf separately and place it in a mission folder and edit init.sqf to point to it. This resulted in a black and white screen with no character model and all the status indicators not working. Hello, try add the DZE_safeVehicle variable to your ini.sqf in your mission folder. Like DZE_safeVehicle = ["ParachuteWest","ParachuteC","Old_bike_TK_INS_EP1","TT650_TK_EP1","CSJ_GyroC","An2_1_TK_CIV_EP1","AH6X_DZ"]; Make sure, the classnames match to your deployable vehicles. Link to comment Share on other sites More sharing options...
TheFarix Posted May 8, 2014 Report Share Posted May 8, 2014 A better method would be to create a custom variables file. First create an empty variables.sqf in your custom scripts directory. In it, you can add DZE_safeVehicle = DZE_safeVehicle + ["MMT_Civ","TT650_Civ","CSJ_GyroC","MH6J_EP1"]; or whatever the class names of your vehicles. Then in your ini.sqf search for: call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\variables.sqf"; Below it, add: call compile preprocessFileLineNumbers "SCRIPT_PATH\variables.sqf"; where "SCRIPT_PATH" is the path to your custom script directory. This is the method used in the script that I just released earlier today. Link to comment Share on other sites More sharing options...
shiftd Posted May 8, 2014 Report Share Posted May 8, 2014 EDIT: see below Link to comment Share on other sites More sharing options...
shiftd Posted May 8, 2014 Report Share Posted May 8, 2014 Hello, try add the DZE_safeVehicle variable to your ini.sqf in your mission folder. Like DZE_safeVehicle = ["ParachuteWest","ParachuteC","Old_bike_TK_INS_EP1","TT650_TK_EP1","CSJ_GyroC","An2_1_TK_CIV_EP1","AH6X_DZ"]; Make sure, the classnames match to your deployable vehicles. I will give this a shot and let you know if I get any better results. And thank you guys for the quick and helpful responses. Link to comment Share on other sites More sharing options...
raymix Posted May 8, 2014 Report Share Posted May 8, 2014 Not sure if anyone posted this, but if you are tired of searching for spawned vehicle every time you spawn one, then here's a quick fix: In all of your deploy SQF script files Find: sleep 6; _object = "MMT_Civ" createVehicle (position player); _object setVariable ["ObjectID", "1", true]; _object setVariable ["ObjectUID", "1", true]; player reveal _object; Replace with: sleep 6; _Offset = [0,5,0]; //change how far from player this vehicle will spawn X Y Z in meters, in this case 5 meters in front of player _worldPos = player modelToWorld _Offset; // spawn in front of player _object = "MMT_Civ" createVehicle (_worldPos); _object setVariable ["ObjectID", "1", true]; _object setVariable ["ObjectUID", "1", true]; _degrees = getDir player; //find out which direction player is looking at _object setDir _degrees; //rotate vehicle to match player's direction player reveal _object; Enjoy your bikes! cen 1 Link to comment Share on other sites More sharing options...
Charles Posted May 12, 2014 Report Share Posted May 12, 2014 wheres the varibles.sqf? Link to comment Share on other sites More sharing options...
Gondalf Posted May 13, 2014 Report Share Posted May 13, 2014 Hey only a tip fo you ... A player need with your script only 1 x scrap metal and 1 x glass for a little bird ... try it with something like this _generic = 0; { if (_x == "PartGeneric") then { _generic = _generic + 1; }; } forEach magazines player; _glass = 0; { if (_x == "PartGlass") then { _glass = _glass + 1; }; } forEach magazines player; if ((_generic >= 2) && (_glass >=2) && ("ItemToolbox" in _weapons && "PartEngine" in _mags && "PartFueltank" in _mags && "PartVRotor" in _mags && "ItemFuelBarrel" in _mags)) then { :) Link to comment Share on other sites More sharing options...
raymix Posted May 13, 2014 Report Share Posted May 13, 2014 Hey only a tip fo you ... A player need with your script only 1 x scrap metal and 1 x glass for a little bird ... try it with something like this _generic = 0; { if (_x == "PartGeneric") then { _generic = _generic + 1; }; } forEach magazines player; _glass = 0; { if (_x == "PartGlass") then { _glass = _glass + 1; }; } forEach magazines player; if ((_generic >= 2) && (_glass >=2) && ("ItemToolbox" in _weapons && "PartEngine" in _mags && "PartFueltank" in _mags && "PartVRotor" in _mags && "ItemFuelBarrel" in _mags)) then { :) or this _toolbox = "ItemToolbox" in weapons player; if (!_toolbox) then { cutText [format["Missing Toolbox"], "PLAIN DOWN"]; } else { if ([["PartGeneric",2], ["PartGlass",2], "PartVRotor","PartEngine","PartFueltank","ItemFuelBarrel"] call player_checkAndRemoveItems) then { //spawn bird }; }; This is original epoch way to check for items, it will actually notify players which parts are missing so they don't have to guess Bambit 1 Link to comment Share on other sites More sharing options...
Gravvy Posted May 13, 2014 Report Share Posted May 13, 2014 Alright so I installed this script. Now how the hell do you use it? Scroll wheel doesn't work, right clicking any of the parts needed or the toolbox shows nothing. How do you get this to work? Preferably with right click on toolbox. I saw cen commented with some code for it, but never explains where to put that code. Link to comment Share on other sites More sharing options...
Bambit Posted May 13, 2014 Report Share Posted May 13, 2014 @Gravvy Go with It has some pretty easy-to-follow manual. @raymix Could you, by any chance, post here how to code a check if someone is using a vehicle? So that if I click 'pack a vehicle' it gives me a note that I can't, because it's occupied? I tried with 'vehicle player = player' and other versions of this, but was unsuccesfull (because I have no idea what i'm doing... yet :P) Link to comment Share on other sites More sharing options...
Gravvy Posted May 13, 2014 Report Share Posted May 13, 2014 Thank you. Link to comment Share on other sites More sharing options...
raymix Posted May 13, 2014 Report Share Posted May 13, 2014 @raymix Could you, by any chance, post here how to code a check if someone is using a vehicle? So that if I click 'pack a vehicle' it gives me a note that I can't, because it's occupied? I tried with 'vehicle player = player' and other versions of this, but was unsuccesfull (because I have no idea what i'm doing... yet :P) //CORRECT: is player in a vehicle? vehicle player == player //WRONG: vehicle IS a player now vehicle player = player use = to create statement like - THIS is THAT now use == to check values like - is THIS like THAT? Link to comment Share on other sites More sharing options...
Bambit Posted May 13, 2014 Report Share Posted May 13, 2014 Thanks :) That helps more than error and trial that I do :D Will try it tommorow Link to comment Share on other sites More sharing options...
Chris9183 Posted May 18, 2014 Report Share Posted May 18, 2014 This script either does not work anymore, or is dependent on some other script that isn't mentioned here. Just did a completely fresh server install and followed the instructions to the letter...no go. Link to comment Share on other sites More sharing options...
shiftd Posted June 1, 2014 Report Share Posted June 1, 2014 A better method would be to create a custom variables file. First create an empty variables.sqf in your custom scripts directory. In it, you can add DZE_safeVehicle = DZE_safeVehicle + ["MMT_Civ","TT650_Civ","CSJ_GyroC","MH6J_EP1"]; or whatever the class names of your vehicles. Then in your ini.sqf search for: call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\variables.sqf"; Below it, add: call compile preprocessFileLineNumbers "SCRIPT_PATH\variables.sqf"; where "SCRIPT_PATH" is the path to your custom script directory. This is the method used in the script that I just released earlier today. I did not put this in my earlier post, but I also did just that. It resulted in an otherwise normal gameplay yet did not clear up the death on vehicle use. I did both the variables.sqf with only the one line and complete variables.sqf with the altered line. In both cases I was able to ride the vehicle once and upon spawning a second death would ensue. Followed these instructions without syntax errors and it worked. Link to comment Share on other sites More sharing options...
BaobobMiller Posted June 14, 2014 Report Share Posted June 14, 2014 Installed the scripts... Never got anything on scroll options (like with other self actions) so I added the deploy scripts to Extra RC... Now they do not require any parts to deploy. Script still removes them if they are there but does not "require" them. Ideas? Thanks Bao Link to comment Share on other sites More sharing options...
deicide Posted June 17, 2014 Report Share Posted June 17, 2014 or this _toolbox = "ItemToolbox" in weapons player; if (!_toolbox) then { cutText [format["Missing Toolbox"], "PLAIN DOWN"]; } else { if ([["PartGeneric",2], ["PartGlass",2], "PartVRotor","PartEngine","PartFueltank","ItemFuelBarrel"] call player_checkAndRemoveItems) then { //spawn bird }; }; This is original epoch way to check for items, it will actually notify players which parts are missing so they don't have to guess This is exactly what I am trying to do. I like the script a lot my only thing is players wont know what they can build or what they need. Since they might not even notice the script till they have the mats to force the scroll menu. I am about to put a list of materials in my dubug menu for now lol. where do i use this script? I would add extra rc options and deploy that way. I'm kind of new to this but only need a slight nudge. Link to comment Share on other sites More sharing options...
deicide Posted June 17, 2014 Report Share Posted June 17, 2014 Installed the scripts... Never got anything on scroll options (like with other self actions) so I added the deploy scripts to Extra RC... Now they do not require any parts to deploy. Script still removes them if they are there but does not "require" them. Ideas? Thanks Bao This script either does not work anymore, or is dependent on some other script that isn't mentioned here. Just did a completely fresh server install and followed the instructions to the letter...no go. It still works. you do need to have the materials on you for the option to even show. try the script TheFarix posted. I have it running now works great. Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now