sowens 71 Posted April 30, 2017 private [ "_dialog", "_backpack", "_backpackcontents" ]; if ( isNil "GRLIB_last_halo_jump" ) then { GRLIB_last_halo_jump = -6000; }; if ( GRLIB_halo_param > 1 && ( GRLIB_last_halo_jump + ( GRLIB_halo_param * 60 ) ) >= time ) exitWith { hint format [ localize "STR_HALO_DENIED_COOLDOWN", ceil ( ( ( GRLIB_last_halo_jump + ( GRLIB_halo_param * 60 ) ) - time ) / 60 ) ]; }; _dialog = createDialog "liberation_halo"; dojump = 0; halo_position = getpos player; _backpackcontents = []; [ "halo_map_event", "onMapSingleClick", { halo_position = _pos } ] call BIS_fnc_addStackedEventHandler; "spawn_marker" setMarkerTextLocal (localize "STR_HALO_PARAM"); waitUntil { dialog }; while { dialog && alive player && dojump == 0 } do { "spawn_marker" setMarkerPosLocal halo_position; sleep 0.1; }; if ( dialog ) then { closeDialog 0; sleep 0.1; }; "spawn_marker" setMarkerPosLocal markers_reset; "spawn_marker" setMarkerTextLocal ""; [ "halo_map_event", "onMapSingleClick" ] call BIS_fnc_removeStackedEventHandler; if ( dojump > 0 ) then { GRLIB_last_halo_jump = time; halo_position = [ halo_position, random 250, random 360 ] call BIS_fnc_relPos; halo_position = [ halo_position select 0, halo_position select 1, GRLIB_halo_altitude + (random 200) ]; halojumping = true; sleep 0.1; cutRsc ["fasttravel", "PLAIN", 1]; playSound "parasound"; sleep 2; _backpack = backpack player; if ( _backpack != "" && _backpack != "B_Parachute" ) then { _backpackcontents = backpackItems player; removeBackpack player; sleep 0.1; }; player addBackpack "B_Parachute"; player setpos halo_position; sleep 4; halojumping = false; waitUntil { !alive player || isTouchingGround player }; if ( _backpack != "" && _backpack != "B_Parachute" ) then { sleep 2; player addBackpack _backpack; clearAllItemsFromBackpack player; { player addItemToBackpack _x } foreach _backpackcontents; }; }; So I am trying to relearn scripting after a very long break dating back to arma 2. After several days of research and looking, nothing has worked. I am trying to add functionality to the script above that has ai in my group jump with me if they are within a certain distance and apply the random factor to them as well. As of right now, I am lost on what to do. Share this post Link to post Share on other sites
pierremgi 4923 Posted May 1, 2017 Here is my script. (easier for me). I hope it works also in MP. I prefer to keep the units backpacks and place them as ventral. Not easy to have a smooth anim in MP. MGI_fnc_orient = { _obj = _this select 0; _p = _this select 1; _obj setVectorDirAndUp [ [ 0,cos _p,sin _p], [[0,-sin _p,cos _p],0] call BIS_fnc_rotateVector2D ] }; MGI_HALOJump = { jump_alt = _this select 0; jump_safety = _this select 1; _pole = _this select 2; _forSquad = _this select 3; MGI_units = if (_forSquad) then [{(units player) select {local _x}},{player}]; _pole addAction ["<t color='#2222ff'>HALO jump</t>",{ openmap [true,false]; titleText["Select Map Position", "PLAIN"]; { if (backpack _x !="") then { _x setVariable ["bpk",unitBackpack _x] } else {_x setVariable ["bpk",objNull] }; } forEach MGI_units; { { if (local _x) then { _x spawn { _unit = _this; waitUntil {!isNull (_unit getVariable "bpk")}; _bpk = (_unit getVariable "bpk"); _unit setVariable ["id",name _unit]; ["id"+(_unit getVariable "id"), "onEachFrame", { _unit = _this select 0; _bpk = objectParent (_this select 1); call{ if (stance _unit == "UNDEFINED") exitWith { _bpk attachTo [_unit,[-0.1,-0.05,-0.7],'leaning_axis']; [_bpk,-180] remoteExec ["MGI_fnc_orient"]}; if (stance _unit == "STAND") exitWith { _bpk attachTo [_unit,[-0.1,0.75,-0.05],'leaning_axis']; [_bpk,-90] remoteExec ["MGI_fnc_orient"]}; }; },[_unit,_bpk]] call BIS_fnc_addStackedEventHandler; }} } forEach MGI_units } remoteExec ["call"]; onMapSingleClick " {[_x,_forEachIndex,_pos] spawn { params ['_unit','_index','_pos']; _unit setPos [_pos select 0,_pos select 1, jump_alt+(10*_index)]; sleep 0.2; _unit addBackpack 'B_parachute'; _bpk = _unit getVariable 'bpk'; _bpktype = typeOf (_unit getVariable 'bpk'); waitUntil {(getpos _unit select 2) < jump_safety or isTouchingGround _unit}; if (!isTouchingGround _unit) then {_unit action ['OpenParachute', _unit]}; waitUntil {sleep 0.5; ((getPosATL _unit select 2) < 6 && isNull objectParent _unit) or !alive _unit}; _unit setVariable ['bpk',objNull]; if (!isnil {_unit getVariable 'id'}) then { ['id'+(_unit getVariable 'id'),'onEachFrame'] call BIS_fnc_removeStackedEventHandler; _unit setVariable ['id',nil]; }; waitUntil {isNull objectParent _unit}; sleep 2; detach objectParent _bpk; if (isPlayer _unit) then {disableUserInput true}; _unit action ['AddBag',objectParent _bpk, _bpktype]; if (isPlayer _unit) then {disableUserInput false}; }; } forEach MGI_units; openmap [false,false]; onMapSingleClick ''; false"},nil, 5,false, true,"","vehicle _this == _this"]; }; [500,100,this,true] call MGI_halojump; parameters are: jump alt, safety alt, object you placed the code, boolean for AI group or player only. Share this post Link to post Share on other sites
sowens 71 Posted May 1, 2017 Thank's mate I will give it a shot. Share this post Link to post Share on other sites
Midnighters 152 Posted May 1, 2017 BIS_fnc_halo (of course with edits you'll be able to get the same features, but eh) Share this post Link to post Share on other sites
pierremgi 4923 Posted May 1, 2017 2 hours ago, Midnighters said: BIS_fnc_halo (of course with edits you'll be able to get the same features, but eh) The same feature and far beyond. Share this post Link to post Share on other sites
Midnighters 152 Posted May 1, 2017 5 hours ago, pierremgi said: The same feature and far beyond. Understood. Share this post Link to post Share on other sites