[Support] Animated Vehicles

Discussion in 'Script/Addon help' started by ebay, Jun 14, 2014.

  1. ebay

    ebay OpenDayZ Guru!

    Joined:
    Jan 9, 2013
    Messages:
    828
    Likes Received:
    296
    Yes, it is in:
    \Arma 2\AddOns\air2.pbo\MV22\scripts\pack.sqf

    It shouldn't be necessary to include it in your mission file. It compiles fine for me the way I have it from "\ca\air2\mv22\scripts\pack.sqf". All clients already have it in their Arma 2 folder, since they need to have Combined OPs to play dayz mods.
     
    Last edited: Aug 23, 2014
  2. mdswish

    mdswish Member

    Joined:
    Apr 8, 2013
    Messages:
    30
    Likes Received:
    1
    What's the correct syntax for including the other Armored SUV class? In fn_selfactions it defines the vehicle class as "ArmoredSUV_Base_PMC", but for my server it should be "ArmoredSUV_PMC_DZ" and "ArmoredSUV_PMC" How do I include both so that they both work? Server is Overpoch.
     
  3. ebay

    ebay OpenDayZ Guru!

    Joined:
    Jan 9, 2013
    Messages:
    828
    Likes Received:
    296
    Look in @DayZ_Epoch\addons\dayz_code\config.cpp

    Both ArmoredSUV_PMC_DZ and ArmoredSUV_PMC_DZE are child classes of ArmoredSUV_Base_PMC. Since ArmoredSUV_PMC is not in the Epoch or Overwatch configs I suggest using either ArmoredSUV_PMC_DZ (spawns with ammo) or ArmoredSUV_PMC_DZE (spawns with no ammo) instead.

    isKindOf command works on the whole class hierachy (parent and all child classes):
    https://community.bistudio.com/wiki/isKindOf
     
    Last edited: Sep 13, 2014
  4. mdswish

    mdswish Member

    Joined:
    Apr 8, 2013
    Messages:
    30
    Likes Received:
    1
    Ok I changed all Armored SUV classes to ArmoredSUV_PMC_DZ in the dynamic vehicle spawn, Object_DATA table and Traders_DATA tables, as well as the animation script. Will see how that goes.
     
  5. BetterDeadThanZed

    BetterDeadThanZed Well-Known Member

    Joined:
    Mar 1, 2013
    Messages:
    537
    Likes Received:
    22
    *edit* Nevermind. I was copying the wrong files over. I was copying from from an old version of the server files :)
     
    Last edited: Oct 8, 2014
  6. DJShocker

    DJShocker New Member

    Joined:
    May 13, 2014
    Messages:
    5
    Likes Received:
    0
    Animations for the Armored SUV and the ramp for the MV22 is working, but it will not unfold/fold.
    No errors in RPT.
    Ideas?
     
  7. ElDubya

    ElDubya Well-Known Member

    Joined:
    Nov 1, 2014
    Messages:
    125
    Likes Received:
    6
    All working fantastically, thanks heaps eBay. I was wondering if you could script the animations for the UH1Y and the AH1Z if possible?

    [EDIT : Also, is it possible to make this persist through server restart?]
     
    Last edited: Feb 10, 2015
  8. chanceownz

    chanceownz New Member

    Joined:
    Oct 18, 2014
    Messages:
    6
    Likes Received:
    0

    Same here man i see the action's but it's not doing anything ill look into it
     
  9. chanceownz

    chanceownz New Member

    Joined:
    Oct 18, 2014
    Messages:
    6
    Likes Received:
    0
    Im think that would be easy ill look into as well
     
  10. SchwEde

    SchwEde OpenDayZ Rockstar!

    Joined:
    Jul 11, 2013
    Messages:
    989
    Likes Received:
    177
    Post your Client RPT.
    Go through every step and double check everything.
     
  11. ALKINDA

    ALKINDA Valued Member!

    Joined:
    Mar 24, 2013
    Messages:
    269
    Likes Received:
    29

    I tried doing it this way

    Code:
      mv22_pack = compile preprocessFileLineNumbers "\z\addons\air2\mv22\scripts\pack.sqf"; 
    This isnt giving me the missing file in client rpt. BUT it still doesnt make them fold!

    but i guess ca is client side, and z is server :/ what if i put the air2.pbo into my server addons?

    guess i will have to include it into the animate folder on mission pbo for now :p

    :(
     
    Last edited: Feb 20, 2015
  12. ebay

    ebay OpenDayZ Guru!

    Joined:
    Jan 9, 2013
    Messages:
    828
    Likes Received:
    296
    I added AH1Z and UH1Y just now. It is possible to edit the vehicle spawn in code on the server so these classes always spawn in packed. However, it would only be good for aesthetics because when createVehicle runs on the server the vehicle will be spawned unpacked momentarily. createVehicle command doesn't have a way to specify vehicle animation state AFAIK. That means if you packed it and then parked something else right next to it you could end up blowing up or damaging the nearby vehicles after server restart when it spawns back in.

    If the pack is not working you most likely forgot to add this to your compiles.sqf:
    Code:
    mv22_pack = compile preprocessFileLineNumbers "\ca\air2\MV22\scripts\pack.sqf";
    Or you do not have scripts\animate\mv22_fold.sqf in your mission

    @ALKINDA - You are confusing pbo prefixes.

    \z\addons\dayz_code\ = inside client files @DayZ_Epoch\addons\dayz_code.pbo
    \z\addons\dayz_server\ = inside server pbo @DayZ_Epoch_Server\addons\dayz_server.pbo
    \ca\air2\ = inside client files Common\air2.pbo
    path\script.sqf = inside mission file

    If you don't know what the prefix is just extract the pbo and look at the $PBOPREFIX$ file in your text editor. That shows you the path to use when you need to load files from that addon. All of the addons inside the \Common\ folder are loaded automatically when Arma 2 OA starts. Arma 2 OA is like an expansion to Arma 2 which is why it loads all the addons in the Arma 2\Common\ folder and Arma 2 OA\Common\ folder when the game starts. You can reference any files in those addons in your mission scripts using the appropriate prefixes. That includes images, sounds, scripts, etc. You do not need to copy them to your mission first, doing so is just a waste of mission file size.
     
    Last edited: Feb 20, 2015
    ALKINDA likes this.
  13. ALKINDA

    ALKINDA Valued Member!

    Joined:
    Mar 24, 2013
    Messages:
    269
    Likes Received:
    29
    I understood after I wrote this lol playing with the files, thank you for your time in clarification.

    I too added the uh1y but I cannot add them thru the air pbo. I just added the file to my mission and it worked.

    Here is my uh1y and your mv22 and suv put together.

    FN_SELFACTIONS SNIPPET

    Code:
    if (_inVehicle && {_vehicle isKindOf "MV22"}) then {
       if (isEngineOn _vehicle) then {[_vehicle,0] call mv22_pack;};
       if (mv22_fold < 0) then {
         themv22 = _vehicle;
         if !(isEngineOn themv22) then {
           mv22_fold = themv22 addAction ["Fold","custom\animate\mv22_fold.sqf","",5,false,true];
           mv22_unfold = themv22 addAction ["UnFold","custom\animate\mv22_unfold.sqf","",5,false,true];
           mv22_open = themv22 addAction ["Open Ramp","custom\animate\mv22_open.sqf","",5,false,true];
           mv22_close = themv22 addAction ["Close Ramp","custom\animate\mv22_close.sqf","",5,false,true];
         };
       };
       if (isEngineOn themv22) then {
         themv22 removeAction mv22_fold;
         mv22_fold = -1;
         themv22 removeAction mv22_unfold;
         mv22_unfold = -1;
         themv22 removeAction mv22_open;
         mv22_open = -1;
         themv22 removeAction mv22_close;
         mv22_close = -1;
       };
    } else {
        if (!isNil "themv22") then {
           themv22 removeAction mv22_fold;
           mv22_fold = -1;
           themv22 removeAction mv22_unfold;
           mv22_unfold = -1;
           themv22 removeAction mv22_open;
           mv22_open = -1;
           themv22 removeAction mv22_close;
           mv22_close = -1;
       };
    };
    
    if (_inVehicle && {_vehicle isKindOf "ArmoredSUV_Base_PMC"}) then {
       if ((_vehicle animationPhase "HideGun_01") == 1) then {
         _unit = _vehicle turretUnit [0];
         if (!(isNull _unit)) then {
           _unit action ["moveToCargo",_vehicle,2];
           titleText ["\n\nYou must open the hatch first.","PLAIN DOWN"];titleFadeOut 4;
         };
       };
       if (suv_close < 0) then {
         thesuv = _vehicle;
         suv_close = thesuv addAction ["Close Hatch","custom\animate\suv_close.sqf","",5,false,true];
         suv_open = thesuv addAction ["Open Hatch","custom\animate\suv_open.sqf","",5,false,true];
       };
    } else {
        if (!isNil "thesuv") then {
            thesuv removeAction suv_close;
            suv_close = -1;
            thesuv removeAction suv_open;
            suv_open = -1;
        };
    };
    
    //
    if (_inVehicle && {(typeOf_vehicle) in ["UH1Y","UH1Y_DZ","UH1Y_DZE"]}) then {
       if (isEngineOn _vehicle) then {[_vehicle,0] call uh1y_pack;};
       if (uh1y_fold < 0) then {
         theuh1y = _vehicle;
         if !(isEngineOn theuh1y) then {
           uh1y_fold = theuh1y addAction ["Fold","custom\animate\uh1y_fold.sqf","",5,false,true];
           uh1y_unfold = theuh1y addAction ["UnFold","custom\animate\uh1y_unfold.sqf","",5,false,true];
    
         };
       };
       if (isEngineOn theuh1y) then {
         theuh1y removeAction uh1y_fold;
         uh1y_fold = -1;
         theuh1y removeAction uh1y_unfold;
         uh1y_unfold = -1;
    
       };
    } else {
        if (!isNil "theuh1y") then {
           theuh1y removeAction uh1y_fold;
           uh1y_fold = -1;
           theuh1y removeAction uh1y_unfold;
           uh1y_unfold = -1;
    
       };
    };
    
    In compiles find
    Code:
    mv22_pack = compile preprocessFileLineNumbers
    
    place this code above the found line
    Code:
    uh1y_pack = compile preprocessFileLineNumbers "custom\animate\uh1y_pack.sqf";
    
    VARIABLES.SQF inside dayz_resetSelfActions = {
    Code:
        mv22_fold = -1;
        mv22_unfold = -1;
        mv22_open = -1;
        mv22_close = -1;
        suv_close = -1;
        suv_open = -1;
        uh1y_fold = -1;
        uh1y_unfold = -1;
    
    AHCONFIG inside _dayzActions =[
    Code:
    "mv22_fold","mv22_unfold","mv22_open","mv22_close","suv_close","suv_open","mv22_fold","mv22_unfold","uh1y_fold","uh1y_unfold"
    
    Here is the animate folder

    http://www.filedropper.com/animate

    *note*
    make sure your fn_selfactions and compiles link to your animate folder. my structure is custom\animate. the default was different.

    Thanks to ebay for showing me how to do this :p
     
    Last edited: Feb 26, 2015
  14. scarylarry

    scarylarry New Member

    Joined:
    Apr 2, 2015
    Messages:
    9
    Likes Received:
    0
    Love the script, works great. Very nice setup instructions. I'm wondering if anyone has figured out how to save an object that has been folded? I've seen it on a server before, but didn't have away to find out how they made it persist thru a restart.
     
  15. ebay

    ebay OpenDayZ Guru!

    Joined:
    Jan 9, 2013
    Messages:
    828
    Likes Received:
    296
    It would need to be stored somewhere in the database, similar to the way the vehicle lock state is saved on epoch. I have not looked into it yet, but if someone wants to submit a pull request for it I will happily merge it in.
     
    Last edited: Apr 2, 2015
  16. scarylarry

    scarylarry New Member

    Joined:
    Apr 2, 2015
    Messages:
    9
    Likes Received:
    0
    I've seen it be able to save in the fold state after a restart, so I know its possible. I just don't know to much about coding for to recreate it. Thanks for the great work!
     
  17. Saltzman

    Saltzman New Member

    Joined:
    Jan 1, 2015
    Messages:
    12
    Likes Received:
    0
    Ebay anyway you can do an updated to include the Chinook back ramp?
     
  18. ebay

    ebay OpenDayZ Guru!

    Joined:
    Jan 9, 2013
    Messages:
    828
    Likes Received:
    296
    @Saltzman - Looking through the air and BAF addon configs the chinook does not appear to have any animation for its ramp. Same with the Vodnik gun. If anyone knows the path to the scripts or animation names let me know, but it doesn't look like there are any for those built in to the game. Using an external addon is different.
     

Share This Page