Jump to content
Sign in to follow this  
zuff

HALO Jump Group player group together

Recommended Posts

I'm trying to do a HALO jump with a group of players. I am the only one that pulls my chute, the other players are just falling to their death.

I have an addaction for "Group Halo Jump" that opens this:

haloGroupJump.sqf

hint "Click on the Map where you'd like to HALO jump.";
openMap true;
onMapSingleClick {
onMapSingleClick {};
{_x setPos [(_pos select 0),(_pos select 1), 200];} forEach units group player;
player execVM "scripts\haloGroupJumpEach.sqf";
hint '';
openMap false;
};

This code runs scripts\haloGroupJumpEach.sqf through BIS_fnc_MP.

haloGroupJumpEach.sqf

removeBackPack player;
player addBackpack "B_Parachute";

[] spawn {
waitUntil {(getPos player select 2) < 150 || animationState player == "para_pilot" && alive player};
	player action ["OpenParachute", player];
};

Now it works for me but not for them, so I'm imagining it's because they aren't considered "player" on the server? I've tried passing variables but nothing seems to work. Any help would be greatly appreciated.

Edited by zuff
Fixed Title typo

Share this post


Link to post
Share on other sites

You need to run haloGroupJumpEach.sqf on each person's computer.

Right now, you are putting every person in that group at 200 meters over the spot you clicked and then you are only running the second script on yourself with execVM.

What I would do is pass the group to the function and if the current player is in it, run the rest of the code.

First, compile the haloGroupJumpEach code, so you don't have to compile it over and over as you use it.. Do this in the init, where each player runs it.

 haloGroupJumpEach = compile preprocessfilelinenumbers "haloGroupJumpEach.sqf"; 

Then replace your execVM with the BIS_fnc_MP call;

hint "Click on the Map where you'd like to HALO jump.";
openMap true;
onMapSingleClick {
onMapSingleClick {};
{_x setPos [(_pos select 0),(_pos select 1), 200];} forEach units group player;
_group = group player;  //you can probably put this in the call, but could be useful outside for debugging purposes
[_group,"haloGroupJumpEach", true, false] call BIS_fnc_MP;  //[parameters, function to call, everybody, not persistent]
hint '';
openMap false;
};

Then in your function, check the player's group and exit if they aren't in the appropriate one.

if(group player != _this) exitwith {};
removeBackPack player;
player addBackpack "B_Parachute";

[] spawn {
waitUntil {(getPos player select 2) < 150 || animationState player == "para_pilot" && alive player};
	player action ["OpenParachute", player];
};

Share this post


Link to post
Share on other sites

brians200 you rock!

Quick question, you said I could have probably put the _group variable in the "call", what do you mean by this?

I need to start thinking with Functions more, and it didn't even cross my mind to preprocess it to save server load.

Thanks a lot.

Share this post


Link to post
Share on other sites

[group player,"haloGroupJumpEach", true, false] call BIS_fnc_MP;

This will save you a line of code is all.

Share this post


Link to post
Share on other sites

Ah gotcha, thanks a lot man.

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
Sign in to follow this  

×