Music from Evac JAEM chopper

carfy666

New Member
Hey peeps,
So we been messing around trying to get music to play from the evac chopper, So far we have managed to get it to play music from a scroll wheel action if we are sitting inside the chopper. However.
We wanted to go one step further and get it to play the music when we call it for evac. so while its flying to rescue you its blasting out some Rock music :)

Does anyone know how we can incorperate this into the JEAM script?
From say when it takes off till to just start playing the music, obviously we want the music to come from the chopper and not just to play from us. So if the chopper flys past you would hear it like a siren from a police car?

This is the script we have to get the music playing from a scroll wheel action and coming from the chopper:
Code:
//Heli Music
_vehicle = vehicle player;
_inVehicle = (_vehicle != player);

if (isnil ("sirensOn")) then {sirensOn = 0;};
if (!_inVehicle) then {sirensOn = 0;};
if (sirensOn == 0) then {sirensOn = 1; cutText ["Music ON!","PLAIN DOWN"];};

while {sirensOn == 1} do {
    if (_inVehicle and (driver _vehicle == player)) then {
    _nul = [objNull, _vehicle, rSAY, "helimusic", 120] call RE;
    [_vehicle, 200, true, (getPosATL _vehicle)] spawn player_alertZombies;
        for "_i" from 1 to 120 do {
        player action ["lightOn", _vehicle];
        sleep 0.2;
        player action ["lightOff", _vehicle];
        sleep 0.2;
        };
        sleep 0.2;
    } else {
        sirensOn = 0;
    };
};

This is the JEAM init:
Code:
/*------------------------------------*/
/* JAEM                               */
/* Just another Chopper-Evac Mod v1.3 */
/* OtterNas3                          */
/* 01/14/2014                         */
/* Last update: 02/20/2014            */
/*------------------------------------*/

/* Wait for the player got his login Data to make sure he has a valid PlayerUID */
waitUntil {count PVDZE_plr_Login2 > 0};

private ["_evacCallerID","_evacCallerUID","_evacFields","_evacFieldID","_ownerKeyId","_itemsPlayer","_temp_keys","_key_colors","_hasKey","_cTarget","_vehicleKey","_evacChopperConfigArray","_hasRadio"];

/////////////////////////////////////////////////
/////////////////////////////////////////////////
// Edit these settings to fit your needs/likes //
/////////////////////////////////////////////////
/////////////////////////////////////////////////
/// Amount of Briefcases a Evac-Chopper costs ///
/////////// Any amount between 1-12 /////////////
evac_chopperPrice = 1;
/////////////////////////////////////////////////
////// Need a Radio to call Evac-Chopper? ///////
////// 1 = Need Radio | 0 = No need Radio ///////
evac_needRadio = 0;
/////////////////////////////////////////////////
// Evac-Zone marker type Smoke or Landingpad? ///
////////// 0 = Landingpad | 1 = Smoke ///////////
evac_zoneMarker = 0;
/////////////////////////////////////////////////
/// Minimum Distance to call for Evac-Chopper ///
///////// Dont set this lower then 500! /////////
evac_minDistance = 500;
/////////////////////////////////////////////////
/////////////// DONT EDIT BELOW ! ///////////////
/////////////////////////////////////////////////


/* Checking if player has a Evac-Chopper to decide if we show the Call-Evac action menu */
_evacCallerID = (player getVariable ["CharacterID","0"]);
_evacCallerUID = (getPlayerUID player);
playerHasEvacField = false;
_evacFields = nearestObjects [player, ["HeliHRescue"], 40000];
if ((count _evacFields) > 0) then
{
    {
        _evacFieldID = _x getVariable ["CharacterID", "0"];
        if (_evacCallerID == _evacFieldID || _evacCallerUID == _evacFieldID) then {
            playerHasEvacField = true;
            playersEvacField = _x;
        };
    } forEach _evacFields;
};

/* Reset Action-Menu cvars */
s_player_evacCall = -1;
s_player_makeEvacChopper = -1;
s_player_clearEvacChopper = -1;

/* Wait for the player full ingame so we can add the action-menu entry */
waitUntil {!isNil "dayz_animalCheck"};

