pierremgi 4850 Posted January 29, 2018 You can do this kind of thing apart. Be sure any attached object will flicker more or less during the fall. try something like: player addAction ["chemLight",{ _target = _this select 0; _caller = _this select 1; _id = _this select 2; { _lgt = "Chemlight_Blue" createVehicle [0,0,0]; _lgt attachTo [_x, [0,-0.03,0.07], "LeftShoulder"]; } forEach (units _caller select {local _caller}); },nil, 5,false, true,"","(getPosATL _this) select 2 > 80"]; 1 Share this post Link to post Share on other sites
Mirek 166 Posted January 30, 2018 Couldnt we let the player do at least something himself? They now get parachute automaticaly. If they want strobe or chemlight, they might as well do it themselves. 1 Share this post Link to post Share on other sites
pierremgi 4850 Posted January 30, 2018 sure! The local condition (done) is OK for that.. As players are on different PCs, they will now just order for the local AIs (in player's group). Share this post Link to post Share on other sites
Jnr4817 215 Posted February 6, 2018 On 1/29/2018 at 5:31 PM, pierremgi said: You can do this kind of thing apart. Be sure any attached object will flicker more or less during the fall. try something like: player addAction ["chemLight",{ _target = _this select 0; _caller = _this select 1; _id = _this select 2; _lgt = "Chemlight_Blue" createVehicle [0,0,0]; _lgt attachTo [_x, [0,-0.03,0.07], "LeftShoulder"]; } forEach (units _caller select {local _caller}); },nil, 5,false, true,"","(getPosATL _this) select 2 > 80"]; I am getting an error defined variable _caller on line 7. Thanks Share this post Link to post Share on other sites
pierremgi 4850 Posted February 6, 2018 forgot a bracket. My bad. Corrected. Share this post Link to post Share on other sites
pierremgi 4850 Posted February 17, 2018 Disabled the weird possibility to switch backpack / parachute during the jump. Caused too much accident pressing the enter key. Share this post Link to post Share on other sites
Rockapes 103 Posted April 8, 2018 Hey @pierremgi, I hate to be a pain but when I test this script using the standard 0 = [this,1000,90,true] execVM "MGI_HALO.sqf" on a pole init in a local hosted mission all works well but as soon as I use on a dedicated server I get no "Halo Jump" option on the pole, am I doing something wrong? Share this post Link to post Share on other sites
pierremgi 4850 Posted April 8, 2018 No idea so far. Check the code is present in init field of your pole and the sqf in mission folder root. If you placed it elsewhere, you need to mention the path. If it's OK, then a battleEye compatibility with added action or a mod like ACE?? I don't know. Share this post Link to post Share on other sites
Rockapes 103 Posted April 8, 2018 Now its working, weird. cheers Share this post Link to post Share on other sites
pierremgi 4850 Posted September 18, 2018 Added actions option (solo/group). See front page. Thanks 2 Share this post Link to post Share on other sites
Drty_Windshield 0 Posted February 11, 2019 Hello, if possible could you explain to me what would need to be done to prevent players from using this Halo whenever they want. After a particular player uses the Halo I would like them to have to wait 15 minutes before they could use it again. I would also like a hint that lets a particular player know how long they have to wait to use it again. If you could explain in detail or post some code that would be awesome. Edit: I found this while looking through the forums (I modified the hint) if (diag_tickTime < (uiNamespace getVariable ['tag_cooldown',-1])) exitWith { hint (format ['HQ: \n Next jump available in %1 seconds.',(round ((uiNamespace getVariable ['tag_cooldown',-1]) - diag_tickTime))]); }; _cooldown = 900; // cooldown duration in seconds uiNamespace setVariable ['tag_cooldown',(diag_tickTime + _cooldown)]; and inserted it into the add action in the MGI Halo.sqf like so... _pole addAction ["<t color='#00ffff'>HALO jump</t>",{ params ["_target","_caller","_id","_parameters"]; if (diag_tickTime < (uiNamespace getVariable ['tag_cooldown',-1])) exitWith { hint (format ['HQ: \n Next jump available in %1 seconds.',(round ((uiNamespace getVariable ['tag_cooldown',-1]) - diag_tickTime))]); }; _cooldown = 900; // cooldown duration in seconds uiNamespace setVariable ['tag_cooldown',(diag_tickTime + _cooldown)]; openmap [true,false]; hint "Pilot: \n Select location for LZ"; _parameters params ["_jump_alt","_jump_safety"]; It seems to work as intended with just me sampling the MP mission in the editor that I'm creating, but I have no idea if the timer will prevent everyone from using the Halo until the time runs out or if it will only affect the player that used the Halo. I'm very new to scripting, but I'm trying to learn as much as I can and don't really have anyone to help me test the functionality right now. Share this post Link to post Share on other sites
pierremgi 4850 Posted February 11, 2019 The inner code of addAction applies to the caller only (and his Ais here but that doesn't matter). So you can try something like: if (isNil {_caller getVariable "jumpTimer"}) then { _caller setVariable ["jumpTimer",900]; _caller spawn { _timer = _this getVariable "jumpTimer"; _go = diag_tickTime; waitUntil {uiSleep 1; hintSilent format ["HQ: \n Next jump available in %1 seconds.",_go +_timer - diag_tickTime]; diag_tickTime > _go + _timer -1}; hintSilent ""; _this setVariable ["jumpTimer",nil]; }; // end spawn <code> }; // end if here Not tested Cooldown will be included in the module version of this script. Share this post Link to post Share on other sites
Rockapes 103 Posted February 12, 2019 15 hours ago, pierremgi said: The inner code of addAction applies to the caller only (and his Ais here but that doesn't matter). So you can try something like: if (isNil {_caller getVariable "jumpTimer"}) then { _caller setVariable ["jumpTimer",900]; _caller spawn { _timer = _this getVariable "jumpTimer"; _go = diag_tickTime; waitUntil {uiSleep 1; hintSilent format ["HQ: \n Next jump available in %1 seconds.",_go +_timer - diag_tickTime]; diag_tickTime > _go + _timer -1}; hintSilent ""; _this setVariable ["jumpTimer",nil]; }; // end spawn <code> }; // end if here Not tested Cooldown will be included in the module version of this script. Sweet a module version is coming...Love it @pierremgi Share this post Link to post Share on other sites
jandrews 116 Posted February 18, 2019 Hello I am looking for a jump script that will apply to only a certain player class. And the addaction would be applied to the player themselves. The idea is the class paratrooper will be able to jump to another location once his timer is up and not be dependent on a item like a pole after each area is cleared. Only dependent on timer and classname. Also this seems like a work around to white listing class names. So for this code. 0 = [this,1000,90,true] execVM "MGI_HALO.sqf" Would 0 be changed to this? Share this post Link to post Share on other sites
pierremgi 4850 Posted February 18, 2019 0 is just a handle needed by the init code of an object/unit. That doesn't do anything interesting for your problem. You can try a code in init.sqf: { [_x,1000,90,true] execVM "MGI_HALO.sqf"; } forEach ((switchableUnits + playableUnits) select {_x isKindOf "B_soldier_PG_F"}); in the MGI_HALO.sqf, there are 2 addActions find the 2 lines: [_jump_alt,_jump_safety], 5,false, true,"","vehicle _this == _this"] (one of them is the last one) Replace by: [_jump_alt,_jump_safety], 5,false, true,"","vehicle _this == _target && isNil {_this getVariable 'jumpTimer'} "] Should work. You can also modify the code for enabling only paratrooper AIs in group. So the part of code adding a parachute becomes useless... As all the stuff for placing a current backpack on ventral. I don't want to rework this script in this way. At this time, just add a filter for your purpose. Replace: } forEach _MGI_units; by } forEach (_MGI_units select {_x isKindOf "B_soldier_PG_F"}) ; 1 Share this post Link to post Share on other sites
ClydeHype 1 Posted April 13, 2019 I'm fairly new to scripting, but I find it pretty interesting, even though I have to admit I feel completely lost at times 😄 I really like this script and I was wondering if it's possible to set a player interaction distance? Like, the player needs to be within 5 meters of the object to use the HALO jump. Been experimenting with it a bit, but I just can't find the line where I need to input the interaction distance 😢 Also, is it possible to do so all players in a squad gets teleported? Just like the AI squad jump, but for players instead? Share this post Link to post Share on other sites
Play3r 147 Posted April 13, 2019 3 hours ago, ClydeHype said: I'm fairly new to scripting, but I find it pretty interesting, even though I have to admit I feel completely lost at times 😄 I really like this script and I was wondering if it's possible to set a player interaction distance? Like, the player needs to be within 5 meters of the object to use the HALO jump. Been experimenting with it a bit, but I just can't find the line where I need to input the interaction distance 😢 Also, is it possible to do so all players in a squad gets teleported? Just like the AI squad jump, but for players instead? Look at this to understand AddAction https://community.bistudio.com/wiki/addAction radius: Number - (Optional, default 50) 3D distance in meters the unit activating the action must be within to activate it. -1 disables this radius 2 Share this post Link to post Share on other sites
ClydeHype 1 Posted April 16, 2019 On 4/13/2019 at 9:10 PM, Play3r said: Look at this to understand AddAction https://community.bistudio.com/wiki/addAction radius: Number - (Optional, default 50) 3D distance in meters the unit activating the action must be within to activate it. -1 disables this radius Thanks for helping mate 🙂 Figured it out now ^^ 1 Share this post Link to post Share on other sites
Beyaco 4 Posted May 31, 2020 Hello, thank you for the awesome script! I have a question that I am hoping that someone can help me or let me know if it is even possible. Instead of an object (flag pole), is there a way to execute the code on the fly with the debug console? Or possibly a small script that could be tossed into a .sqf file and then executed? Share this post Link to post Share on other sites
pierremgi 4850 Posted May 31, 2020 3 hours ago, Beyaco said: Hello, thank you for the awesome script! I have a question that I am hoping that someone can help me or let me know if it is even possible. Instead of an object (flag pole), is there a way to execute the code on the fly with the debug console? Or possibly a small script that could be tossed into a .sqf file and then executed? Spoiler MGI_compHALO = compileFinal " _plyr = _this; 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 ] }; _plyr setVariable ['bpk',unitBackpack _plyr]; if (backpack _plyr != '') then { _whs = createVehicle ['WeaponHolderSimulated_Scripted',getpos _plyr,[],0,'can_collide']; _plyr action ['DropBag', _whs, typeOf (_plyr getVariable 'bpk')]; ['EHid','onEachFrame', { params ['_plyr','_whs']; if (backpack _plyr != 'B_parachute') then { _plyr action ['dropBag', _whs, typeOf (_plyr getVariable 'bpk')]; _plyr action ['AddBag', _whs, 'B_Parachute'] }; call{ if (stance _plyr == 'UNDEFINED') exitWith { _whs attachTo [_plyr,[-0.1,-0.05,-0.7],'leaning_axis']; [_whs,-180] call MGI_fnc_orient }; if (stance _plyr != 'UNDEFINED') exitWith { _whs attachTo [_plyr,[-0.1,0.75,-0.05],'leaning_axis']; [_whs,-90] call MGI_fnc_orient }; }; if (isNil {_plyr getVariable ['bpk',nil]}) then { ['EHid', 'onEachFrame'] call BIS_fnc_removeStackedEventHandler }; },[_plyr,_whs] ] call BIS_fnc_addStackedEventHandler }; "; 0 = [] spawn { params [["_jump_alt",2000,[0]],["_jump_safety",90,[0]]]; openmap [true,false]; titleText["Select Map Position", "PLAIN"]; ["Jump","onMapSingleClick", { 0 cutText ["","black",0.01,true]; params ["","_pos","","","_jump_alt","_jump_safety","_MGI_forSquad"]; _caller = player; _MGI_units = (units _caller) select {local _x && alive _x && _x distanceSqr _caller < 100000 && isnull objectParent _x}; { [_x,_forEachIndex,_pos,_jump_alt,_jump_safety] spawn { params ["_unit","_index","_pos","_jump_alt","_jump_safety"]; private ["_bpk","_bpktype","_whs","_para"]; if (isPlayer _unit) then { _unit call MGI_compHALO; }; uisleep 2; _unit allowDamage false; _unit setPos [(_pos select 0)-60 + random 30,(_pos select 1) -60 + random 30, (_jump_alt max 200) + (12 *_index)]; waitUntil {(getpos _unit select 2) > _jump_safety -50}; uisleep 0.2; if (isPlayer _unit) then { _bpk = _unit getVariable "bpk"; _bpktype = typeOf (_unit getVariable "bpk"); _whs = objectParent _bpk; _unit addBackpackGlobal "B_parachute"; }; 0 cutText ["","black in",1,true]; waitUntil {(getpos _unit select 2) < ([_jump_safety max 90,_jump_safety] select (isPlayer _unit)) +20 or (!isnull objectParent player) }; if (!isplayer _unit) then { uisleep 0.8; _chute = createVehicle ["Steerable_Parachute_F", getpos _unit, [], 0, "can_collide"]; _unit moveInDriver _chute; } else { _unit allowDamage true; if (!isTouchingGround _unit) then { _unit action ["OpenParachute", _unit]; } }; _para = objectParent _unit; waitUntil {!isnull _para}; _para allowDamage false; waitUntil {sleep 0.5; (isTouchingGround _unit && isNull _para) or surfaceIsWater (getpos _unit) or !alive _unit}; if (isPlayer _unit) then { _unit setVariable ["bpk",nil]; waitUntil {isNull _para}; deleteVehicle _para; sleep 0.5; detach _whs; if (!isNull _whs) then { _unit action ["AddBag",objectParent _bpk, _bpktype]; sleep 2; deleteVehicle _whs; }; } else { uisleep 2; _unit allowdamage true; }; }; } forEach _MGI_units; openmap [false,false]; ["Jump","onMapSingleClick"] call BIS_fnc_removeStackedEventHandler; false }, [_jump_alt,_jump_safety]] call bis_fnc_addStackedEventHandler; }; You can pass a jump altitude (2000 as default) and a jump safety altitude (90 as default) in the spawn parameter: 0= [1500,120] spawn {....}; instead for 0 = [] spawn {....]; 1 Share this post Link to post Share on other sites
Beyaco 4 Posted May 31, 2020 That works perfectly! I really appreciate your help! I have one other question, is there a variable that can be changed to make it a solo jump instead of group jump? Share this post Link to post Share on other sites
Beyaco 4 Posted June 3, 2020 On 5/31/2020 at 7:01 PM, Beyaco said: That works perfectly! I really appreciate your help! I have one other question, is there a variable that can be changed to make it a solo jump instead of group jump? I am going to post what I came up with even though there is probably a better way to accomplish it 🙂 Maybe it will help someone else. I went to line 48 and changed _MGI_units = (units _caller) select {local _x && alive _x && _x distanceSqr _caller < 100000 && isnull objectParent _x}; to _MGI_units = (units _caller) select {local _x && alive _x && _x distanceSqr _caller < 1 && isnull objectParent _x}; 1 Share this post Link to post Share on other sites
pierremgi 4850 Posted June 3, 2020 Why not. Spoiler MGI_compHALO = compileFinal " _plyr = _this; 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 ] }; _plyr setVariable ['bpk',unitBackpack _plyr]; if (backpack _plyr != '') then { _whs = createVehicle ['WeaponHolderSimulated_Scripted',getpos _plyr,[],0,'can_collide']; _plyr action ['DropBag', _whs, typeOf (_plyr getVariable 'bpk')]; ['EHid','onEachFrame', { params ['_plyr','_whs']; if (backpack _plyr != 'B_parachute') then { _plyr action ['dropBag', _whs, typeOf (_plyr getVariable 'bpk')]; _plyr action ['AddBag', _whs, 'B_Parachute'] }; call{ if (stance _plyr == 'UNDEFINED') exitWith { _whs attachTo [_plyr,[-0.1,-0.05,-0.7],'leaning_axis']; [_whs,-180] call MGI_fnc_orient }; if (stance _plyr != 'UNDEFINED') exitWith { _whs attachTo [_plyr,[-0.1,0.75,-0.05],'leaning_axis']; [_whs,-90] call MGI_fnc_orient }; }; if (isNil {_plyr getVariable ['bpk',nil]}) then { ['EHid', 'onEachFrame'] call BIS_fnc_removeStackedEventHandler }; },[_plyr,_whs] ] call BIS_fnc_addStackedEventHandler }; "; 0 = [] spawn { params [["_jump_alt",2000,[0]],["_jump_safety",90,[0]]]; openmap [true,false]; titleText["Select Map Position", "PLAIN"]; ["Jump","onMapSingleClick", { 0 cutText ["","black",0.01,true]; params ["","_pos","","","_jump_alt","_jump_safety","_MGI_forSquad"]; [player,_forEachIndex,_pos,_jump_alt,_jump_safety] spawn { params ["_unit","_index","_pos","_jump_alt","_jump_safety"]; private ["_bpk","_bpktype","_whs","_para"]; _unit call MGI_compHALO; uisleep 2; _unit allowDamage false; _unit setPos [(_pos select 0),(_pos select 1), (_jump_alt max 200)]; waitUntil {(getpos _unit select 2) > _jump_safety -50}; uisleep 0.2; _bpk = _unit getVariable "bpk"; _bpktype = typeOf (_unit getVariable "bpk"); _whs = objectParent _bpk; _unit addBackpackGlobal "B_parachute"; 0 cutText ["","black in",1,true]; waitUntil {(getpos _unit select 2) < _jump_safety or !isnull objectParent player}; _unit allowDamage true; if (!isTouchingGround _unit) then { _unit action ["OpenParachute", _unit]; }; _para = objectParent _unit; waitUntil {!isnull _para}; _para allowDamage false; waitUntil {sleep 0.5; (isTouchingGround _unit && isNull _para) or surfaceIsWater (getpos _unit) or !alive _unit}; _unit setVariable ["bpk",nil]; waitUntil {isNull _para}; deleteVehicle _para; sleep 0.5; detach _whs; if (!isNull _whs) then { _unit action ["AddBag",objectParent _bpk, _bpktype]; sleep 2; deleteVehicle _whs; }; }; openmap [false,false]; ["Jump","onMapSingleClick"] call BIS_fnc_removeStackedEventHandler; false }, [_jump_alt,_jump_safety]] call bis_fnc_addStackedEventHandler; }; 1 Share this post Link to post Share on other sites
Beyaco 4 Posted June 4, 2020 8 hours ago, pierremgi said: Why not. Reveal hidden contents MGI_compHALO = compileFinal " _plyr = _this; 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 ] }; _plyr setVariable ['bpk',unitBackpack _plyr]; if (backpack _plyr != '') then { _whs = createVehicle ['WeaponHolderSimulated_Scripted',getpos _plyr,[],0,'can_collide']; _plyr action ['DropBag', _whs, typeOf (_plyr getVariable 'bpk')]; ['EHid','onEachFrame', { params ['_plyr','_whs']; if (backpack _plyr != 'B_parachute') then { _plyr action ['dropBag', _whs, typeOf (_plyr getVariable 'bpk')]; _plyr action ['AddBag', _whs, 'B_Parachute'] }; call{ if (stance _plyr == 'UNDEFINED') exitWith { _whs attachTo [_plyr,[-0.1,-0.05,-0.7],'leaning_axis']; [_whs,-180] call MGI_fnc_orient }; if (stance _plyr != 'UNDEFINED') exitWith { _whs attachTo [_plyr,[-0.1,0.75,-0.05],'leaning_axis']; [_whs,-90] call MGI_fnc_orient }; }; if (isNil {_plyr getVariable ['bpk',nil]}) then { ['EHid', 'onEachFrame'] call BIS_fnc_removeStackedEventHandler }; },[_plyr,_whs] ] call BIS_fnc_addStackedEventHandler }; "; 0 = [] spawn { params [["_jump_alt",2000,[0]],["_jump_safety",90,[0]]]; openmap [true,false]; titleText["Select Map Position", "PLAIN"]; ["Jump","onMapSingleClick", { 0 cutText ["","black",0.01,true]; params ["","_pos","","","_jump_alt","_jump_safety","_MGI_forSquad"]; [player,_forEachIndex,_pos,_jump_alt,_jump_safety] spawn { params ["_unit","_index","_pos","_jump_alt","_jump_safety"]; private ["_bpk","_bpktype","_whs","_para"]; _unit call MGI_compHALO; uisleep 2; _unit allowDamage false; _unit setPos [(_pos select 0)-60 + random 30,(_pos select 1) -60 + random 30, (_jump_alt max 200) + (12 *_index)]; waitUntil {(getpos _unit select 2) > _jump_safety -50}; uisleep 0.2; _bpk = _unit getVariable "bpk"; _bpktype = typeOf (_unit getVariable "bpk"); _whs = objectParent _bpk; _unit addBackpackGlobal "B_parachute"; 0 cutText ["","black in",1,true]; waitUntil {(getpos _unit select 2) < ([_jump_safety max 90,_jump_safety] select (isPlayer _unit)) +20 or (!isnull objectParent player) }; _unit allowDamage true; if (!isTouchingGround _unit) then { _unit action ["OpenParachute", _unit]; }; _para = objectParent _unit; waitUntil {!isnull _para}; _para allowDamage false; waitUntil {sleep 0.5; (isTouchingGround _unit && isNull _para) or surfaceIsWater (getpos _unit) or !alive _unit}; _unit setVariable ["bpk",nil]; waitUntil {isNull _para}; deleteVehicle _para; sleep 0.5; detach _whs; if (!isNull _whs) then { _unit action ["AddBag",objectParent _bpk, _bpktype]; sleep 2; deleteVehicle _whs; }; }; openmap [false,false]; ["Jump","onMapSingleClick"] call BIS_fnc_removeStackedEventHandler; false }, [_jump_alt,_jump_safety]] call bis_fnc_addStackedEventHandler; }; This one is shooting me an error. 0:03:06 Error in expression <+ random 30, (_jump_alt max 200) + (12 *_index)]; waitUntil {(getpos _unit selec> 0:03:06 Error position: <_index)]; waitUntil {(getpos _unit selec> 0:03:06 Error Undefined variable in expression: _index While I am content with my generic non-scripter workaround, I will try anything that you post and give you whatever feedback I come across. 🙂 Thanks, Brian Share this post Link to post Share on other sites