Jump to content

Boerstil

Member
  • Content Count

    25
  • Joined

  • Last visited

  • Medals

Community Reputation

8 Neutral

About Boerstil

  • Rank
    Private First Class

Recent Profile Visitors

1174 profile views
  1. array<IEntity> allChildren = new array<IEntity>(); IEntity specificChild; IEntity child = GetChildren(); while (child) { if (condition) { specificChild = child; } allChildren.Insert(child); child = child.GetSibling(); }; I think this should work, this will give you an Array of all children and a specific child. I can't test it Right Now
  2. Boerstil

    Load functionlibrary

    My bad. I put the files in the wrong sub-scene... 😕 Thanks for the fast reply.
  3. Hello! I'm really new to enforce scripting and need some help. I've started to build a functionslibrary for my mission. My question is how do I load the functions so i can use them in triggers and onGamestart etc. ? I've made a scriptfile called BOR_Tools.c with a class called BOR_Tools wich holds functions for spawning vehicles, groups and waypoints. How do i get my functions into the functionlibrary so i can use them? Thanks in advance
  4. Boerstil

    Run once simulation script

    if (!isServer) exitWith {}; blacklistArray = []; bor_actDist = 2000; [] spawn { private "_unit"; for "_i" from 0 to 1 step 0 do { { _unit = _x; if !(_unit in blacklistArray) then { if (({isPlayer _x AND (_x distance _unit) < bor_actDist} count playableUnits) != 0) then { _unit enableSimulationGlobal True; _unit enableAI "ALL"; _unit hideObjectGlobal False; } else { _unit enableSimulationGlobal false; _unit disableAI "ALL"; _unit hideObjectGlobal true; }; }; } forEach (AllUnits + Vehicles); sleep 5; }; };
  5. I'll share my ai taxi/takeoff script /* Author: Boerstil Description: - Function for aircraft to taxi to catapult then takeoff. Exucution: - Call the function via code/script [_plane,["Catapult1","Catapult2","Catapult3","Catapult4"],_carrier] call BIS_fnc_AircraftCatapultLaunch; Parameter(s): 0: plane/object 1: array of possible catapults 2: carrier/object 3: posWorld of plane (optional) Returns: nothing */ bor_fnc_CarrierTakeOff = { scopeName "takeOff"; _veh = param [0,objNull,[objNull]]; _catapults = param [1,["Catapult1","Catapult2"],[[]]]; _carrier = param [2,objNull,[objNull]]; _pos = param [3,(getPosWorld _veh),[[]]]; private _dir = getDir _veh; private _height = _pos select 2; private _catapult = selectRandom _catapults; private _partClass = ""; if ((_catapult == "Catapult1") || (_catapult == "Catapult2")) then { _partClass = "Land_Carrier_01_hull_04_F"; } else { _partClass = "Land_Carrier_01_hull_07_F"; }; private _carrierObjects = _carrier nearObjects [_partClass , 200]; private _part = _carrierObjects param [0, objNull]; private _configPath = configfile >> "CfgVehicles" >> _partClass >> "Catapults" >> _catapult; private _animations = getArray (_configPath >> "animations"); private _memPoint = getText (_configPath >> "memoryPoint"); private _dirOffset = getNumber (_configPath >> "dirOffset"); private _posCatapult = _part modelToWorld (_part selectionPosition _memPoint); _posCatapult set [2, _height]; private _dirCatapult = (getDir _part - _dirOffset - 180) % 360; private _configPlane = configFile >> "CfgVehicles" >> typeOf _veh; private _velocityLaunch = getNumber (_configPlane >> "CarrierOpsCompatability" >> "LaunchVelocity") max 210; private _velocityIncrease = getNumber (_configPlane >> "CarrierOpsCompatability" >> "LaunchVelocityIncrease") max 75; private _accelerationStep = getNumber (_configPlane >> "CarrierOpsCompatability" >> "LaunchAccelerationStep") max 0.025; private _launchBar = getText (_configPlane >> "CarrierOpsCompatability" >> "LaunchBarMemoryPoint"); if (true) then { waitUntil { if (!alive (driver _veh)) exitWith {breakto "takeOff";true}; !(_carrier getVariable ["landing",false]) && (_part animationPhase (_animations select 0) < 2) }; _veh setFuel 1; _veh engineOn True; _veh setPosWorld _pos; sleep 5; waitUntil { if (!alive (driver _veh)) exitWith {breakto "takeOff";true}; isEngineOn _veh }; while {(_veh distance _pos) < 15} do { _veh setAirplaneThrottle 0.3; _veh setDir _dir; _veh setVelocity [(sin _dir * (25 / 3.6)),(cos _dir * (25 / 3.6)),(velocity _veh select 2)]; if ((_veh distance _posCatapult) < 15) exitWith {_veh setVelocity [0,0,0];}; if (!alive (driver _veh)) exitWith {breakto "takeOff"}; sleep 0.02 }; while {!((getDir _veh) > ((_veh getDir _posCatapult) - 3) && (getDir _veh) < ((_veh getDir _posCatapult) + 3))} do { _veh setAirplaneThrottle 0.3; if (!alive (driver _veh)) exitWith {breakto "takeOff"}; if ((getDir _veh) < (_veh getDir _posCatapult)) then {_veh setDir ((getDir _veh) + 0.5);_veh setVelocityModelSpace [0, (25 / 3.6), 0];} else {_veh setDir ((getDir _veh) - 0.5);_veh setVelocityModelSpace [0, (25 / 3.6), 0];}; sleep 0.025 }; _veh setVelocity [0,0,0]; private _memoryPos = getPosWorld _veh; _veh setVariable ["memoryPos",_memoryPos]; _veh setVariable ["memoryDir",_dir]; _veh animate ["wing_fold_l", 0]; _veh animate ["wing_fold_r", 0]; _veh animate ["wing_fold_cover_l", 0]; _veh animate ["wing_fold_cover_r", 0]; while {(_veh distance _posCatapult) >= 1} do { waitUntil {(_part animationPhase (_animations select 0) < 1)}; _veh setAirplaneThrottle 0.3; _veh setDir (_veh getDir _posCatapult); _veh setVelocity [(sin (_veh getdir _posCatapult) * (25 / 3.6)),(cos (_veh getdir _posCatapult) * (25 / 3.6)),(velocity _veh select 2)]; if (!alive (driver _veh)) exitWith {breakto "takeOff"}; sleep 0.025 }; _veh setPosWorld _posCatapult; _veh setDir _dirCatapult; _veh setBehaviour "AWARE"; _jetPark = [ (str _veh) + "_parked", "onEachFrame", { (_this select 0) setAirplaneThrottle 0.3; (_this select 0) setVelocity [0, 0, 0]; (_this select 0) setPosWorld (_this select 1); (_this select 0) setDir (_this select 2); },[_veh,_posCatapult,_dirCatapult] ] call BIS_fnc_addStackedEventHandler; [_part, _animations, 10] spawn BIS_fnc_Carrier01AnimateDeflectors; sleep 10; [format ["%1",_jetPark], "onEachFrame"] call BIS_fnc_removeStackedEventHandler; _jetPark2 = [ (str _veh) + "_parked", "onEachFrame", { (_this select 0) setAirplaneThrottle 1; (_this select 0) setVelocity [0, 0, 0]; (_this select 0) setPosWorld (_this select 1); (_this select 0) setDir (_this select 2); },[_veh,_posCatapult,_dirCatapult] ] call BIS_fnc_addStackedEventHandler; sleep 5; [format ["%1",_jetPark2], "onEachFrame"] call BIS_fnc_removeStackedEventHandler; _veh allowDamage false; _veh setAirplaneThrottle 1; _veh setPosWorld _posCatapult; _veh setDir _dirCatapult; private _velocity = 0; private _timeStart = time; private _timeDelta = 0; while { speed _veh < _velocityLaunch && {isEngineOn _veh && {((getPos _veh) param [2,0]) < 1}} } do { if (!alive (driver _veh)) exitWith {breakto "takeOff"}; _veh setDir _dirCatapult; _veh setAirplaneThrottle 1; _timeDelta = time - _timeStart; _velocity = _velocityIncrease * _timeDelta; _veh setVelocity [sin _dirCatapult * _velocity,cos _dirCatapult * _velocity,velocity _veh select 2]; sleep _accelerationStep; }; [_part, _animations, 10] spawn BIS_fnc_Carrier01AnimateDeflectors; private _t = time + 1; waitUntil { if (!alive (driver _veh)) exitWith {breakto "takeOff";true}; _velocity = velocity _veh; _velocity set [2,2]; _veh setVelocity _velocity; time > _t }; [_part, _animations, 0] spawn { sleep 6; _this spawn BIS_fnc_Carrier01AnimateDeflectors; }; sleep 5; _veh allowDamage True; _veh setFuel ((_veh getVariable ["savedFuel",1]) - (1 - (fuel _veh))); driver _veh action ["LandGearUp", driver _veh]; }; }
  6. Boerstil

    Replace all mags with tracer mags

    Used this a couple of years ago, should still work. Works only for vanilla magazines. _unit = param [0,objNull]; private _pWeap = primaryWeapon _unit; private _magarray = primaryWeaponMagazine _unit; private _magtype = _magarray select 0; if (isNil "_magtype") exitWith {}; if (_magtype isEqualTo "30Rnd_65x39_caseless_mag") then {_tracermag = "30Rnd_65x39_caseless_mag_Tracer"}; // Blufor if (_magtype isEqualTo "100Rnd_65x39_caseless_mag") then {_tracermag = "100Rnd_65x39_caseless_mag_Tracer"}; // Blufor if (_magtype isEqualTo "150Rnd_556x45_Drum_Mag_F") then {_tracermag = "150Rnd_556x45_Drum_Mag_Tracer_F"}; // Blufor if (_magtype isEqualTo "30Rnd_65x39_caseless_green") then {_tracermag = "30Rnd_65x39_caseless_green_mag_Tracer"}; // Opfor if (_magtype isEqualTo "150Rnd_762x51_Box") then {_tracermag = "150Rnd_762x51_Box_Tracer"}; // Opfor if (_magtype isEqualTo "150Rnd_762x54_Box") then {_tracermag = "150Rnd_762x54_Box_Tracer"}; // Opfor if (_magtype isEqualTo "30Rnd_580x42_Mag_F") then {_tracermag = "30Rnd_580x42_Mag_Tracer_F"}; // Opfor if (_magtype isEqualTo "100Rnd_580x42_Mag_F") then {_tracermag = "100Rnd_580x42_Mag_Tracer_F"}; // Opfor if (_magtype isEqualTo "200Rnd_65x39_cased_Box") then {_tracermag = "200Rnd_65x39_cased_Box_Tracer"}; //Indep if (_magtype isEqualTo "30Rnd_762x39_Mag_F") then {_tracermag = "30Rnd_762x39_Mag_Tracer_F"}; //Indep if (_magtype isEqualTo "30Rnd_545x39_Mag_F") then {_tracermag = "30Rnd_545x39_Mag_Tracer_F"}; //Indep if (_magtype isEqualTo "20Rnd_650x39_Cased_Mag_F") then {_tracermag = "20Rnd_650x39_Cased_Mag_F"}; //Indep if (_magtype isEqualTo "30Rnd_556x45_Stanag") then { if (side _unit == west) then {_tracermag = "30Rnd_556x45_Stanag_Tracer_Red"}; // Blufor if (side _unit == independent) then {_tracermag = "30Rnd_556x45_Stanag_Tracer_Yellow"}; // Indep if (side _unit == east) then {_tracermag = "30Rnd_556x45_Stanag_Tracer_Green"}; // Opfor }; if (_magtype isEqualTo "30Rnd_9x21_Mag") then { if (side _unit == west) then {_tracermag = "30Rnd_9x21_Red_Mag"}; // Blufor if (side _unit == independent) then {_tracermag = "30Rnd_9x21_Yellow_Mag"}; // Indep if (side _unit == east) then {_tracermag = "30Rnd_9x21_Green_Mag"}; // Opfor }; if (_magtype isEqualTo "16Rnd_9x21_Mag") then { if (side _unit == west) then {_tracermag = "16Rnd_9x21_red_Mag"}; // Blufor if (side _unit == independent) then {_tracermag = "16Rnd_9x21_green_Mag"}; // Indep if (side _unit == east) then {_tracermag = "16Rnd_9x21_yellow_Mag"}; // Opfor }; if (_magtype isEqualTo "30Rnd_45ACP_Mag_SMG_01") then { if (side _unit == west) then {_tracermag = "30Rnd_45ACP_Mag_SMG_01_Tracer_Red"}; // Blufor if (side _unit == independent) then {_tracermag = "30Rnd_45ACP_Mag_SMG_01_Tracer_Yellow"}; // Indep if (side _unit == east) then {_tracermag = "30Rnd_45ACP_Mag_SMG_01_Tracer_Green"}; // Opfor }; if (_magtype isEqualTo "30Rnd_9x21_Mag_SMG_02") then { if (side _unit == west) then {_tracermag = "30Rnd_9x21_Mag_SMG_02_Tracer_Red"}; // Blufor if (side _unit == independent) then {_tracermag = "30Rnd_9x21_Mag_SMG_02_Tracer_Yellow"}; // Indep if (side _unit == east) then {_tracermag = "30Rnd_9x21_Mag_SMG_02_Tracer_Green"}; // Opfor }; if (_magtype isEqualTo "200Rnd_556x45_Box_F") then { if (side _unit == west) then {_tracermag = "200Rnd_556x45_Box_Red_F"}; // Blufor if (side _unit == independent) then {_tracermag = "200Rnd_556x45_Box_Tracer_F"}; // Indep if (side _unit == east) then {_tracermag = "200Rnd_556x45_Box_Tracer_Red_F"}; // Opfor }; _magcount = {_x == _magtype} count magazines _unit; _unit removeMagazines _magtype; _unit removePrimaryWeaponItem _magtype; _unit addMagazines [_tracermag, _magcount]; _unit addPrimaryWeaponItem _tracermag; };
  7. Does anyone know-how tog show the progressbar on The client being revived,? Like the ingame revive?
  8. If I understand you right. This should help: if (isServer) then { [o4, "Confirm Identity", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa", "_this distance _target < 3", "_caller distance _target < 3", {}, {}, {confirmed = 1}, {}, [], 5, 0, true, false] remoteExec ["BIS_fnc_holdActionAdd",[0,-2] select isDedicated,true]; };
  9. Not tested: { _x animate ['ramp', 1]; } forEach thislist
  10. https://community.bistudio.com/wiki/BIS_fnc_codePerformance
  11. Boerstil

    Jets DLC Official Feedback

    this animate ["wing_fold_l", 1]; this animate ["wing_fold_r", 1];
  12. Someone was requesting this function in dev-branch forum. So I'll share my script for it. It basically does what it sounds like. Use function where unit is local. loadout = [unit] call bor_fnc_getVehicleLoadout; [unit ,loadout] call bor_fnc_setVehicleLoadout; Parameters: unit: Object loadout: Array from getVehicleLoadout bor_fnc_getVehicleLoadout = { if (!local (_this select 0)) exitWith {}; params ["_veh"]; private _magArray = []; private _wepArray = []; private _itemArray = []; private _bpArray = []; { private ["_mag"]; _mag = [ (((getMagazineCargo _veh) select 0) select _forEachIndex) , (((getMagazineCargo _veh) select 1) select _forEachIndex) ]; _magArray pushBack _mag; } forEach ((getMagazineCargo _veh) select 0); { private ["_mag"]; _wep = [ (((getWeaponCargo _veh) select 0) select _forEachIndex) , (((getWeaponCargo _veh) select 1) select _forEachIndex) ]; _wepArray pushBack _wep; } forEach ((getWeaponCargo _veh) select 0); { private ["_item"]; _item = [ (((getItemCargo _veh) select 0) select _forEachIndex) , (((getItemCargo _veh) select 1) select _forEachIndex) ]; _itemArray pushBack _item; } forEach ((getItemCargo _veh) select 0); { private ["_bp"]; _bp = [ (((getBackpackCargo _veh) select 0) select _forEachIndex) , (((getBackpackCargo _veh) select 1) select _forEachIndex) ]; _bpArray pushBack _bp; } forEach ((getBackpackCargo _veh) select 0); _loadout = [ _magArray, _wepArray, _itemArray, _bpArray ]; _loadout }; bor_fnc_setVehicleLoadout = { if (!local (_this select 0)) exitWith {}; params ["_veh","_loadout"]; private _magArray = (_loadout select 0); private _wepArray = (_loadout select 1); private _itemArray = (_loadout select 2); private _bpArray = (_loadout select 3); clearWeaponCargoGlobal _veh; clearMagazineCargoGlobal _veh; clearItemCargoGlobal _veh; clearBackpackCargoGlobal _veh; { _veh addMagazineCargoGlobal _x; } forEach _magArray; { _veh addWeaponCargoGlobal _x; } forEach _wepArray; { _veh addItemCargoGlobal _x; } forEach _itemArray; { _veh addBackpackCargoGlobal _x; } forEach _bpArray; };
  13. I use this if (!isServer) exitWith {}; [] spawn { blacklistArray = []; private "_unit"; while {True} do { { _unit = _x; if !((_unit isKindOf "Air") || ((vehicle _unit) isKindOf "Air")) then { if (({isPlayer _x AND (_x distance _unit) < viewDistance} count playableUnits) != 0) then { _unit enableSimulationGlobal True; _unit enableAI "ALL"; _unit hideObjectGlobal False; } else { _unit enableSimulationGlobal false; _unit disableAI "ALL"; _unit hideObjectGlobal true; }; }; } forEach ((AllUnits + Vehicles) - blacklistArray); sleep 5; }; };
×