ViktorReznov Posted September 16, 2017 Report Share Posted September 16, 2017 (edited) Outdated! Pls see updated thread Start scrapping entire vehicles, tired of hunting warehouse to warehouse, construction complex to complex? Fear no more, you can salvage tires and windows but not fuel tank parts or engine parts? This changes that! THIS IS A WIP! I have brought it a long way, but Ive got a lot more I want to do with this. As of right now, you can walk up to a vehicle that is unlocked, unoccupied(i hope) and not already blown dafuq up and reduce it into parts. This will allow you to salvage scrap, tank parts, tires, glass and engine parts (eventually rotors with aircraft when I get there). Its instantaneous (for now) and drops all loot into a box. All loot has a chance to generate, with failures actually damaging the parts you were working on, too much bad luck and vehicle WILL BLOW UP! Once you hit success, the amount of loot in the box is not locked, it will spawn a configured random amount each time. (there is a very rare chance you can succeed and get an empty box, laughed my batoutie off when it happened, on the toDO list). If you are interested, the install is below. Install This basically assumes you have installed one of the other, various, better, more important, better written mods already and therefore already have a custom compiles/variables/fn_selfActions. So we are going to skip that part and move onto the other stuff. Pretty straightforward. Drag and drop the scrapper folder into your scripts folder (or change the filepaths if you migrate it elsewhere) apply the additional snippets in variables and selfActions to your files. Variables are configurable and this is easily expandable to cover so many more vehicles. My plan is to eventually cover all the vehicles in Epoch and Overwatch.my github link https://github.com/Arstan13/EpochScrapper toDo: Add More vehicles partial, ive added files and variables to support more vehicles, i havent filled them in yet Will no longer be necessary! fix empty box on success Will no longer be possible cleanup the code (im learning here) limit where you can totally salvage a vehicle configurable but required to be close to certain buildings fixed fail chance was set to to perma fail for testing, updated chance for tools to break complete, one in 10 scrappings will break a tool. (in theory) time and animation like epoch deconstructing fix vehicle damage permanency planes still semi-broken though change to generate scrap based on vehicle's parts availability dynamic crate partially complete chance to return vehicle mounted weapons on scrap (for those we can) still thinking update: This script is now moving in a more dynamic direction. Will no longer require to define vehicles in order to work with them, script will instead return a list of parts and their damages, then roll chance for them to spawn on scrapping. A couple of exclusions to this would be for planes (they only show Hull and I think missles (if applicable) for damages when there is indeed far more parts), bicycles (tires from a bike, etc) Edited October 5, 2017 by ViktorReznov juandayz and axeman 2 Link to comment Share on other sites More sharing options...
Relentless Posted September 16, 2017 Report Share Posted September 16, 2017 Just a quick question. What's the difference between the vanilla salvaging vehicle from epoch and your script? I mean aren't you able to salvage parts from a vehicle with a toolbox already? Link to comment Share on other sites More sharing options...
ViktorReznov Posted September 16, 2017 Author Report Share Posted September 16, 2017 my script will salvage the entire vehicle and all possible parts. epoch salvage is glass and tires. and complete removal from database when done. (if i coded it right) so no vehicles on blocks. for me, this script was an idea that hadnt been done yet and i wanted to learn so I took it head on. Link to comment Share on other sites More sharing options...
Relentless Posted September 16, 2017 Report Share Posted September 16, 2017 Okay, didn't know that. Cool man, keep it up, learning by doing is always the best method! Link to comment Share on other sites More sharing options...
Runewulv Posted September 17, 2017 Report Share Posted September 17, 2017 Works great mate. Just tested it on my server. I'm going to be expanding the selection. If I get this done before someone else, I'll throw you the updated files. I'm going to be expanding it to use gas stations as well. I'm assuming "Land_Repair_Center","Other Building" is the appropriate format for multiple buildings? BTW, this is a great update for Advanced Salvage. It was an old script that used to work Pre-1051. But after 1051 for some reason it created an exploit where you could salvage infinite tires. It became obsolete because of this. I used to love this script, but it was tied into the default salvage system. Link to comment Share on other sites More sharing options...
Runewulv Posted September 17, 2017 Report Share Posted September 17, 2017 Spoiler VRcars = ["car_hatchback","car_sedan","datsun1_civil_1_open_DZE","datsun1_civil_2_covered_DZE","datsun1_civil_3_open_DZE","GLT_M300_LT","GLT_M300_ST","hilux1_civil_1_open_DZE","hilux1_civil_2_covered_DZE","hilux1_civil_3_open_DZE","Lada1""Lada1_TK_CIV_EP1","Lada2","Lada2_TK_CIV_EP1","LadaLM","policecar","S1203_ambulance_EP1","S1203_TK_CIV_EP1","Skoda","SkodaBlue","SkodaGreen","SkodaRed","VolhaLimo_TK_CIV_EP1","Volha_1_TK_CIV_EP1","Volha_2_TK_CIV_EP1","VWGolf","ArmoredSUV_PMC_DZE","BAF_Offroad_W","BTR40_MG_TK_GUE_EP1","BTR40_TK_GUE_EP1","GAZ_Vodnik_HMG","GAZ_Vodnik_DZE","GAZ_Vodnik_MedEvac","HMMWV_Ambulance","HMMWV_Ambulance_CZ_DES_EP1","HMMWV_DES_EP1","HMMWV_DZ","HMMWV_M1035_DES_EP1","HMMWV_M1151_M2_CZ_DES_EP1_DZE","HMMWV_M998A2_SOV_DES_EP1_DZE","HMMWV_Armored","HMMWV_Avenger","LandRover_CZ_EP1","LandRover_MG_TK_EP1_DZE","LandRover_Special_CZ_EP1_DZE","LandRover_TK_CIV_EP1","Offroad_DSHKM_Gue_DZE""Offroad_SPG9_Gue","Pickup_PK_GUE_DZE","Pickup_PK_INS_DZE","Pickup_PK_TK_GUE_EP1_DZE","SUV_Blue","SUV_Camo","SUV_Charcoal","SUV_Green","SUV_Orange","SUV_Pink","SUV_Red","SUV_Silver","SUV_TK_CIV_EP1","SUV_White","SUV_Yellow","UAZ_CDF","UAZ_INS","UAZ_MG_TK_EP1_DZE","UAZ_RU","UAZ_Unarmed_TK_CIV_EP1","UAZ_Unarmed_TK_EP1","UAZ_Unarmed_UN_EP1","UAZ_SPG9_INS","MTVR"]; I added a mtvr to the array because I wanted to see if it would recognize more than 4 tires. Also, was curious. Does this script recognize when tires are missing or glass are missing? Was just wondering what was to stop a player from stripping the vehicle of tires and glass and then scrapping it? Would also suggest when the vehicle is damaged, the parts below a certain percentage should be excluded from scrapping? It would make the parts damaging aspect more vital than the rare chance it happens more than once. EDIT: Further testing. I removed all the tires and glass from a vehicle. Went to scrap it, and it caused damage. HOWEVER, in doing damage it basically repaired the car so that it had full tires and fixed glass again. Link to comment Share on other sites More sharing options...
ViktorReznov Posted September 17, 2017 Author Report Share Posted September 17, 2017 1 hour ago, Runewulv said: Reveal hidden contents VRcars = ["car_hatchback","car_sedan","datsun1_civil_1_open_DZE","datsun1_civil_2_covered_DZE","datsun1_civil_3_open_DZE","GLT_M300_LT","GLT_M300_ST","hilux1_civil_1_open_DZE","hilux1_civil_2_covered_DZE","hilux1_civil_3_open_DZE","Lada1""Lada1_TK_CIV_EP1","Lada2","Lada2_TK_CIV_EP1","LadaLM","policecar","S1203_ambulance_EP1","S1203_TK_CIV_EP1","Skoda","SkodaBlue","SkodaGreen","SkodaRed","VolhaLimo_TK_CIV_EP1","Volha_1_TK_CIV_EP1","Volha_2_TK_CIV_EP1","VWGolf","ArmoredSUV_PMC_DZE","BAF_Offroad_W","BTR40_MG_TK_GUE_EP1","BTR40_TK_GUE_EP1","GAZ_Vodnik_HMG","GAZ_Vodnik_DZE","GAZ_Vodnik_MedEvac","HMMWV_Ambulance","HMMWV_Ambulance_CZ_DES_EP1","HMMWV_DES_EP1","HMMWV_DZ","HMMWV_M1035_DES_EP1","HMMWV_M1151_M2_CZ_DES_EP1_DZE","HMMWV_M998A2_SOV_DES_EP1_DZE","HMMWV_Armored","HMMWV_Avenger","LandRover_CZ_EP1","LandRover_MG_TK_EP1_DZE","LandRover_Special_CZ_EP1_DZE","LandRover_TK_CIV_EP1","Offroad_DSHKM_Gue_DZE""Offroad_SPG9_Gue","Pickup_PK_GUE_DZE","Pickup_PK_INS_DZE","Pickup_PK_TK_GUE_EP1_DZE","SUV_Blue","SUV_Camo","SUV_Charcoal","SUV_Green","SUV_Orange","SUV_Pink","SUV_Red","SUV_Silver","SUV_TK_CIV_EP1","SUV_White","SUV_Yellow","UAZ_CDF","UAZ_INS","UAZ_MG_TK_EP1_DZE","UAZ_RU","UAZ_Unarmed_TK_CIV_EP1","UAZ_Unarmed_TK_EP1","UAZ_Unarmed_UN_EP1","UAZ_SPG9_INS","MTVR"]; I added a mtvr to the array because I wanted to see if it would recognize more than 4 tires. Also, was curious. Does this script recognize when tires are missing or glass are missing? Was just wondering what was to stop a player from stripping the vehicle of tires and glass and then scrapping it? Would also suggest when the vehicle is damaged, the parts below a certain percentage should be excluded from scrapping? It would make the parts damaging aspect more vital than the rare chance it happens more than once. EDIT: Further testing. I removed all the tires and glass from a vehicle. Went to scrap it, and it caused damage. HOWEVER, in doing damage it basically repaired the car so that it had full tires and fixed glass again. Yea my damage to a vehicle is definitely incomplete, I opened a question to fix that problem. I am a novice scripter. I eventually want to get it to the point that will check a vehicles current damage to parts and roll from there. Adding an mtvr to the array will indeed make it so you can scrap it but at the settings of the array you added. Ie Cycles(motos, not bikes), Quads, Cars(all light trucks and suvs are intended to be in there). I have plans for Trucks (mtvrs, urals, kamaz, etc), APV, Tanks, Helis, Planes. Im still developing. 14 hours ago, Runewulv said: Works great mate. Just tested it on my server. I'm going to be expanding the selection. If I get this done before someone else, I'll throw you the updated files. I'm going to be expanding it to use gas stations as well. I'm assuming "Land_Repair_Center","Other Building" is the appropriate format for multiple buildings? And yes, that is accurate. Thanks for the input m8! Link to comment Share on other sites More sharing options...
Runewulv Posted September 17, 2017 Report Share Posted September 17, 2017 good deal mate, just trying to help with some testing and input. Let me know if you get any help in the other thread. Otherwise I really like the idea, and my players seem to like it as well. Link to comment Share on other sites More sharing options...
Zoranth Posted September 18, 2017 Report Share Posted September 18, 2017 @ViktorReznov, Great Work Another thing to think about is if it is an armed vehicle and it has ammo already in a weapon that it might be able to put the ammo in the box. For example, an ArmoredSUV_PMC and it has 2x magazines in the gun already which have no way of being reclaimed. Make it so when scrapping that there is a chance of getting those magazines back. Just a thought ;) Relentless 1 Link to comment Share on other sites More sharing options...
Relentless Posted September 18, 2017 Report Share Posted September 18, 2017 2 minutes ago, Zoranth said: @ViktorReznov, Great Work Another thing to think about is if it is an armed vehicle and it has ammo already in a weapon that it might be able to put the ammo in the box. For example, an ArmoredSUV_PMC and it has 2x magazines in the gun already which have no way of being reclaimed. Make it so when scrapping that there is a chance of getting those magazines back. Just a thought ;) I like the idea. Also that you just get it back with a chance and not everytime, this would be way to OP. Link to comment Share on other sites More sharing options...
ViktorReznov Posted September 19, 2017 Author Report Share Posted September 19, 2017 1 hour ago, Zoranth said: @ViktorReznov, Great Work Another thing to think about is if it is an armed vehicle and it has ammo already in a weapon that it might be able to put the ammo in the box. For example, an ArmoredSUV_PMC and it has 2x magazines in the gun already which have no way of being reclaimed. Make it so when scrapping that there is a chance of getting those magazines back. Just a thought ;) That is exactly the direction I am trying to take this. Being so new at scripting arma tho, its definitely a challenge. 1 hour ago, DAmNRelentless said: I like the idea. Also that you just get it back with a chance and not everytime, this would be way to OP. Yes, trying to make it all a chance. right now the code itself is WAY to bloated but still learning here. Right now my headache rests with damaging the vehicle... However, should I get that code nailed down, it will lead to doing just this! Link to comment Share on other sites More sharing options...
Relentless Posted September 19, 2017 Report Share Posted September 19, 2017 8 minutes ago, ViktorReznov said: Right now my headache rests with damaging the vehicle I answered you in your question topic, hope this helps. Use salivals service_point as reference and also the wiki entry. It's pretty good explained there. Link to comment Share on other sites More sharing options...
juandayz Posted September 19, 2017 Report Share Posted September 19, 2017 @ViktorReznov have an idea.. maybe u can do it. broke engines to get some wires and scrap electronics. and set damage only over the vehicle engine. another thing.. fill fueltanks with water .. to limit the speed of this vehicle.. from 100 to 25mph. for example. trolling vehicles Relentless 1 Link to comment Share on other sites More sharing options...
Zoranth Posted September 19, 2017 Report Share Posted September 19, 2017 38 minutes ago, juandayz said: another thing.. fill fueltanks with water .. to limit the speed of this vehicle.. from 100 to 25mph. for example Roflmao, Yes, walk up to someones vehicle and put a canteen or 2 of water in their fuel tank juandayz 1 Link to comment Share on other sites More sharing options...
ViktorReznov Posted September 23, 2017 Author Report Share Posted September 23, 2017 Update: generation of parts is based on damage to existing parts and dependent on parts available. This function is in progress and nearly complete Runewulv 1 Link to comment Share on other sites More sharing options...
juandayz Posted September 24, 2017 Report Share Posted September 24, 2017 @ViktorReznov hey mate just a doubt.. scuse me cuz maybe cannot understand your code.. but do you belive if is possible use one sigle file for all of this? for example in this line of scraptastic.sqf if (_vehClass in VRapvs) then { _chance = random 100; if (_chance >= 40) then { [_vehClass] ExecVM "scripts\scrapper\GlobalScrap.sqf"; call _fn_del_vehicle; systemChat("Successfully scrapped vehicle, usable parts are in that crate!"); } else { call _fn_dmg_veh; systemChat("Be careful! You just damaged your vehicle!"); }; }; can you replace it by something like: Spoiler _chance = random 100; if (_chance >= 40) then { [_vehClass] ExecVM "scripts\scrapper\GlobalScrap.sqf"; call _fn_del_vehicle; systemChat("Successfully scrapped vehicle, usable parts are in that crate!"); } else { call _fn_dmg_veh; systemChat("Be careful! You just damaged your vehicle!"); }; then create a new sqf.. GlobalScrap.sqf Spoiler use the same locals _variables for each veh class and put statements if some others vehicles uses diferents parts. example private["_dir","_pos","_spawnCrate","_randFlip","_randLow","_randMid","_player","_type"]; _vehicle = _this select 3; _vehClass = typeOf _vehicle; if (_vehClass in VRapvs ) then { _VRApcParts = [["PartGeneric","1"],["PartWheel","1"],["PartEngine","1"],["PartFueltank","1"],["PartGlass","1"]]; }else{ if (_vehClass in VRquads) then { _VRApcParts = [["PartEngine","1"],["PartFueltank","1"],["PartGlass","1"]]; }; }; //containers for our random vars so we can insert into an array as whole figure for that effin workaround _randFlip = floor((random 5)/2); _randLow = floor(random 8); _randMid = floor(random 10); //setting the number of each part to add _VRApcParts select 0 set [1,_randMid]; _VRApcParts select 1 set [1,_randLow]; _VRApcParts select 2 set [1,_randFlip]; _VRApcParts select 3 set [1,_randFlip]; _VRApcParts select 4 set [1,(_randFlip + 1)]; _player = player; _type = _this select 0; // Name of this crate _crateName = "Scrap Crate"; // Crate type. Possibilities: MedBox0, FoodBox0, BAF_BasicWeapons, USSpecialWeaponsBox, USSpecialWeapons_EP1, USVehicleBox, RUSpecialWeaponsBox, RUVehicleBox, etc. _classname = "USOrdnanceBox"; // Location of player and crate _dir = getdir _player; _pos = getposATL _player; _pos = [(_pos select 0)+1*sin(_dir),(_pos select 1)+1*cos(_dir), (_pos select 2)]; //actually spawn the crate _spawnCrate = _classname createVehicleLocal _pos; _spawnCrate setDir _dir; _spawnCrate setposATL _pos; //clear crate before filling it clearWeaponCargoGlobal _spawnCrate; clearMagazineCargoGlobal _spawnCrate; clearBackpackCargoGlobal _spawnCrate; //fill it with this crap. freaking workaround looks terribly ugly and prolly slow as crap but wont populate if structured ["PartGeneric", (0 + floor(random 3))]; _spawnCrate addMagazineCargoGlobal [(_VRApcParts select 0) select 0, (_VRApcParts select 0) select 1]; _spawnCrate addMagazineCargoGlobal [(_VRApcParts select 1) select 0, (_VRApcParts select 1) select 1]; _spawnCrate addMagazineCargoGlobal [(_VRApcParts select 2) select 0, (_VRApcParts select 2) select 1]; _spawnCrate addMagazineCargoGlobal [(_VRApcParts select 3) select 0, (_VRApcParts select 3) select 1]; _spawnCrate addMagazineCargoGlobal [(_VRApcParts select 4) select 0, (_VRApcParts select 4) select 1]; diag_log format["[SCRAPPER] %1 just scrapped %2, at location %3!",_player,_type,_pos]; Link to comment Share on other sites More sharing options...
ViktorReznov Posted September 24, 2017 Author Report Share Posted September 24, 2017 3 minutes ago, juandayz said: @ViktorReznov hey mate just a doubt.. scuse me cuz maybe cannot understand your code.. but do you belive if is possible use one sigle file for all of this? for example in this line of scraptastic.sqf if (_vehClass in VRapvs) then { _chance = random 100; if (_chance >= 40) then { [_vehClass] ExecVM "scripts\scrapper\GlobalScrap.sqf"; call _fn_del_vehicle; systemChat("Successfully scrapped vehicle, usable parts are in that crate!"); } else { call _fn_dmg_veh; systemChat("Be careful! You just damaged your vehicle!"); }; }; can you replace it by something like: Reveal hidden contents _chance = random 100; if (_chance >= 40) then { [_vehClass] ExecVM "scripts\scrapper\GlobalScrap.sqf"; call _fn_del_vehicle; systemChat("Successfully scrapped vehicle, usable parts are in that crate!"); } else { call _fn_dmg_veh; systemChat("Be careful! You just damaged your vehicle!"); }; then create a new sqf.. GlobalScrap.sqf Reveal hidden contents use the same locals _variables for each veh class and put statements if some others vehicles uses diferents parts. example private["_dir","_pos","_spawnCrate","_randFlip","_randLow","_randMid","_player","_type"]; _vehicle = _this select 3; _vehClass = typeOf _vehicle; if (_vehClass in VRapvs or ) then { // array to fill because of stupid workaround _VRApcParts = [["PartGeneric","1"],["PartWheel","1"],["PartEngine","1"],["PartFueltank","1"],["PartGlass","1"]]; }else{ if (_vehClass in VRquads) then { _VRApcParts = [["PartEngine","1"],["PartFueltank","1"],["PartGlass","1"]]; }; }; //containers for our random vars so we can insert into an array as whole figure for that effin workaround _randFlip = floor((random 5)/2); _randLow = floor(random 8); _randMid = floor(random 10); //setting the number of each part to add _VRApcParts select 0 set [1,_randMid]; _VRApcParts select 1 set [1,_randLow]; _VRApcParts select 2 set [1,_randFlip]; _VRApcParts select 3 set [1,_randFlip]; _VRApcParts select 4 set [1,(_randFlip + 1)]; _player = player; _type = _this select 0; // Name of this crate _crateName = "Scrap Crate"; // Crate type. Possibilities: MedBox0, FoodBox0, BAF_BasicWeapons, USSpecialWeaponsBox, USSpecialWeapons_EP1, USVehicleBox, RUSpecialWeaponsBox, RUVehicleBox, etc. _classname = "USOrdnanceBox"; // Location of player and crate _dir = getdir _player; _pos = getposATL _player; _pos = [(_pos select 0)+1*sin(_dir),(_pos select 1)+1*cos(_dir), (_pos select 2)]; //actually spawn the crate _spawnCrate = _classname createVehicleLocal _pos; _spawnCrate setDir _dir; _spawnCrate setposATL _pos; //clear crate before filling it clearWeaponCargoGlobal _spawnCrate; clearMagazineCargoGlobal _spawnCrate; clearBackpackCargoGlobal _spawnCrate; //fill it with this crap. freaking workaround looks terribly ugly and prolly slow as crap but wont populate if structured ["PartGeneric", (0 + floor(random 3))]; _spawnCrate addMagazineCargoGlobal [(_VRApcParts select 0) select 0, (_VRApcParts select 0) select 1]; _spawnCrate addMagazineCargoGlobal [(_VRApcParts select 1) select 0, (_VRApcParts select 1) select 1]; _spawnCrate addMagazineCargoGlobal [(_VRApcParts select 2) select 0, (_VRApcParts select 2) select 1]; _spawnCrate addMagazineCargoGlobal [(_VRApcParts select 3) select 0, (_VRApcParts select 3) select 1]; _spawnCrate addMagazineCargoGlobal [(_VRApcParts select 4) select 0, (_VRApcParts select 4) select 1]; diag_log format["[SCRAPPER] %1 just scrapped %2, at location %3!",_player,_type,_pos]; Hey @juandayz. Im actually creating the lists to be dynamic and base the potential scrap off of the current vehicles available parts and compare it to the damage of those parts to roll the chances you will get the part back. Im mid write of that code and for the most part it is working as id hope. So all that bloated code i wrote will be unnecessary real soon. Thanks for the question and input m8! You have always been helpful and its much appreciated! juandayz 1 Link to comment Share on other sites More sharing options...
ViktorReznov Posted September 25, 2017 Author Report Share Posted September 25, 2017 On 9/18/2017 at 9:42 PM, juandayz said: @ViktorReznov have an idea.. maybe u can do it. broke engines to get some wires and scrap electronics. What exactly are the ids for those? I did a search on the epoch git and found no electronics...? Was attempting to begin doing this. EDIT: NVM found them, doing a search for electronics on the epoch git didnt turn then up. crafting.hpp The below content not currently public. In progress and nearly complete. UPDATE: Dynamic code is improving very nicely. Reading all possible available parts on a vehicle, reading their damages, using that to turn into a chance percentage, rolling the chance and spawning the parts accordingly. Remapping of null/useless/generic parts for other components I.E. HitHRotor into scrap metal no more, produces rotor assembly. HitMissiles into scrap no more, using this for scrap electronics This rewrite will lead to a total of 3 files for this script and basically no new variables. Hope everyone is interested. Iron out a few more kinks in the dynamic code and then will move onto the conditional weapon code + spicing up salvages with acquiring some additional stuff.... juandayz 1 Link to comment Share on other sites More sharing options...
juandayz Posted September 25, 2017 Report Share Posted September 25, 2017 @ViktorReznov nice progress !!!! you can take some block of code from my "find items on wrecks" if u need spawn the parts over the ground and not into a crate. Also set a variable on the vehicle if u want not allow futures dismantles over the same vehicle. Any way good work viktor keep doing mods like this and your awesome fluctuating economy!!!!! Link to comment Share on other sites More sharing options...
Relentless Posted September 25, 2017 Report Share Posted September 25, 2017 Looks like you are making some good progress and getting familiar with sqf. Keep it on! Edit: I could maybe hire/need you for my next project which is quite huge Link to comment Share on other sites More sharing options...
ViktorReznov Posted September 25, 2017 Author Report Share Posted September 25, 2017 4 hours ago, juandayz said: @ViktorReznov nice progress !!!! you can take some block of code from my "find items on wrecks" if u need spawn the parts over the ground and not into a crate. Also set a variable on the vehicle if u want not allow futures dismantles over the same vehicle. Any way good work viktor keep doing mods like this and your awesome fluctuating economy!!!!! Thank you @juandayz! I had been considering changing over to a non crate spawn just hadnt yet. This will generate quite a few items once you get to the larger vehicles so i just did the crates for now. Also, this script wont need an additional variable for the dismantles. It will completely remove the vehicle on succuss or blow it up on an unlucky failure! 4 hours ago, DAmNRelentless said: Looks like you are making some good progress and getting familiar with sqf. Keep it on! Edit: I could maybe hire/need you for my next project which is quite huge You just let me know m8! My schesule is crazy sometimes (even now 4am i am getting rdy for guard shift. Ty uncle sam!) but i dedicate a lot of time and dont give up! Link to comment Share on other sites More sharing options...
Runewulv Posted September 25, 2017 Report Share Posted September 25, 2017 cant wait for github to update, well done man. juandayz 1 Link to comment Share on other sites More sharing options...
ViktorReznov Posted September 25, 2017 Author Report Share Posted September 25, 2017 Just to keep y'all clued in to the progress, heres the code that will generate parts to be spawned Spoiler private ["_part","_vehicle","_hitpoints","_isBicycle","_isATV","_is6WheelType","_is8WheelType","_HasNoGlassKind","_hitpoint", "_6WheelTypeArray","_8WheelTypeArray","_NoGlassArray","_NoExtraWheelsArray","_nullPartsArray","_toSpawnArray","_RemovedPartsArray","_damage","_configVeh","_type"]; _vehicle = _this select 3; _hitpoints = _vehicle call vehicle_getHitpoints; _type = typeOf _vehicle; _isBicycle = _type in ["M1030_US_DES_EP1","MMT_Civ","MMT_USMC","Old_bike_TK_INS_EP1"]; _isATV = _type in ["ATV_US_EP1","ATV_CZ_EP1","BAF_ATV_D","BAF_ATV_W"]; _is6WheelType = false; _is8WheelType = false; {if (_type isKindOf _x) exitWith {_is6WheelType = true;};} count ["Kamaz_Base","MTVR","Ural_Base","Ural_Base_withTurret","V3S_Base"]; {if (_type isKindOf _x) exitWith {_is8WheelType = true;};} count ["BTR90_Base","LAV25_Base"]; _HasNoGlassKind = (_vehicle isKindOf "Motorcycle"); _6WheelTypeArray = ["HitLMWheel","HitRMWheel"]; _8WheelTypeArray = ["HitLf2Wheel","HitRf2Wheel","HitLMWheel","HitRMWheel"]; _NoGlassArray = ["HitGlass1","HitGlass2","HitGlass3","HitGlass4","HitGlass5","HitGlass6","HitLGlass","HitRGlass"]; _TooMuchGlassArray = ["HitGlass9","HitGlass10","HitGlass11","HitGlass12","HitGlass13","HitGlass14","HitGlass15","HitGlass16","HitGlass17","HitGlass18","HitGlass19","HitGlass20"]; _NoExtraWheelsArray = ["wheel_1_4_steering","wheel_2_4_steering","wheel_1_3_steering","wheel_2_3_steering"]; _nullPartsArray = ["HitVRotor","HitMissiles","HitHull","HitBody"]; _hitpoints = _hitpoints - [_NoExtraWheelsArray,_TooMuchGlassArray]; _toSpawnArray = ["PartGeneric"]; if !(isNil "_hitpoints") then { //verifies we have initialized a vehicle, then removes some of the excess crap diag_log "[SCRAPPER][Init] Object get parts array!"; if !(_is6WheelType || _is8WheelType) then { _RemovedPartsArray = ["HitLF2Wheel","HitRF2Wheel","HitLMWheel","HitRMWheel"]; } else { _RemovedPartsArray = []; }; if (_isATV || _HasNoGlassKind) then { _hitpoints = _hitpoints - _NoGlassArray; }; if (_isBicycle) then { _hitpoints = []; //need to empty the list on a bicycle, currently would contain motor, tires, fuelparts etc. itll get a custom array once in the spawn script }; if (_is6WheelType) then { //array stops mtvr's etc from chancing 8 wheels to spawn _RemovedPartsArray = _RemovedPartsArray + ["HitLF2Wheel","HitRF2Wheel"]; }; }; { _hitpoint = _x; _damage = [_vehicle,_x] call object_getHit; _damVar = round(ceil(_damage *100)); //converts damage into a whole integer since damage works 0 = destroyed, 1 = perfect, damage is handled as subnumber 0.123 will now be 12% damage _chance = round(100 - (_damVar / 2)); //chance to spawn part with damage reflected as a negative factor _against = (round((random 25) + _damVar)); //the roll against the part for it to not spawn. chance has to be greater than this to spawn. if part has suffered 75% damage IT WILL NOT have a chance and will instead turn into scrap if !(_x in _RemovedPartsArray) then { _configVeh = configFile >> "cfgVehicles" >> "RepairParts" >> _x; _part = getText(_configVeh >> "part"); if (_x in _nullPartsArray) then { //some parts in the config file dont match up to a part, here we are overriding what they return as _amount = round((100 - _damVar) / 20); //this is for converting HitHull/HitBody into scrap metal based on damage. will return 0 - 5 based on damage. every 20% reduces it by 1 _rand = round(random _amount); //after getting possible amount to turn hull into scrap, a random number from that amount is selected and added switch (_x) do { case "HitVRotor" : {_part = "PartVRotor"}; //HitHRotor is what actually turns into a rotor part even tho its called a PartVRotor which doesnt come from HitVRotor???? the hell? FIX case "HitMissiles" : {_part = "equip_scrapelectronics"}; //original experiment for turning HitMissiles into something usable since it seems this component is on all helis case "HitHull" : {for "_i" from 0 to _rand do {_toSpawnArray = _toSpawnArray + ["PartGeneric"]; };}; case "HitBody" : {for "_i" from 0 to _rand do {_toSpawnArray = _toSpawnArray + ["PartGeneric"]; };}; }; }; if (_chance > _against) then { // this is where the chance rolls come into play. if part is successfully rolled, it gets added to the array that we will execute the spawn script from _toSpawnArray = _toSpawnArray + [_part]; //success adds part. } else { _toSpawnArray = _toSpawnArray + ["PartGeneric"]; //failure adds scrap. }; }; } forEach _hitpoints; diag_log format["[SCRAPPER][PARTS] New container to pass to spawn script!!! ToSpawnArray = [%1]",_toSpawnArray]; _toSpawnArray execVM "\scripts\scrapper\spawnParts.sqf"; //executing spawn script with parts array for dynamic part spawning! that script is where we will add some special edits and spawns accepting all input! EDIT: If someone would like to assist me to help me understand dayz_actionInProgress and how to implement that... that would be much appreciated. Im trying to wrap my head around this code and while everything looks like its right.... it spams this error to the rpt Error Undefined variable in expression: fn_loopAction which shouldnt be the case when that is a server defined function specifically for calling the medic action..... idk what im doing wrong here but looking for help! UPDATE: Still working on setting up uninterruptable/dupable player dissassemble action, will do more on that tomorrow. SUCCESSFULLY complete dynamic spawning of crate cargo! Now for animations and then I can start adding the finishing touches. It is now 3 files Link to comment Share on other sites More sharing options...
ViktorReznov Posted September 27, 2017 Author Report Share Posted September 27, 2017 UPDATE: Animations complete, will do more with them intime but now my biggest headache so far. I have dynamic crates spawning, animations working, remap of null parts (parts without an actual part to return so it gets scrap metal), damage to vehicles, proper self action execution and clearing of action handles. I cannot get the _cursorTarget variable to carry over for more than one script from fn_selfActions. I need to maintain the object variable (Vehicle = 44c48100# 1065799: suv.p3d) acrossed more than just the initial script that gets executed from fn_selfActions but its refusing to do so, i have not figured out why. Also, I have not been able to find any clear information on how to retrieve those three variables (44c48100# 1065799: suv.p3d) seperate from a cursorTarget. I am trying to think of a work around but im still baffled as to why my vehicle = _this select 3; from fn_selfActions to my script will not then maintain the object of cursorTarget when it is then executed as [_vehicle] execVM "script"; and called as _object = _this select 0; wont maintain the data (Vehicle = 44c48100# 1065799: suv.p3d) i need to furnther my script. 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