addAction on transport helicopters

  1. 8 years ago

    Hey guys I need some help with getting a script to work on the combat support transport helicopters.
    I want to run a script to addAction open/close doors, this works in the init or code box for local hosted but I want to run this on a dedicated server, any input on how I can do that would be appreciated.

    nul = [this] execVM "scripts\DoorsReset.sqf";

    Thanks.

  2. I now have working door animations on my transport helicopter.
    Sharing for anyone interested in his feature, here is what I have done, may not be the best way but I'm no scripter just a copy and paster.

    description.ext

    //Alive spawned heli door animations
    class Extended_Init_EventHandlers {
     class NZF_Merlin {
      init = "_this call (compile preprocessFileLineNumbers 'scripts\DoorsReset.sqf')";
     };
    };

    DoorsReset.sqf

    _heli = _this select 0;
    
    _heli addAction ["<t color='#FE2E2E'>Open Doors</t>", "scripts\Doors.sqf",1,1,false,true,"","(_target 
    
    animationPhase 'door_back_R' == 0) && (_target animationPhase 'door_back_L' == 0)"]; 
    
    _heli addAction ["<t color='#40FF00'>Close Doors</t>", "scripts\Doors.sqf",0,1,false,true,"","(_target 
    
    animationPhase 'door_back_R' == 1) && (_target animationPhase 'door_back_L' == 1)"];
    
    sleep 1;

    Doors.sqf

    hintSilent "Doors Cycling";
    _ghost = _this select 0;
    _state = _this select 3;
    _ghost animateDoor ['door_back_R', _state];
    _ghost animateDoor ['door_back_L', _state];
    sleep 1.75;
    hintSilent "Cycle Complete";
    sleep 3;
    hintSilent "";
  3. Thanks for sharing.

  4. Thanks, RitterNZ - this was exactly what I needed to solve my similar problem and it worked great putting the section in the description.ext. :)

    My addAction was to run a script that will fire off a complete ACE Medical heal... I attached it to the RHS medevac chopper, set up as a transport combat support object.

  5. Could you possibly share that script, @hmarcbower ? I've been searching for that exact script for my MedEVAC chopper.

  6. Surely. :) Thanks to RitterNZ I was able to piece it together. The code block to do all the ACE Healing I found on Armaholic in a post by Foffy.

    description.ext:

    //ALiVE spawned medevac ACE Heal addaction
    class Extended_Init_EventHandlers
    {
    	class RHS_UH60M_MEV
    	{
    		init = "_this call (compile preprocessFileLineNumbers 'scripts\medevac_addAction_ACEHeal.sqf')";
    	};
    	class RHS_UH60M_MEV2
    	{
    		init = "_this call (compile preprocessFileLineNumbers 'scripts\medevac_addAction_ACEHeal.sqf')";
    	};
    };

    scripts\medevac_addAction_ACEHeal.sqf:

    _medevac = _this select 0;
    _medevac addAction ["<t color=""#FF0000"">ACE Heal</t>","scripts\bb_mb_ACEHeal.sqf"];
    sleep 1;

    bb_mb_ACEHeal.sqf:

    #include "\z\ace\addons\medical\script_component.hpp"
    _injured = _this select 1; 
    // if calling from a trigger, onAct is  {[_x,_x] spawn bb_mb_healunit_fnc} forEach thisList;
    // because calling from an addAction has the "caller" as the second array element
    if (alive _injured) then
    {
    		_injured setVariable [QGVAR(pain), 0, true];
    		_injured setVariable [QGVAR(morphine), 0, true];
    		_injured setVariable [QGVAR(bloodVolume), 100, true];
    		_injured setVariable ["ACE_isUnconscious", false, true];
    		_injured setvariable [QGVAR(tourniquets), [0,0,0,0,0,0], true];
    		_injured setvariable [QGVAR(openWounds), [], true];
    		_injured setvariable [QGVAR(bandagedWounds), [], true];
    		_injured setVariable [QGVAR(internalWounds), [], true];
    		_injured setvariable [QGVAR(lastUniqueWoundID), 1, true];
    		_injured setVariable [QGVAR(heartRate), 80];
    		_injured setvariable [QGVAR(heartRateAdjustments), []];
    		_injured setvariable [QGVAR(bloodPressure), [80, 120]];
    		_injured setVariable [QGVAR(peripheralResistance), 100];
    		_injured setVariable [QGVAR(fractures), [], true];
    		_injured setvariable [QGVAR(triageLevel), 0, true];
    		_injured setvariable [QGVAR(triageCard), [], true];
    		_injured setVariable [QGVAR(salineIVVolume), 0, true];
    		_injured setVariable [QGVAR(plasmaIVVolume), 0, true];
    		_injured setVariable [QGVAR(bloodIVVolume), 0, true];
    		_injured setvariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0], true];
    		_injured setvariable [QGVAR(airwayStatus), 100];
    		_injured setVariable [QGVAR(airwayOccluded), false];
    		_injured setvariable [QGVAR(airwayCollapsed), false];
    		_injured setvariable [QGVAR(addedToUnitLoop), false, true];
    		_injured setvariable [QGVAR(inCardiacArrest), false, true];
    		_injured setvariable [QGVAR(hasLostBlood), 0, true];
    		_injured setvariable [QGVAR(isBleeding), false, true];
    		_injured setvariable [QGVAR(hasPain), false, true];
    		_injured setvariable [QGVAR(amountOfReviveLives), GVAR(amountOfReviveLives), true];
    		_injured setvariable [QGVAR(painSuppress), 0, true];
    		_injured setDamage 0;
    };

    I also had this set up when I had a medical facility that auto-healed units who entered so I could call the function from a trigger. It's not needed if you're just going to use the addAction as I did above. I just set up a trigger that fit inside the area of the medical facility so that as soon as someone walked into the trigger area, they were fully healed. YOu can see the On Activation command above if you want to set up one of those, too. This is what I started with, so it might be completely extraneous. :)

    init.sqf:

    // Functions
    bb_mb_healunit_fnc = compile preprocessFileLineNumbers "scripts\bb_mb_ACEHeal.sqf";

    If you wanted to do some more fancy things around the healing, you could add it into the code. Basically I just wanted the player to be able to walk up to the chopper (in my case I set up an ALiVE combat support transport and used one of the two classnames listed above in the description.ext; you should be able to use any object so long as you add its classname into the description.ext file, I would think) and use the wheel menu to be fully healed without any fanfare.

 

or Sign Up to reply!