Jump to content
BlackbirdSD

2 Parachutes for the price of 1?

Recommended Posts

I start my mission in an open chute using

 

 chute = "Steerable_Parachute_F" createVehicle [0,0,0];  
chute setPos [getPos this select 0, getPos this select 1, 200];  
this moveIndriver chute;

 

Works fine in single player but when I play with a friend, there is an extra chute for each of us.  We each are attached to our own and there are 2 more open chutes next to us.

 

I also have a supply drop doing the same thing, adding an extra chute during multiplayer using this command

parachute_1 = "B_parachute_02_F" createVehicle [0,0,0]; 
parachute_1 setPosASL (getPosASL s1); 
s1 attachTo [parachute_1, [0, 0, 1]];

 

Any idea how to correct this?

Thanks

Share this post


Link to post
Share on other sites

You shouldn't have to use createvehicle to give soldier a parachute, the parachute should open automatically if the soldier's backpack is parachute.

 

3 hours ago, BlackbirdSD said:

I also have a supply drop doing the same thing, adding an extra chute during multiplayer using this command

 

where are you executing this code?

Share this post


Link to post
Share on other sites
4 hours ago, BlackbirdSD said:

I start my mission in an open chute using

 

 chute = "Steerable_Parachute_F" createVehicle [0,0,0];  
chute setPos [getPos this select 0, getPos this select 1, 200];  
this moveIndriver chute;

 

Works fine in single player but when I play with a friend, there is an extra chute for each of us.  We each are attached to our own and there are 2 more open chutes next to us.

 

I also have a supply drop doing the same thing, adding an extra chute during multiplayer using this command

parachute_1 = "B_parachute_02_F" createVehicle [0,0,0]; 
parachute_1 setPosASL (getPosASL s1); 
s1 attachTo [parachute_1, [0, 0, 1]];

 

Any idea how to correct this?

Thanks

 

 

You just have to run the code in initPlayerLocal.sqf , replacing this (works only in init field) by: player

So, add the sqf in the root folder of the mission

and:

private _chute = "B_parachute_02_F" createVehicle [0,0,0];

_chute setposASL (getPosASL player vectorAdd [0,0,200]);

player moveInDriver _chute;

 

for your supply drop, you can let it where it runs and :

if (isServer) then {
  parachute_1 = "B_parachute_02_F" createVehicle [0,0,0]; 
  parachute_1 setPosASL (getPosASL s1); 
  s1 attachTo [parachute_1, [0, 0, 1]];
};

Share this post


Link to post
Share on other sites
14 hours ago, gc8 said:

You shouldn't have to use createvehicle to give soldier a parachute, the parachute should open automatically if the soldier's backpack is parachute.

 

 

where are you executing this code?

In the init field of the player.

Share this post


Link to post
Share on other sites
12 hours ago, pierremgi said:

 

 

You just have to run the code in initPlayerLocal.sqf , replacing this (works only in init field) by: player

So, add the sqf in the root folder of the mission

and:

private _chute = "B_parachute_02_F" createVehicle [0,0,0];

_chute setposASL (getPosASL player vectorAdd [0,0,200]);

player moveInDriver _chute;

 

for your supply drop, you can let it where it runs and :

if (isServer) then {
  parachute_1 = "B_parachute_02_F" createVehicle [0,0,0]; 
  parachute_1 setPosASL (getPosASL s1); 
  s1 attachTo [parachute_1, [0, 0, 1]];
};

I will give a try, thanks

Share this post


Link to post
Share on other sites
13 hours ago, pierremgi said:

 

 

You just have to run the code in initPlayerLocal.sqf , replacing this (works only in init field) by: player

So, add the sqf in the root folder of the mission

and:

private _chute = "B_parachute_02_F" createVehicle [0,0,0];

_chute setposASL (getPosASL player vectorAdd [0,0,200]);

player moveInDriver _chute;

 

for your supply drop, you can let it where it runs and :

if (isServer) then {
  parachute_1 = "B_parachute_02_F" createVehicle [0,0,0]; 
  parachute_1 setPosASL (getPosASL s1); 
  s1 attachTo [parachute_1, [0, 0, 1]];
};

Just curious, what caused the second chute?  because it was in the init field of the supply drop and the player?  Just so I understand more how this stuff works.

Thanks

Share this post


Link to post
Share on other sites

Yes. At mission start, the init field of any objects in editor runs on server, then on each client while mission starts locally. If all players start at (almost ) the same time, usually the case with 2 friends on hosted server, the code seem to run twice. In fact the server runs the code, then the client also when joining, and you can see 2 chutes.

It's the same with the init.sqf commonly used for script automatically run at start. (init.sqf runs on server and clients). So, some unwanted results,  like a "reset" for a unit loadout, can be fired from a JIP client. (but that depends on the command/functions also). You need to read some pages about event scripts (and links).

 

If your friend joins a little later, you will see a 2nd chute, spawning with the start of the 2nd player, and probably a little teleportation (due to the setpos at same initial position). With 10 players, ... 10 chutes.

 

Scripting in MP is a large step above scripting skill for SP. You have some great topics and BIKI for learning.

You can start here, but there is so much links and things to assimilate... Have fun!

  • Like 1

Share this post


Link to post
Share on other sites
1 hour ago, pierremgi said:

Yes. At mission start, the init field of any objects in editor runs on server, then on each client while mission starts locally. If all players start at (almost ) the same time, usually the case with 2 friends on hosted server, the code seem to run twice. In fact the server runs the code, then the client also when joining, and you can see 2 chutes.

It's the same with the init.sqf commonly used for script automatically run at start. (init.sqf runs on server and clients). So, some unwanted results,  like a "reset" for a unit loadout, can be fired from a JIP client. (but that depends on the command/functions also). You need to read some pages about event scripts (and links).

 

If your friend joins a little later, you will see a 2nd chute, spawning with the start of the 2nd player, and probably a little teleportation (due to the setpos at same initial position). With 10 players, ... 10 chutes.

 

Scripting in MP is a large step above scripting skill for SP. You have some great topics and BIKI for learning.

You can start here, but there is so much links and things to assimilate... Have fun!

Thank you!

Share this post


Link to post
Share on other sites
On 8/4/2020 at 2:18 AM, pierremgi said:

 

 

You just have to run the code in initPlayerLocal.sqf , replacing this (works only in init field) by: player

So, add the sqf in the root folder of the mission

and:

private _chute = "B_parachute_02_F" createVehicle [0,0,0];

_chute setposASL (getPosASL player vectorAdd [0,0,200]);

player moveInDriver _chute;

 

for your supply drop, you can let it where it runs and :

if (isServer) then {
  parachute_1 = "B_parachute_02_F" createVehicle [0,0,0]; 
  parachute_1 setPosASL (getPosASL s1); 
  s1 attachTo [parachute_1, [0, 0, 1]];
};

I added this 

private _chute = "B_parachute_02_F" createVehicle [0,0,0];
_chute setposASL (getPosASL player vectorAdd [0,0,200]);
player moveInDriver _chute; 

To the initPlayerLocal and removed the code from the init field of the player and when I start the mission, I am invisible and i can see the open chute but cant control it.

Share this post


Link to post
Share on other sites
4 hours ago, BlackbirdSD said:

"B_parachute_02_F"

 

On 8/4/2020 at 4:38 AM, BlackbirdSD said:

"Steerable_Parachute_F"

Could be the reason

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

×