Jump to content

ViktorReznov

Member
  • Posts

    192
  • Joined

  • Last visited

  • Days Won

    5

Posts posted by ViktorReznov

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

  2. So to clarify accurately, for all vehicles I tested except for planes, Vehicle will recieve damage and damage will persist through restart on all possible parts, however, the damage to the hull is not reflected on the model state. Body will look pristine even though hull damage is approaching 100%.

    On planes, that above code does nothing to it. No damage reflected on the hull indicator, no damage reflected on the texture and that code will blow up a vehicle GUARANTEED after 5 executions(this is a brand new no damage vehicle), not on airplane. It literally does nothing to it.

    The only code I can get to do damage to an airplane is the:

    Spoiler

    _damage = getDammage _vehicle;
        _damaged = (_damage + 0.2);
        vehicle _vehicle setDamage _damaged;
        _damage2 = getDammage _vehicle;

    which will not persist after a restart but will blow it up GUARANTEED after 5 executions(this is a brand new no damage vehicle). It matters not on persisting after restart if I add these lines at after

    PVDZ_veh_Save = [_vehicle,"damage"];
      publicVariableServer "PVDZ_veh_Save";

    damage will not persist. Now I believe it has to do with damage to part vs damage to object and im working on figuring that out but any input from the community would be greatly appreciated!

  3. _fn_dmg_veh = {
      _hitpoints = _vehicle call vehicle_getHitpoints;
      {
        _damage = [_vehicle,_x] call object_getHit;
        _selection = getText(configFile >> "cfgVehicles" >> _vehClass >> "HitPoints" >> _x >> "name");
        [_vehicle,_selection,(_damage +0.2)] call fnc_veh_handleDam;
      } forEach _hitpoints;
      PVDZ_veh_Save = [_vehicle,"damage"];
      publicVariableServer "PVDZ_veh_Save";
    };

     

    that does it nicely except for planes, so far in my testing they resist damage... actually all hull damage seems to resist this function. Planes dont get hull damage at all and on everything else the hull will indicate damage but not show....

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

     

     

  5. 3 hours ago, juandayz said:

    Seems Like youre missing a public var. Pvdz_veh_save maybe? Chech the update of vehicle service point by salival to get a reference of what i talking about.

    yea ive been really digging into that code and even with adding something like

    PVDZ_veh_Save = [_vehicle,"damage"];
    publicVariableServer "PVDZ_veh_Save";

    im not getting it to function. infact, adding those extra code bits stops any damage from even occuring. I can make it happen and be visible and last for a minute, but then its reset. It fully restores it even after server restart.

     

  6. 2 hours ago, JasonTM said:
    
    _object = cursorTarget;
    
    if(isNull _object) exitWith {};
    
    if(_object in array1) then {
    
    your code here
    
    );
    
    if(_object in array2) then {
    
    your code here
    
    );
    
    if(_object in array1 && _object in array2) then {
    
    your code here
    
    );

     

    Thanks for the response mate! Its basically what i ended up doing. I believe I was overcomplicating it in my thought process

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

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

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

  10. _damage = getDammage _vehClass;
        _damaged = (_damage + 0.2);
        vehicle _vehClass setDamage _damaged;
        _damage2 = getDammage _vehClass;

    that bit of code will indeed damage a vehicle but seems it is more intended for blowing it up rather than causing permanent damage. As soon as you enter vehicle after damaging it with that code it automagically repairs itself. How can I get persistent code? Is it with that get/setHit code? That seems terribly inefficient having to loop it to damage all parts concurrently.

  11. array1 = [some stuff in here]

    array2 = [some other stuff]

    array3 = [array1 + array2]

    cursortarget returns true that class is indeed in array3

    now I want to extract which array it really came from and use that array name as a variable to determine other code

    it was an original overdrawn thought to getting a vehicles class name from an all encompassing target array solely for cursorTarget purposes and then wanted to use subclass arrays to have different addAction effects using the name of the subclass array as a variable. (it honestly made more sense in my head at the time but that was some powerful lack of sleep)

    I have since figured out another way to achieve what I wanted but I am curious as to if it is possible to do?

    Thanks for your time m8

  12. Just now, DAmNRelentless said:

    Guess the sense of it is because you normally need a shovel or a spade to bury a body so he wants to keep it more realistic.

    Oh I have used eTools to bury bodies. Dig a foxhole with one of those. FML

    Hopefully he comes back with answers, its become more of a personal msg between you and me m8! lol

  13. 1 hour ago, DAmNRelentless said:

    You could do that anyways, even if it's done with a cursor target. You could bind the function to the etool and then use the nearest body as the body you want to bury.

    which wouldnt be hard to code just trying to understand the reasoning (makes someone reading more likely to help is all). And quite possibly he may not even want it for a body. 

  14. Out of curiousity, why would you like to do this? The point of that script is to bury the body you are looking at. Having it as a right-click option would null that script of its primary point of bury THAT body you are looking at. Not trying to knock your question, just trying to understand the basis for the question. If you wouldnt mind elaborating you may find more help.

  15. Hard to explain what im looking for in topic. Im trying to reference an object with cursor target, verify it is in an array, return name of array to use as a variable for further code. Ive done some reading on the a2 scripting forums but didnt find what I was looking for. please assist if possible. Thanks very much

  16. 2 minutes ago, salival said:

    It wont work on zombies since the line in fn_selfActions disables this.

    If you're not seeing the option for burying or butchering you need an Etool for burying or a knife for butchering.

    indeed had both tools on me, and noticed this is directly flagged to not show up on zeds.

    With all required tools on my person, only bury shows up. No option to butcher but bury works appropriately. Spawns grave, cross, box and removes flies.

  17. 21 hours ago, salival said:

    That is unfortunately going to be a side effect of master key. I tried thinking of a way to do this when I wrote this.

    The only way I could have seen to do it was to pop up a menu asking which vehicle you wanted to access, but that was a lot more work than I intended

    Would so be worth it tho... Maybe hook it into your vehicle key changer dialog anyways? Can't wait to have my comp back, month and a half later....

  18. So, looking through code and trying to learn what things are and in spawning them, ive come acrossed a variable I cannot figure out what it is

    For example

    ["hiluxWreck",[11689.701,3422.4888,1.001358e-005],-99.812798],

    class, posX, posY, posZ and ?????

    What is that fourth var?

×
×
  • Create New...