Jump to content

Recommended Posts

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"];

 

  • Like 1

Share this post


Link to post
Share on other sites

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
  On 1/29/2018 at 11: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

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

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

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

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

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
  On 2/11/2019 at 4:29 PM, 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

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

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"}) ;

 

 

  • Like 1

Share this post


Link to post
Share on other sites

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
  On 4/13/2019 at 3:43 PM, 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

  • Like 2

Share this post


Link to post
Share on other sites

 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
  On 5/31/2020 at 5:30 AM, 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?

  Reveal hidden contents

 

  • Thanks 1

Share this post


Link to post
Share on other sites

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
  On 5/31/2020 at 11: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};

 

 

  • Haha 1

Share this post


Link to post
Share on other sites

Why not.
 

  Reveal hidden contents

 

  • Thanks 1

Share this post


Link to post
Share on other sites
  On 6/3/2020 at 7:37 PM, pierremgi said:

Why not.
 

  Reveal hidden contents

 

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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×