Home   Help Search Login Register  

Author Topic: Para Scripts in Multiplayer (Solved)  (Read 2233 times)

0 Members and 1 Guest are viewing this topic.

Offline trooper543

  • Members
  • *
Para Scripts in Multiplayer (Solved)
« on: 02 Oct 2008, 23:58:20 »
Hi All

Just wondering if somone could help me with getting a para script to work in multi player

The Para script that i have is as follows and was orginally created by Mandoble

and is as follows:

Code: [Select]
//////////////////////////////////////////////////////////////////
// Function file for Armed Assault
// Created by:  Mandoble
// Credit to Mandoble  for the script and Mapfact for the Chute
//////////////////////////////////////////////////////////////////

// ejectgroup.sqf
// example:
// res = [plane1, group leader1, 0.5]execVM"ejectgroup.sqf"
_transport = _this select 0;
_group      = _this select 1;
_delay      = _this select 2.2;
{
   _x action ["EJECT", _transport];
   [_x, _transport] spawn
   {
      _unit = _this select 0;
      _veh = _this select 1;
      waitUntil {(vehicle _unit != _unit) && (vehicle _unit != _veh)};
      _veh = vehicle _unit;
      _pos = getPos _veh;
      _dir  = vectorDir _veh;
      _up = vectorUp _veh;
      _vel = velocity _veh;
      deleteVehicle _veh;

      // LOOK HERE TO PUT THE CORRECT CLASS NAME OF YOUR DESIRED CHUTE
      _veh = "MAP_OPC_GU" createVehicle _pos;
      _veh setPos _pos;
      _veh setVectorDir _dir;
      _veh setVectorUp _up;
      _veh setVelocity _vel;
      _unit moveInDriver _veh;
   };
   Sleep _delay;
} forEach units _group;

This is what i would like to do

1. To have a player pilot activate the script whenever they are in the aircraft
2. If you are a passenger then when the pilot enters the drop zone you are autmatically ejected out of the aircraft

It would be most appreciated if this could explained to me step by step and what i need to put in the int and descrption files to get this to work

Many thanks in advance

« Last Edit: 23 Oct 2008, 01:33:40 by trooper543 »

Offline Gnat

  • Addons Depot
  • Former Staff
  • ****
  • I Bite!
    • Gnats
Re: Para Scripts in Multiplayer
« Reply #1 on: 03 Oct 2008, 16:51:17 »
Code: [Select]
_delay      = _this select 2.2;


I'm not 100% on how the code is meant to work, but above strikes me as a typo.
I'm thinking its meant to be;
    _delay      = _this select 2;


EDIT
In the INIT, I'm guessing;
res = [plane1, group leader1, 0.5] execVM "ejectgroup.sqf";

A copy of the script is in the mission folder, its called "ejectgroup.sqf"
You name the plane "plane1"
You name the group leader "leader1"
In the "descrption files"? Nothing required as I see it.

« Last Edit: 03 Oct 2008, 16:55:23 by Gnat »

Offline trooper543

  • Members
  • *
Re: Para Scripts in Multiplayer
« Reply #2 on: 04 Oct 2008, 09:54:57 »
@Gnat

Many thanks for the response mate i have tried this and it does not work

Is there not a way that the script could be added to plane1 action menu?

The whole point if what i am trying to do is if your are a player and when you are in plane1 you have the ability to eject your passesngers (other players) out over the DZ 

**********Update ***********************************************************************

Hi there again

Right it seems that i have this working as such however i am still having problems when testing in multiplayer

This is what i have set up at the moment

2 Planes
2 Groups of 15 Soldiers

the planes have waypoints to the drop zone, when the planes get to the first waypoint it is set to slow down in speed and

when the planes getsto the second waypoint it executes the script for the both planes, the scripts are activiated by the waypoint .

I have two scripts both identical as in my first post however named different from (ejectgroup.sqf and ejecgroup1.sqf)

The problem that i am havin is that when i test this in multiplayer them all is okay however when i try testing this online connected to oline the chutes dont open for my mates  could someone please enlighten me