/* Starting the check loop */
while{true} do {
    sleep 3;
    if (isNull cursorTarget && speed player < 1 && vehicle player == player && playerHasEvacField && (player distance playersEvacField) >= evac_MinDistance) then {
        if (evac_needRadio == 1) then {
            _itemsPlayer = items player;
            _hasRadio = "ItemRadio" in _itemsPlayer;
            if (_hasRadio) then {
                if (s_player_evacCall < 0) then {
                    s_player_evacCall = player addAction [("<t color=""#0000FF"">" + ("Call Evac-Chopper") + "</t>"),"custom\JAEM\CallEvacChopper.sqf",[],-1,false,false,"",""];
                };
            } else {
                player removeAction s_player_evacCall;
                s_player_evacCall = -1;
            };
        } else {
            if (s_player_evacCall < 0) then {
                s_player_evacCall = player addAction [("<t color=""#0000FF"">" + ("Call Evac-Chopper") + "</t>"),"custom\JAEM\CallEvacChopper.sqf",[],-1,false,false,"",""];
            };
        };
    } else {
        player removeAction s_player_evacCall;
        s_player_evacCall = -1;
    };
    if (!isNull cursorTarget && vehicle player == player && cursorTarget isKindOf "Helicopter" && player distance cursorTarget <= 10 && !isEngineOn cursorTarget) then {
        _cTarget = cursorTarget;
        _vehicleKey = _cTarget getVariable ["CharacterID","0"];
        if (_vehicleKey != "0") then {
            _itemsPlayer = items player;
            _temp_keys = [];
            _key_colors = ["ItemKeyYellow","ItemKeyBlue","ItemKeyRed","ItemKeyGreen","ItemKeyBlack"];
            {
                if (configName(inheritsFrom(configFile >> "CfgWeapons" >> _x)) in _key_colors) then {
                    _ownerKeyId = getNumber(configFile >> "CfgWeapons" >> _x >> "keyid");
                    _keyName = getText(configFile >> "CfgWeapons" >> _x >> "displayName");
                    _temp_keys set [count _temp_keys,str(_ownerKeyId)];
                };
            } forEach _itemsPlayer;
            _hasKey = _vehicleKey in _temp_keys;
            if (_hasKey) then {
                if (s_player_makeEvacChopper < 0) then {
                    s_player_makeEvacChopper = player addAction [("<t color=""#0000FF"">" + ("Set Evac-Chopper") + "</t>"),"custom\JAEM\SetEvacChopper.sqf",_cTarget,-1,false,false,"",""];
                };
                if (playerHasEvacField && (_cTarget distance playersEvacField) <= 10) then {
                    if (s_player_clearEvacChopper < 0) then {
                        s_player_clearEvacChopper = player addAction [("<t color=""#0000FF"">" + ("Clear Evac-Chopper") + "</t>"),"custom\JAEM\ClearEvacChopper.sqf",_cTarget,-1,false,false,"",""];
                    };
                } else {
                    player removeAction s_player_clearEvacChopper;
                    s_player_clearEvacChopper = -1;
                };
            } else {
                player removeAction s_player_makeEvacChopper;
                s_player_makeEvacChopper = -1;
                player removeAction s_player_clearEvacChopper;
                s_player_clearEvacChopper = -1;
            };
        } else {
            player removeAction s_player_makeEvacChopper;
            s_player_makeEvacChopper = -1;
            player removeAction s_player_clearEvacChopper;
            s_player_clearEvacChopper = -1;
        };
    } else {
        player removeAction s_player_makeEvacChopper;
        s_player_makeEvacChopper = -1;
        player removeAction s_player_clearEvacChopper;
        s_player_clearEvacChopper = -1;
    };
 
I think ive come up with a script and saved it as evacmusic.sqf:
Code:
private ["_sounddist","_vehicle"];
_sounddist = 20;
_nul = [objNull, _vehicle, rSAY, "helimusic", _sounddist] call RE;
However not sure how or where id place it within the above JEAM init file to call it?
any ideas?
 
hmm, still not working, I think its suppose to go inside the call evacchopper script somewhere instead of the init:
Code:
*------------------------------------*/
/* JAEM                               */
/* Just another Chopper-Evac Mod v1.3 */
/* OtterNas3                          */
/* 01/14/2014                         */
/* Last update: 02/20/2014            */
/*------------------------------------*/


private ["_cnt","_locationPlayer","_evacFieldID","_checkForChopper","_validPlayerEvacField","_evacCallerID","_evacCallerUID","_evacFields","_playerEvacField","_heliHRescue","_routeFinished","_evacZone","_chopperStartPos","_getChopperStartPos","_evacZoneDistance","_startZoneWaypoint","_evacZoneWaypoint","_part","_damage","_hitpoints","_evacChopperFuel","_finishMarker"];
player removeAction s_player_evacCall;
s_player_evacCall = 1;

/* 5 seconds timeout to cancel a call on accident */
_cnt = 5;
_locationPlayer = (getPosATL player);
for "_p" from 1 to 5 do
{
    systemChat(format ["Evac-Chopper gets called in %1s - Move to cancel!",_cnt]);
    if (player distance _locationPlayer > 0.2) then {
        systemChat("Evac-Chopper call cancelled!");
        s_player_evacCall = -1;
        breakOut "exit";
    };
    sleep 1;
    _cnt = _cnt - 1;
};

systemChat ("Searching for your Evac-Chopper - Please wait...");
sleep 5;

//Setting needed variables to check which Evac-Field the player owns
_evacCallerID = (player getVariable ["CharacterID","0"]);
_evacCallerUID = (getPlayerUID player);
_playerEvacField = [];

//If Player seems not to have a Evac-Chopper
//we getting all HeliHRescue signs on Server and check if Player is owner
//This is just for the case the check on playerlogin failed
if (!playerHasEvacField) then {
    _evacFields = nearestObjects [player, ["HeliHRescue"], 40000];
    if ((count _evacFields) > 0) then {
        {
            _evacFieldID = _x getVariable ["CharacterID", "0"];
            if (_evacCallerID == _evacFieldID || _evacCallerUID == _evacFieldID) then {
                _playerEvacField set [(count _playerEvacField), _x];
                playerHasEvacField = true;
                playersEvacField = _x;
            };
        } forEach _evacFields;
    };
};

//Player has no evac field, exit
if (!playerHasEvacField) then {
    systemChat ("Sorry but you don't have an Evac-Chopper");
    s_player_evacCall = -1;
    breakOut "exit";
};

//Player has a evac field now check if a Chopper is on it
_checkForChopper = nearestObjects [playersEvacField, ["Helicopter"], 10];
if ((count _checkForChopper) > 0) then {
    evacChopper = _checkForChopper select 0;
} else {
    systemChat ("Sorry but there is no Chopper on your Evac-Field");
    s_player_evacCall = -1;
    breakOut "exit";
};

//We found a Chopper
systemChat("Player Evac-Chopper found - Checking Fuel and Damage...");
sleep 3;

//Let's get the Damage of the Chopper and the fuel
//Fuel check
_evacChopperFuel = fuel evacChopper;
if (_evacChopperFuel < 0.2) then {
    systemChat("Sorry but the Fuel in your Evac-Chopper is too low to fly to you");
    systemChat("Keep your Evac-Chopper refuelled next time!");
    sleep 30;
    s_player_evacCall = -1;
    breakOut "exit";
};

//Damage check
_hitpoints = evacChopper call vehicle_getHitpoints;
{           
    _damage = [evacChopper,_x] call object_getHit;
    if(["Engine",_x,false] call fnc_inString) then {
        _part = "PartEngine";
    };
       
    if(["HRotor",_x,false] call fnc_inString) then {
        _part = "PartVRotor"; //yes you need PartVRotor to fix HRotor LOL
    };

    if (_damage >= 1 && (_part == "PartEngine" || _part == "PartVRotor")) then {
        if(_part == "PartEngine") then {
            systemChat("Sorry but the Engine of your Evac-Chopper is too damaged to fly");
            systemChat("Keep your Evac-Chopper repaired next time!");
        };
        if (_part == "PartVRotor") then {
            systemChat("Sorry but the Main-Rotor of your Evac-Chopper is too damaged to fly");
            systemChat("Keep your Evac-Chopper repaired next time!");
        };
        sleep 30;
        s_player_evacCall = -1;
        breakOut "exit";
    };
} forEach _hitpoints;
sleep 2;

//All is okay and we can start the creation of the Rescue sign
//create the AI Pilot and waypoints
//and get him on his way to the player
systemChat("Fuel and Damage check done - Your Evac-Chopper is starting!");
//Create the Evacuation Zone Marker
if (evac_zoneMarker == 1) then {
    _heliHRescue = "SmokeshellGreen" createVehicle getPosATL player;
    _heliHRescue setPosATL (getPosATL player);
} else {
    _heliHRescue = "HeliHRescue" createVehicle getPosATL player;
    _heliHRescue setDir (getDir player);
    _heliHRescue setPosATL (getPosATL player);
    };

//Reset of the checkpoint bool's
evacZoneReached = false;
_routeFinished = false;

//Get needed positions
_evacZonePos = getPosATL _heliHRescue;
_evacZone = _evacZonePos;
_getChopperStartPos = getPosATL evacChopper;
_chopperStartPos = _getChopperStartPos;

//Unlocking the Chopper and create the AI Pilot
evacChopper setVehicleLock "UNLOCKED";
evacChopperGroup = createGroup WEST;
evacChopperPilot = evacChopperGroup createUnit ["USMC_Soldier_pilot", evacChopper, [], 0,"LIEUTENANT"];
{[evacChopperPilot, _x, 1] call BIS_fnc_invRemove;}forEach items evacChopperPilot;
{[evacChopperPilot, _x, 1] call BIS_fnc_invRemove;}forEach magazines evacChopperPilot;
{[evacChopperPilot, _x, 1] call BIS_fnc_invRemove;}forEach weapons evacChopperPilot;
evacChopperPilot removeAllEventHandlers "handleDamage";
evacChopperPilot addEventHandler ["handleDamage", {false}];
evacChopperPilot allowDamage false;
evacChopperPilot assignAsDriver evacChopper;
evacChopperPilot moveInDriver evacChopper;
evacChopperPilot setSkill 1;
evacChopperGroup setBehaviour "CARELESS";
sleep 1;

//Lock the Chopper again so noone can jump in
evacChopper setVehicleLock "LOCKED";
//Turn the Engine on and set fly height for the Pilot
evacChopper engineOn true;
evacChopper flyInHeight 200;

I just dont know what code or call I can put to make the vehicle play the music when it starts up?
The script says the driver locks the vehicle so no one can hop in it for take off, anyone know if I could make the sound "helimusic" from my description.ext file play when that happens?
 
Figured it out :)
Code:
//music test start
private ["_vehicle","_sounddist"];
_vehicle = evacChopper;
_sounddist = 25;
_nul = [objNull, _vehicle, rSay, "helimusic", _sounddist] call RE;
 
Back
Top