Many thanks in advance



Cheers
« Last Edit: 07 Oct 2008, 15:04:29 by trooper543 »

Offline trooper543

  • Members
  • *
Re: Para Scripts in Multiplayer
« Reply #3 on: 07 Oct 2008, 21:06:30 »
Bump

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Para Scripts in Multiplayer
« Reply #4 on: 08 Oct 2008, 16:40:47 »
Code: [Select]
// ejectgroup.sqf
// example:
// res = [plane1, group leader1, 1]execVM"ejectgroup.sqf"
// Run this only for a PC (action menu for example)
_transport = _this select 0;
_group      = _this select 1;
_delay      = _this select 2;
{
   trooper_ejected_unit = _x;
   publicVariable "trooper_ejected_unit";
   Sleep _delay;
} forEach units _group;

Code: [Select]
// eject_monitor.sqf
// Run this everywhere, from the init.sqf
// []execVM"eject_monitor.sqf";

private["_unit"];
trooper_ejected_unit = objNull;
while {true} do
{
   waitUntil {!isNull trooper_ejected_unit};
   _unit = trooper_ejected_unit;
   trooper_ejected_unit = objNull;
   if (local _unit) then
   {
      [_unit] spawn
      {
         private["_unit", "_veh", "_pos", "_dir", "_up", "_vel"];
         _unit = _this select 0;
         _veh = vehicle _unit;
         _unit action ["EJECT", _veh];
         waitUntil {(vehicle _unit != _unit) && (vehicle _unit != _veh)};
         _veh = vehicle _unit;
         _pos = getPos _veh;
         _dir  = vectorDir _veh;
         _up = vectorUp _veh;
         _vel = velocity _veh;
         deleteVehicle _veh;

         // LOOK HERE TO PUT THE CORRECT CLASS NAME OF YOUR DESIRED CHUTE
         _veh = "MAP_OPC_GU" createVehicle _pos;
         _veh setPos _pos;
         _veh setVectorDir _dir;
         _veh setVectorUp _up;
         _veh setVelocity _vel;
         _unit moveInDriver _veh;
      };
   };
};

Offline trooper543

  • Members
  • *
Re: Para Scripts in Multiplayer
« Reply #5 on: 08 Oct 2008, 16:55:53 »
Hi Mandoble

Many thanks for this, it is very much appreciated

Will test it now

thanks

***************************Edit Update***********************************************

Hi Mandoble

The script works however there is a slight hicup now and again

When the script is executed and all players are ejected sometimes they loose their para chute and the same with the ai at times when the jump out. And sometimes everyone ejects and then the chutes change from round to sqaure /or  land up without having a chute at all and then u get empty chutes in the sky

is there a chance of being able to add the Celery's para fix script into the scripts ?

Code: [Select]
;Parachute bug fix by Celery
;Fixes the issue of paratroopers losing their
;chutes prematurely and falling to their deaths
;
;Have each player exec this script in an init script or trigger

#start
~1
?vehicle player iskindof "ParachuteBase":goto "para"
goto "start"

#para
@vehicle player==player
?!alive player:goto "start"
_altlogic="Logic" createvehicle [0,0,0]
_altlogic setpos [getpos player select 0,getpos player select 1,0]
_alt=player distance _altlogic
?(getpos player select 2>1.6):player setvelocity [0,0,0];player setpos [getpos player select 0,getpos player select 1,_alt-(getpos player select 2)+1.6]
deletevehicle _altlogic
goto "start"


would it be possible to add Celerys parafix sqs into this script
« Last Edit: 09 Oct 2008, 02:29:37 by trooper543 »

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Para Scripts in Multiplayer
« Reply #6 on: 09 Oct 2008, 19:26:10 »
Try the attached version.

Offline trooper543

  • Members
  • *
Re: Para Scripts in Multiplayer (solved)
« Reply #7 on: 22 Oct 2008, 12:01:34 »
@ Mandoble

Sorry for the late response !

many thanks for this boss ! works a treat