Jump to content
Sign in to follow this  
crazyrobban

Halo not synced in mp?

Recommended Posts

I searched for halo related threads, but couldn't find anything about this.

I make missions for me and my friends, and I recently created a mission where we start in the air and I execute the halo script in the units init line.

However, we can never actually see each other do a halo jump.

If I put an ai soldier next to us, everyone can see him in the "free fall" animation, while all the players are simply standing in the air.

Have I overlooked anything? The halo is working fine for everyone, so it's no big issue, but it takes away a bit of the immersion when it looks so odd until we pull our chutes.

Thanks

Share this post


Link to post
Share on other sites

I rewrote the HALO function so it broadcasts the animation to all other players.

Write this in your init.sqf:

CYBP_animHalo = [];
"CYBP_animHalo" addPublicVariableEventHandler {(_this select 1) execVM "CYBP\HALO\PVEHanimHalo.sqf"};

if (isnil "bis_fnc_init") then {createcenter sidelogic; _grp = creategroup sidelogic; _logicFnc = _grp createunit ["FunctionsManager",position player,[],0,"none"];};
WaitUntil{!(isNil "bis_fnc_init")};
BIS_fnc_halo = compile preprocessFile "CYBP\HALO\fn_halo.sqf";	// override BIS function

Then create a folder CYBP and a folder HALO in it.

After this put the following scripts in it:

PVEHanimHalo.sqf:

/*
===============================================================================================
PVEHanimHalo - by Cyborg11
Version: 1.0
Date: 07.07.2010
Description: Script to broadcast the HALO animation in MP

Parameter:	CYBP_animHalo = [_unit, _anim, _cmd];
		publicVariable "CYBP_animHalo";

		_unit = object which is using HALO
		_anim = the animation
		_cmd = either "switchMove" or "playMoveNow" 
===============================================================================================
*/


_unit = _this select 0;
_anim = _this select 1;
_cmd = _this select 2;

switch (_cmd) do
{
case "switchMove" : {_unit switchMove _anim};
case "playMoveNow" : {_unit playMoveNow _anim};
};

fn_halo.sqf: http://pastebin.jonasscholz.de/900

Share this post


Link to post
Share on other sites

Sweet! Thanks a lot! :-)

I will try it as soon as I have a chance!

EDIT

Ok, I'm horrible at scripting, so I'm just taking a guess here, but the scripts you sent; they wait for the halo function to be called, override it and use your scripts, right?

If so, it shouldn't be an issue that there are more playable soldiers on the same side, that's not starting in the air?

And two, do I need to put something else in the soldiers init lines? Now, they just fall, no halo, nothing.

Does the init.sqf override the init field parameters set in the editor?

Edited by crazyrobban

Share this post


Link to post
Share on other sites

Ok, I'm horrible at scripting, so I'm just taking a guess here, but the scripts you sent; they wait for the halo function to be called, override it and use your scripts, right?

If so, it shouldn't be an issue that there are more playable soldiers on the same side, that's not starting in the air?

I override it so if you implent the fix in a mission with HALO my fix will override the original function so it will work in every mission without changing the execution of the HALO Jump :)

And two, do I need to put something else in the soldiers init lines? Now, they just fall, no halo, nothing.

You have to execute the HALO Jump :)

nul = this spawn BIS_fnc_halo;

Does the init.sqf override the init field parameters set in the editor?

No. Why it should?

Share this post


Link to post
Share on other sites

It's still not working.

My soldiers simply fall to their death.

What I used before (that was working, but not synced.)

Was a trigger, not in the soldiers init fields, so I had a trigger, that was supposed to activate in case there was a bluefor present.

And the on Act field had this:

[sol1] exec "ca\air2\halo\data\Scripts\HALO_init.sqs"; [sol2] exec "ca\air2\halo\data\Scripts\HALO_init.sqs"; [sol3] exec "ca\air2\halo\data\Scripts\HALO_init.sqs"; [sol4] exec "ca\air2\halo\data\Scripts\HALO_init.sqs";  

And that works fine, as long as I don't have the lines you sent in my init.sqf.

I tried removing the trigger, and adding "nul = this spawn BIS_fnc_halo;" in the soldiers init line, but nothing happens.

Share this post


Link to post
Share on other sites

You can execute the HALO also with:

[unit, height] exec "ca\air2\halo\data\Scripts\HALO_init.sqs"; 

The script differentiates between OA and ArmA2. If you have OA / CO then it will execute the new HALO function. Otherwise it will use the old script.

But be carefull: If you want to release your mission the OA only users can't play the mission because they don't have the Script ;)

Sorry ... the correct syntax for the new function is:

nul = [unit, altitude] spawn BIS_fnc_halo;

Oh and don't write it in the init line!

Share this post


Link to post
Share on other sites

I'm sorry for being a n00b. :-/

So, here's how it's setup right now.

*Four soldiers, named "sol1" to "sol4" is placed in the editor.

*The scripts you sent me (fn_halo & PVEHanimHalo) are placed in:

user/arma2/missions/missionname/CYBP/HALO/

*I created a init.sqf to the mission folder and pasted the code you sent

*There's a trigger surrounding the soldiers, set to "Bluefor present" for activation. And in the On Act: there is now:

[sol1, 2000] exec "ca\air2\halo\data\Scripts\HALO_init.sqs"

I also tried with:

nul = [sol1, 2000] spawn BIS_fnc_halo;

None of them did the trick? What am I missing here? :-S

Share this post


Link to post
Share on other sites

Any errors?

Make a hint in your activation line to see if the trigger triggers. :D

Share this post


Link to post
Share on other sites

Yup, it activates. The hint showed without problems.

hint "boom!"; nul = [sol1, 2000] spawn BIS_fnc_halo;

And no errors.

Share this post


Link to post
Share on other sites

Doesn't work for me too.

OMG ... I looked at the fn_halo.sqf Script.

What did you do with it? :D

Why did you add line numbers? oO

   1.
     scriptName "modules_e\Functions\objects\fn_HALO.sqf";
  2.
     /*
  3.
             File: fn_HALO.sqf
  4.
             Author: Karel Moricky
  5.

  6.
             Description:
  7.
             High Altitude Low Opening
  8.

  9.
             Parameter(s):
 10.
             _this:  ARRAY   - starts HALO jump directly
 11.
                     OBJECT  - waits until unit in array is out of vehicle
 12.

 13.
             Returns:
 14.
             Nothing
 15.
     */
 16.

 17.
     sleep 0.01;
 18.

 19.
     //--- HALO -------------------------------------------------------------------------------------------------------------------------------------
 20.
     if (typename _this == typename objnull) then {
 21.

 22.
             _unit = _this;
 23.

 24.
             //--- Eject!
 25.
             waituntil {(vehicle _unit) iskindof "ParachuteBase" || !isnil {_unit getvariable "bis_fnc_halo_now"}};
 26.
             if (!local _unit) exitwith {};
 27.

 28.
             //--- Delete parachute
 29.
             _parachute = vehicle _unit;
 30.
             if (_parachute != _unit) then {
 31.
                     deletevehicle _parachute;
 32.
             };
 33.

 34.
             //--- Init
 35.
             _dir = ([[0,0,0],velocity _unit] call bis_fnc_dirto);
 36.
             _unit setdir _dir;
 37.
             _unit switchmove "HaloFreeFall_non";
 38.
             CYBP_animHalo = [_unit, "HaloFreeFall_non", "switchMove"];
 39.
             publicVariable "CYBP_animHalo";
 40.

 41.
             //--- Key controls
 42.
             if (_unit == player) then {
 43.
                     //--- PLAYER ------------------------------------------------
 44.

 45.
                     _brightness = 0.99;
 46.
                     _pos = position player;
 47.
                     _parray = [
 48.
                     /* 00 */                ["\Ca\Data\ParticleEffects\Universal\Universal", 16, 12, 13, 0],
 49.
                     /* 01 */                "",
 50.
                     /* 02 */                "Billboard",
 51.
                     /* 03 */                1,
 52.
                     /* 04 */                3,
 53.
                     /* 05 */                [0,0,-200],
 54.
                     /* 06 */                wind,
 55.
                     /* 07 */                0,
 56.
                     /* 08 */                1.275,
 57.
                     /* 09 */                1,
 58.
                     /* 10 */                0,
 59.
                     /* 11 */                [100],
 60.
                     /* 12 */                [
 61.
                                                             [_brightness,_brightness,_brightness,0],
 62.
                                                             [_brightness,_brightness,_brightness,0.01],
 63.
                                                             [_brightness,_brightness,_brightness,0.10],
 64.
                                                             [_brightness,_brightness,_brightness,0]
 65.
                                                     ],
 66.
                     /* 13 */                [1000],
 67.
                     /* 14 */                0,
 68.
                     /* 15 */                0,
 69.
                     /* 16 */                "",
 70.
                     /* 17 */                "",
 71.
                     /* 18 */                player
 72.
                     ];
 73.
                     bis_fnc_halo_clouds = "#particlesource" createVehicleLocal _pos;  
 74.
                     bis_fnc_halo_clouds setParticleParams _parray;
 75.
                     bis_fnc_halo_clouds setParticleRandom [0, [100, 100, 0], [0, 0, 0], 0, 0, [0, 0, 0, 0], 0, 1];
 76.
                     bis_fnc_halo_clouds setParticleCircle [00, [00, 00, 00]];
 77.
                     bis_fnc_halo_clouds setDropInterval (0.4 - (0.3 * overcast));
 78.

 79.

 80.
                     //--- Effects
 81.
                     bis_fnc_halo_ppRadialBlur = ppeffectcreate ["RadialBlur",464];
 82.
                     bis_fnc_halo_ppRadialBlur ppEffectAdjust [0.01,0.01,0.3,0.3];
 83.
                     bis_fnc_halo_ppRadialBlur ppEffectCommit 0.01;
 84.
                     bis_fnc_halo_ppRadialBlur ppEffectEnable true ;
 85.
                     bis_fnc_halo_soundLoop = time;
 86.
                     playsound "BIS_HALO_Flapping";
 87.

 88.
                     bis_fnc_halo_action = _unit addaction [localize "STR_HALO_OPEN_CHUTE","ca\modules_e\Functions\misc\fn_HALO.sqf",[],1,true,true,"Eject"];
 89.

 90.
                     bis_fnc_halo_keydown = {
 91.
                             _key = _this select 1;
 92.

 93.
                             //--- Forward
 94.
                             //if (_key in (actionkeys 'HeliForward')) then {
 95.
                             if (_key in (actionkeys 'MoveForward')) then {
 96.
                                     if (bis_fnc_halo_vel < +bis_fnc_halo_velLimit) then {bis_fnc_halo_vel = bis_fnc_halo_vel + bis_fnc_halo_velAdd};
 97.
                             };
 98.

 99.
                             //--- Backward
100.
                             //if (_key in (actionkeys 'HeliBack')) then {
101.
                             if (_key in (actionkeys 'MoveBack')) then {
102.
                                     if (bis_fnc_halo_vel > -bis_fnc_halo_velLimit) then {bis_fnc_halo_vel = bis_fnc_halo_vel - bis_fnc_halo_velAdd};
103.
                             };
104.

105.
                             //--- Left
106.
                             //if (_key in (actionkeys 'HeliCyclicLeft')) then {
107.
                             if (_key in (actionkeys 'TurnLeft')) then {
108.
                                     if (bis_fnc_halo_dir > -bis_fnc_halo_dirLimit) then {bis_fnc_halo_dir = bis_fnc_halo_dir - bis_fnc_halo_dirAdd};
109.
                             };
110.

111.
                             //--- Right
112.
                             //if (_key in (actionkeys 'HeliCyclicRight')) then {
113.
                             if (_key in (actionkeys 'TurnRight')) then {
114.
                                     if (bis_fnc_halo_dir < +bis_fnc_halo_dirLimit) then {bis_fnc_halo_dir = bis_fnc_halo_dir + bis_fnc_halo_dirAdd};
115.
                             };
116.
                     };
117.
                     bis_fnc_halo_keydown_eh = (finddisplay 46) displayaddeventhandler ["keydown","_this call bis_fnc_halo_keydown;"];
118.

119.
                     //--- Loop
120.
                     bis_fnc_halo_vel = 0;
121.
                     bis_fnc_halo_velLimit = 0.2;
122.
                     bis_fnc_halo_velAdd = 0.03;
123.
                     bis_fnc_halo_dir = 0;
124.
                     bis_fnc_halo_dirLimit = 1;
125.
                     bis_fnc_halo_dirAdd = 0.06;
126.

127.
                     [] spawn {
128.
                             _time = time - 0.1;
129.
                             while {alive player && vehicle player == player && isnil {player getvariable "bis_fnc_halo_terminate"}} do {
130.

131.
                                     //--- FPS counter
132.
                                     _fpsCoef = ((time - _time) * 60) / acctime; //Script is optimized for 60 FPS
133.
                                     _time = time;
134.

135.
                                     bis_fnc_halo_velLimit = 0.2 * _fpsCoef;
136.
                                     bis_fnc_halo_velAdd = 0.03 * _fpsCoef;
137.
                                     bis_fnc_halo_dirLimit = 1 * _fpsCoef;
138.
                                     bis_fnc_halo_dirAdd = 0.06 * _fpsCoef;
139.

140.
                                     //--- Dir
141.
                                     bis_fnc_halo_dir = bis_fnc_halo_dir * 0.98;
142.
                                     _dir = direction player + bis_fnc_halo_dir;
143.
                                     player setdir _dir;
144.

145.
                                     //--- Velocity
146.
                                     _vel = velocity player;
147.
                                     bis_fnc_halo_vel = bis_fnc_halo_vel * 0.96;
148.
                                     player setvelocity [
149.
                                             (_vel select 0) + (sin _dir * bis_fnc_halo_vel),
150.
                                             (_vel select 1) + (cos _dir * bis_fnc_halo_vel),
151.
                                             (_vel select 2)
152.
                                     ];
153.

154.
                                     //--- Animation system
155.
                                     _anim = "HaloFreeFall_non";
156.
                                     _v = bis_fnc_halo_vel;
157.
                                     _h = bis_fnc_halo_dir;
158.

159.
                                     _vLimit = 0.1;
160.
                                     _hLimit = 0.3;
161.
                                     if ((abs _v) > _vLimit || (abs _h) > _hLimit) then {
162.
                                             _vAnim = "";
163.
                                             if (_v > +_vLimit) then {_vAnim = "F"};
164.
                                             if (_v < -_vLimit) then {_vAnim = "B"};
165.
                                             _hAnim = "";
166.
                                             if (_h > +_hLimit) then {_hAnim = "R"};
167.
                                             if (_h < -_hLimit) then {_hAnim = "L"};
168.
                                             _anim = "HaloFreeFall_" + _vAnim + _hAnim;
169.
                                     };
170.

171.
                                     player playmovenow _anim;
172.
                                     CYBP_animHalo = [player, _anim, "playMoveNow"];
173.
                                     publicVariable "CYBP_animHalo";
174.

175.

176.
                                     //--- Sound
177.
                                     if ((time - bis_fnc_halo_soundLoop) > 4.5) then {
178.
                                             playsound "BIS_HALO_Flapping";
179.
                                             bis_fnc_halo_soundLoop = time;
180.
                                     };
181.

182.
                                     //--- Effects
183.
                                     bis_fnc_halo_ppRadialBlur ppEffectAdjust [0.02,0.02,0.3 - (bis_fnc_halo_vel/7)/_fpsCoef,0.3 - (bis_fnc_halo_vel/7)/_fpsCoef];
184.
                                     bis_fnc_halo_ppRadialBlur ppEffectCommit 0.01;
185.
                                     sleep 0.01;
186.
                             };
187.
                             //--- End
188.
                             player removeaction bis_fnc_halo_action;
189.
                             (finddisplay 46) displayremoveeventhandler ["keydown",bis_fnc_halo_keydown_eh];
190.
                             ppeffectdestroy bis_fnc_halo_ppRadialBlur;
191.
                             deletevehicle bis_fnc_halo_clouds;
192.

193.
                             bis_fnc_halo_clouds = nil;
194.
                             bis_fnc_halo_vel = nil;
195.
                             bis_fnc_halo_velLimit = nil;
196.
                             bis_fnc_halo_velAdd = nil;
197.
                             bis_fnc_halo_dir = nil;
198.
                             bis_fnc_halo_dirLimit = nil;
199.
                             bis_fnc_halo_dirAdd = nil;
200.
                             bis_fnc_halo_action = nil;
201.
                             bis_fnc_halo_keydown = nil;
202.
                             bis_fnc_halo_keydown_eh = nil;
203.

204.
                             if (!alive player) then {
205.
                                     player switchmove "adthppnemstpsraswrfldnon_1";
206.
                                     CYBP_animHalo = [player, "adthppnemstpsraswrfldnon_1", "switchMove"];
207.
                                     publicVariable "CYBP_animHalo";
208.

209.
                                     player setvelocity [0,0,0];
210.
                                     CYBP_setVel = [player, [0,0,0]];
211.
                                     publicVariable "CYBP_setVel";
212.
                             };
213.
                     };
214.
             } else {
215.
                     //--- AI ------------------------------------------------
216.
                     while {(position _unit select 2) > 100} do {
217.
                             _destination = expecteddestination _unit select 0;
218.
                             if (_destination distance [position _unit select 0,position _unit select 1,0] > 10) then {
219.
                                     _vel = velocity _unit;
220.
                                     _dirTo = [_unit,_destination] call bis_fnc_dirto;
221.
                                     if (player distance _unit > 500) then {
222.
                                             _unit setdir _dirTo;
223.
                                     };
224.
                                     _unit setvelocity [
225.
                                             (_vel select 0) + (sin _dirTo * 0.2),
226.
                                             (_vel select 1) + (cos _dirTo * 0.2),
227.
                                             (_vel select 2)
228.
                                     ];
229.
                             };
230.
                             sleep 0.01;
231.
                     };
232.

233.
                     //--- Open
234.
                     [_unit] spawn bis_fnc_halo;
235.
             };
236.
     };
237.

238.
     //--- PARA -------------------------------------------------------------------------------------------------------------------------------------
239.
     if (typename _this == typename []) then {
240.

241.
             _unit = _this select 0;
242.
             if (!local _unit) exitwith {};
243.

244.
             //--- Free fall
245.
             if (count _this == 2) exitwith {
246.
                     _alt = _this select 1;
247.
                     _unit setpos [position _unit select 0,position _unit select 1,_alt];
248.
                     _unit setvariable ["bis_fnc_halo_now",true];
249.
                     _unit spawn bis_fnc_halo;
250.
             };
251.
             //-------------
252.

253.
             _para = "ParachuteC" createVehicle position _unit;
254.
             //_para = "BIS_Steerable_Parachute" createVehicle position _unit;
255.
             _para setpos position _unit;
256.
             _para setdir direction _unit;
257.
             _vel = velocity _unit;
258.
             _unit moveindriver _para;
259.
             //_unit moveingunner _para;
260.
             _para lock false;
261.

262.
             bis_fnc_halo_para_dirAbs = direction _para;
263.

264.
             //--- Key controls
265.
             if (_unit == player) then {
266.
                     _para setvelocity [(_vel select 0),(_vel select 1),(_vel select 2)*1];
267.

268.
                     bis_fnc_halo_DynamicBlur = ppeffectcreate ["DynamicBlur",464];
269.
                     bis_fnc_halo_DynamicBlur ppEffectEnable true;
270.
                     bis_fnc_halo_DynamicBlur ppEffectAdjust [8.0];
271.
                     bis_fnc_halo_DynamicBlur ppEffectCommit 0;
272.
                     bis_fnc_halo_DynamicBlur ppEffectAdjust [0.0];
273.
                     bis_fnc_halo_DynamicBlur ppEffectCommit 1;
274.

275.
                     bis_fnc_halo_para_vel = 0;
276.
                     bis_fnc_halo_para_velLimit = 0.5;
277.
                     bis_fnc_halo_para_velAdd = 0.01;
278.
                     bis_fnc_halo_para_dir = 0;
279.
                     bis_fnc_halo_para_dirLimit = 1.5;
280.
                     bis_fnc_halo_para_dirAdd = 0.03;
281.

282.
                     bis_fnc_halo_para_keydown = {
283.
                             _key = _this select 1;
284.

285.
                             //--- Forward
286.
                             if (_key in (actionkeys 'MoveForward')) then {
287.
                                     if (bis_fnc_halo_para_vel < +bis_fnc_halo_para_velLimit) then {bis_fnc_halo_para_vel = bis_fnc_halo_para_vel + bis_fnc_halo_para_velAdd};
288.
                             };
289.

290.
                             //--- Backward
291.
                             if (_key in (actionkeys 'MoveBack')) then {
292.
                                     if (bis_fnc_halo_para_vel > -bis_fnc_halo_para_velLimit*0) then {bis_fnc_halo_para_vel = bis_fnc_halo_para_vel - bis_fnc_halo_para_velAdd};
293.
                             };
294.

295.
                             //--- Left
296.
                             if (_key in (actionkeys 'TurnLeft')) then {
297.
                                     if (bis_fnc_halo_para_dir > -bis_fnc_halo_para_dirLimit) then {bis_fnc_halo_para_dir = bis_fnc_halo_para_dir - bis_fnc_halo_para_dirAdd};
298.
                             };
299.

300.
                             //--- Right
301.
                             if (_key in (actionkeys 'TurnRight')) then {
302.
                                     if (bis_fnc_halo_para_dir < +bis_fnc_halo_para_dirLimit) then {bis_fnc_halo_para_dir = bis_fnc_halo_para_dir + bis_fnc_halo_para_dirAdd};
303.
                             };
304.
                     };
305.
                     bis_fnc_halo_para_loop_time = time - 0.1;
306.
                     bis_fnc_halo_para_velZ = velocity _para select 2;
307.
                     bis_fnc_halo_para_loop = {
308.
                                     if (!isnil {player getvariable "bis_fnc_halo_terminate"}) exitwith {};
309.
                                     if (time == bis_fnc_halo_para_loop_time) exitwith {}; //--- FPS too high
310.

311.
                                     _para = vehicle player;
312.

313.
                                     //--- FPS counter
314.
                                     _fpsCoef = ((time - bis_fnc_halo_para_loop_time) * 20) / acctime; //Script is optimized for 20 FPS
315.
                                     bis_fnc_halo_para_loop_time = time;
316.

317.
                                     //_fpsCoef = _fpsCoef / 3;
318.
                                     bis_fnc_halo_para_velLimit = 0.3 * _fpsCoef;
319.
                                     bis_fnc_halo_para_velAdd = 0.002 * _fpsCoef;
320.
                                     bis_fnc_halo_para_dirLimit = 1.5 * _fpsCoef;
321.
                                     bis_fnc_halo_para_dirAdd = 0.03 * _fpsCoef;
322.

323.
                                     //--- Dir
324.
                                     bis_fnc_halo_para_dir = bis_fnc_halo_para_dir * 0.98;
325.
                                     bis_fnc_halo_para_dirAbs = bis_fnc_halo_para_dirAbs + bis_fnc_halo_para_dir;
326.
                                     _para setdir bis_fnc_halo_para_dirAbs;
327.
                                     _dir = direction _para;
328.

329.
                                     //--- Crash
330.
                                     _velZ = velocity _para select 2;
331.
                                     if ((_velZ - bis_fnc_halo_para_velZ) > 7 && (getposatl _para select 2) < 100) then {player setdamage 1;debuglog ["Log::::::::::::::",(_velZ - bis_fnc_halo_para_velZ)];};
332.
                                     bis_fnc_halo_para_velZ = _velZ;
333.

334.
                                     //--- Pos
335.
                                     _para setposasl [
336.
                                             (getposasl _para select 0) + (sin _dir * (0.1 + bis_fnc_halo_para_vel)),
337.
                                             (getposasl _para select 1) + (cos _dir * (0.1 + bis_fnc_halo_para_vel)),
338.
                                             (getposasl _para select 2) - 0.01 - 0.1 * abs bis_fnc_halo_para_vel
339.
                                     ];
340.

341.
                                     [
342.
                                             _para,
343.
                                             (-bis_fnc_halo_para_vel * 75) + 0.5*(sin (time * 180)),
344.
                                             (+bis_fnc_halo_para_dir * 25) + 0.5*(cos (time * 180))
345.
                                     ] call bis_fnc_setpitchbank;
346.
                     };
347.

348.
                     bis_fnc_halo_para_mousemoving_eh = (finddisplay 46) displayaddeventhandler ["mousemoving","_this call bis_fnc_halo_para_loop;"];
349.
                     bis_fnc_halo_para_mouseholding_eh = (finddisplay 46) displayaddeventhandler ["mouseholding","_this call bis_fnc_halo_para_loop;"];
350.

351.
                     sleep 4;
352.

353.
                     ppeffectdestroy bis_fnc_halo_DynamicBlur;
354.
                     bis_fnc_halo_para_keydown_eh = (finddisplay 46) displayaddeventhandler ["keydown","_this call bis_fnc_halo_para_keydown;"];
355.

356.
                     //--- End
357.
                     //waituntil {vehicle player == player};
358.
                     player setvariable ["bis_fnc_halo_terminate",nil];
359.
                     waituntil {(position vehicle player select 2) < 2 || !isnil {player getvariable "bis_fnc_halo_terminate"}};
360.
                     (finddisplay 46) displayremoveeventhandler ["keydown",bis_fnc_halo_para_keydown_eh];
361.
                     (finddisplay 46) displayremoveeventhandler ["mousemoving",bis_fnc_halo_para_mousemoving_eh];
362.
                     (finddisplay 46) displayremoveeventhandler ["mouseholding",bis_fnc_halo_para_mouseholding_eh];
363.

364.
                     bis_fnc_halo_para_vel = nil;
365.
                     bis_fnc_halo_para_velLimit = nil;
366.
                     bis_fnc_halo_para_velAdd = nil;
367.
                     bis_fnc_halo_para_dir = nil;
368.
                     bis_fnc_halo_para_dirLimit = nil;
369.
                     bis_fnc_halo_para_dirAdd = nil;
370.
                     bis_fnc_halo_para_keydown = nil;
371.
                     bis_fnc_halo_para_loop = nil;
372.
                     bis_fnc_halo_para_keydown_eh = nil;
373.
                     bis_fnc_halo_para_mousemoving_eh = nil;
374.
                     bis_fnc_halo_para_mouseholding_eh = nil;
375.
             };
376.
     };

Here is the correct script. You made the mistake ^^:

scriptName "modules_e\Functions\objects\fn_HALO.sqf";
/*
File: fn_HALO.sqf
Author: Karel Moricky

Description:
High Altitude Low Opening

Parameter(s):
_this:	ARRAY	- starts HALO jump directly
	OBJECT	- waits until unit in array is out of vehicle

Returns:
Nothing
*/

sleep 0.01;

//--- HALO -------------------------------------------------------------------------------------------------------------------------------------
if (typename _this == typename objnull) then {

_unit = _this;

//--- Eject!
waituntil {(vehicle _unit) iskindof "ParachuteBase" || !isnil {_unit getvariable "bis_fnc_halo_now"}};
if (!local _unit) exitwith {};

//--- Delete parachute
_parachute = vehicle _unit;
if (_parachute != _unit) then {
	deletevehicle _parachute;
};

//--- Init
_dir = ([[0,0,0],velocity _unit] call bis_fnc_dirto);
_unit setdir _dir;
_unit switchmove "HaloFreeFall_non";
CYBP_animHalo = [_unit, "HaloFreeFall_non", "switchMove"];
publicVariable "CYBP_animHalo";

//--- Key controls
if (_unit == player) then {
	//--- PLAYER ------------------------------------------------

	_brightness = 0.99;
	_pos = position player;
	_parray = [
	/* 00 */		["\Ca\Data\ParticleEffects\Universal\Universal", 16, 12, 13, 0],
	/* 01 */		"",
	/* 02 */		"Billboard",
	/* 03 */		1,
	/* 04 */		3,
	/* 05 */		[0,0,-200],
	/* 06 */		wind,
	/* 07 */		0,
	/* 08 */		1.275,
	/* 09 */		1,
	/* 10 */		0,
	/* 11 */		[100],
	/* 12 */		[
						[_brightness,_brightness,_brightness,0],
						[_brightness,_brightness,_brightness,0.01],
						[_brightness,_brightness,_brightness,0.10],
						[_brightness,_brightness,_brightness,0]
					],
	/* 13 */		[1000],
	/* 14 */		0,
	/* 15 */		0,
	/* 16 */		"",
	/* 17 */		"",
	/* 18 */		player
	];
	bis_fnc_halo_clouds = "#particlesource" createVehicleLocal _pos;  
	bis_fnc_halo_clouds setParticleParams _parray;
	bis_fnc_halo_clouds setParticleRandom [0, [100, 100, 0], [0, 0, 0], 0, 0, [0, 0, 0, 0], 0, 1];
	bis_fnc_halo_clouds setParticleCircle [00, [00, 00, 00]];
	bis_fnc_halo_clouds setDropInterval (0.4 - (0.3 * overcast));


	//--- Effects
	bis_fnc_halo_ppRadialBlur = ppeffectcreate ["RadialBlur",464];
	bis_fnc_halo_ppRadialBlur ppEffectAdjust [0.01,0.01,0.3,0.3];
	bis_fnc_halo_ppRadialBlur ppEffectCommit 0.01;
	bis_fnc_halo_ppRadialBlur ppEffectEnable true ; 
	bis_fnc_halo_soundLoop = time;
	playsound "BIS_HALO_Flapping";

	bis_fnc_halo_action = _unit addaction [localize "STR_HALO_OPEN_CHUTE","ca\modules_e\Functions\misc\fn_HALO.sqf",[],1,true,true,"Eject"];

	bis_fnc_halo_keydown = {
		_key = _this select 1;

		//--- Forward
		//if (_key in (actionkeys 'HeliForward')) then {
		if (_key in (actionkeys 'MoveForward')) then {
			if (bis_fnc_halo_vel < +bis_fnc_halo_velLimit) then {bis_fnc_halo_vel = bis_fnc_halo_vel + bis_fnc_halo_velAdd};
		};

		//--- Backward
		//if (_key in (actionkeys 'HeliBack')) then {
		if (_key in (actionkeys 'MoveBack')) then {
			if (bis_fnc_halo_vel > -bis_fnc_halo_velLimit) then {bis_fnc_halo_vel = bis_fnc_halo_vel - bis_fnc_halo_velAdd};
		};

		//--- Left
		//if (_key in (actionkeys 'HeliCyclicLeft')) then {
		if (_key in (actionkeys 'TurnLeft')) then {
			if (bis_fnc_halo_dir > -bis_fnc_halo_dirLimit) then {bis_fnc_halo_dir = bis_fnc_halo_dir - bis_fnc_halo_dirAdd};
		};

		//--- Right
		//if (_key in (actionkeys 'HeliCyclicRight')) then {
		if (_key in (actionkeys 'TurnRight')) then {
			if (bis_fnc_halo_dir < +bis_fnc_halo_dirLimit) then {bis_fnc_halo_dir = bis_fnc_halo_dir + bis_fnc_halo_dirAdd};
		};
	};
	bis_fnc_halo_keydown_eh = (finddisplay 46) displayaddeventhandler ["keydown","_this call bis_fnc_halo_keydown;"];

	//--- Loop
	bis_fnc_halo_vel = 0;
	bis_fnc_halo_velLimit = 0.2;
	bis_fnc_halo_velAdd = 0.03;
	bis_fnc_halo_dir = 0;
	bis_fnc_halo_dirLimit = 1;
	bis_fnc_halo_dirAdd = 0.06;

	[] spawn {
		_time = time - 0.1;
		while {alive player && vehicle player == player && isnil {player getvariable "bis_fnc_halo_terminate"}} do {

			//--- FPS counter
			_fpsCoef = ((time - _time) * 60) / acctime; //Script is optimized for 60 FPS
			_time = time;

			bis_fnc_halo_velLimit = 0.2 * _fpsCoef;
			bis_fnc_halo_velAdd = 0.03 * _fpsCoef;
			bis_fnc_halo_dirLimit = 1 * _fpsCoef;
			bis_fnc_halo_dirAdd = 0.06 * _fpsCoef;

			//--- Dir
			bis_fnc_halo_dir = bis_fnc_halo_dir * 0.98;
			_dir = direction player + bis_fnc_halo_dir;
			player setdir _dir;

			//--- Velocity
			_vel = velocity player;
			bis_fnc_halo_vel = bis_fnc_halo_vel * 0.96;
			player setvelocity [
				(_vel select 0) + (sin _dir * bis_fnc_halo_vel),
				(_vel select 1) + (cos _dir * bis_fnc_halo_vel),
				(_vel select 2)
			];

			//--- Animation system
			_anim = "HaloFreeFall_non";
			_v = bis_fnc_halo_vel;
			_h = bis_fnc_halo_dir;

			_vLimit = 0.1;
			_hLimit = 0.3;
			if ((abs _v) > _vLimit || (abs _h) > _hLimit) then {
				_vAnim = "";
				if (_v > +_vLimit) then {_vAnim = "F"};
				if (_v < -_vLimit) then {_vAnim = "B"};
				_hAnim = "";
				if (_h > +_hLimit) then {_hAnim = "R"};
				if (_h < -_hLimit) then {_hAnim = "L"};
				_anim = "HaloFreeFall_" + _vAnim + _hAnim;
			};

			player playmovenow _anim;
			CYBP_animHalo = [player, _anim, "playMoveNow"];
			publicVariable "CYBP_animHalo";


			//--- Sound
			if ((time - bis_fnc_halo_soundLoop) > 4.5) then {
				playsound "BIS_HALO_Flapping";
				bis_fnc_halo_soundLoop = time;
			};

			//--- Effects
			bis_fnc_halo_ppRadialBlur ppEffectAdjust [0.02,0.02,0.3 - (bis_fnc_halo_vel/7)/_fpsCoef,0.3 - (bis_fnc_halo_vel/7)/_fpsCoef];
			bis_fnc_halo_ppRadialBlur ppEffectCommit 0.01;
			sleep 0.01;
		};
		//--- End
		player removeaction bis_fnc_halo_action;
		(finddisplay 46) displayremoveeventhandler ["keydown",bis_fnc_halo_keydown_eh];
		ppeffectdestroy bis_fnc_halo_ppRadialBlur;
		deletevehicle bis_fnc_halo_clouds;

		bis_fnc_halo_clouds = nil;
		bis_fnc_halo_vel = nil;
		bis_fnc_halo_velLimit = nil;
		bis_fnc_halo_velAdd = nil;
		bis_fnc_halo_dir = nil;
		bis_fnc_halo_dirLimit = nil;
		bis_fnc_halo_dirAdd = nil;
		bis_fnc_halo_action = nil;
		bis_fnc_halo_keydown = nil;
		bis_fnc_halo_keydown_eh = nil;

		if (!alive player) then {
			player switchmove "adthppnemstpsraswrfldnon_1";
			CYBP_animHalo = [player, "adthppnemstpsraswrfldnon_1", "switchMove"];
			publicVariable "CYBP_animHalo";

			player setvelocity [0,0,0];
			CYBP_setVel = [player, [0,0,0]];
			publicVariable "CYBP_setVel";
		};
	};
} else {
	//--- AI ------------------------------------------------
	while {(position _unit select 2) > 100} do {
		_destination = expecteddestination _unit select 0;
		if (_destination distance [position _unit select 0,position _unit select 1,0] > 10) then {
			_vel = velocity _unit;
			_dirTo = [_unit,_destination] call bis_fnc_dirto;
			if (player distance _unit > 500) then {
				_unit setdir _dirTo;
			};
			_unit setvelocity [
				(_vel select 0) + (sin _dirTo * 0.2),
				(_vel select 1) + (cos _dirTo * 0.2),
				(_vel select 2)
			];
		};
		sleep 0.01;
	};

	//--- Open
	[_unit] spawn bis_fnc_halo;
};
};

//--- PARA -------------------------------------------------------------------------------------------------------------------------------------
if (typename _this == typename []) then {

_unit = _this select 0;
if (!local _unit) exitwith {};

//--- Free fall
if (count _this == 2) exitwith {
	_alt = _this select 1;
	_unit setpos [position _unit select 0,position _unit select 1,_alt];
	_unit setvariable ["bis_fnc_halo_now",true];
	_unit spawn bis_fnc_halo;
};
//-------------

_para = "ParachuteC" createVehicle position _unit;
//_para = "BIS_Steerable_Parachute" createVehicle position _unit;
_para setpos position _unit;
_para setdir direction _unit;
_vel = velocity _unit;
_unit moveindriver _para;
//_unit moveingunner _para;
_para lock false;

bis_fnc_halo_para_dirAbs = direction _para;

//--- Key controls
if (_unit == player) then {
	_para setvelocity [(_vel select 0),(_vel select 1),(_vel select 2)*1];

	bis_fnc_halo_DynamicBlur = ppeffectcreate ["DynamicBlur",464];
	bis_fnc_halo_DynamicBlur ppEffectEnable true;
	bis_fnc_halo_DynamicBlur ppEffectAdjust [8.0];
	bis_fnc_halo_DynamicBlur ppEffectCommit 0;
	bis_fnc_halo_DynamicBlur ppEffectAdjust [0.0];
	bis_fnc_halo_DynamicBlur ppEffectCommit 1;

	bis_fnc_halo_para_vel = 0;
	bis_fnc_halo_para_velLimit = 0.5;
	bis_fnc_halo_para_velAdd = 0.01;
	bis_fnc_halo_para_dir = 0;
	bis_fnc_halo_para_dirLimit = 1.5;
	bis_fnc_halo_para_dirAdd = 0.03;

	bis_fnc_halo_para_keydown = {
		_key = _this select 1;

		//--- Forward
		if (_key in (actionkeys 'MoveForward')) then {
			if (bis_fnc_halo_para_vel < +bis_fnc_halo_para_velLimit) then {bis_fnc_halo_para_vel = bis_fnc_halo_para_vel + bis_fnc_halo_para_velAdd};
		};

		//--- Backward
		if (_key in (actionkeys 'MoveBack')) then {
			if (bis_fnc_halo_para_vel > -bis_fnc_halo_para_velLimit*0) then {bis_fnc_halo_para_vel = bis_fnc_halo_para_vel - bis_fnc_halo_para_velAdd};
		};

		//--- Left
		if (_key in (actionkeys 'TurnLeft')) then {
			if (bis_fnc_halo_para_dir > -bis_fnc_halo_para_dirLimit) then {bis_fnc_halo_para_dir = bis_fnc_halo_para_dir - bis_fnc_halo_para_dirAdd};
		};

		//--- Right
		if (_key in (actionkeys 'TurnRight')) then {
			if (bis_fnc_halo_para_dir < +bis_fnc_halo_para_dirLimit) then {bis_fnc_halo_para_dir = bis_fnc_halo_para_dir + bis_fnc_halo_para_dirAdd};
		};
	};
	bis_fnc_halo_para_loop_time = time - 0.1;
	bis_fnc_halo_para_velZ = velocity _para select 2;
	bis_fnc_halo_para_loop = {
			if (!isnil {player getvariable "bis_fnc_halo_terminate"}) exitwith {};
			if (time == bis_fnc_halo_para_loop_time) exitwith {}; //--- FPS too high

			_para = vehicle player;

			//--- FPS counter
			_fpsCoef = ((time - bis_fnc_halo_para_loop_time) * 20) / acctime; //Script is optimized for 20 FPS
			bis_fnc_halo_para_loop_time = time;

			//_fpsCoef = _fpsCoef / 3;
			bis_fnc_halo_para_velLimit = 0.3 * _fpsCoef;
			bis_fnc_halo_para_velAdd = 0.002 * _fpsCoef;
			bis_fnc_halo_para_dirLimit = 1.5 * _fpsCoef;
			bis_fnc_halo_para_dirAdd = 0.03 * _fpsCoef;

			//--- Dir
			bis_fnc_halo_para_dir = bis_fnc_halo_para_dir * 0.98;
			bis_fnc_halo_para_dirAbs = bis_fnc_halo_para_dirAbs + bis_fnc_halo_para_dir;
			_para setdir bis_fnc_halo_para_dirAbs;
			_dir = direction _para;

			//--- Crash
			_velZ = velocity _para select 2;
			if ((_velZ - bis_fnc_halo_para_velZ) > 7 && (getposatl _para select 2) < 100) then {player setdamage 1;debuglog ["Log::::::::::::::",(_velZ - bis_fnc_halo_para_velZ)];};
			bis_fnc_halo_para_velZ = _velZ;

			//--- Pos
			_para setposasl [
				(getposasl _para select 0) + (sin _dir * (0.1 + bis_fnc_halo_para_vel)),
				(getposasl _para select 1) + (cos _dir * (0.1 + bis_fnc_halo_para_vel)),
				(getposasl _para select 2) - 0.01 - 0.1 * abs bis_fnc_halo_para_vel
			];

			[
				_para,
				(-bis_fnc_halo_para_vel * 75) + 0.5*(sin (time * 180)),
				(+bis_fnc_halo_para_dir * 25) + 0.5*(cos (time * 180))
			] call bis_fnc_setpitchbank;
	};

	bis_fnc_halo_para_mousemoving_eh = (finddisplay 46) displayaddeventhandler ["mousemoving","_this call bis_fnc_halo_para_loop;"];
	bis_fnc_halo_para_mouseholding_eh = (finddisplay 46) displayaddeventhandler ["mouseholding","_this call bis_fnc_halo_para_loop;"];

	sleep 4;

	ppeffectdestroy bis_fnc_halo_DynamicBlur;
	bis_fnc_halo_para_keydown_eh = (finddisplay 46) displayaddeventhandler ["keydown","_this call bis_fnc_halo_para_keydown;"];

	//--- End
	//waituntil {vehicle player == player};
	player setvariable ["bis_fnc_halo_terminate",nil];
	waituntil {(position vehicle player select 2) < 2 || !isnil {player getvariable "bis_fnc_halo_terminate"}};
	(finddisplay 46) displayremoveeventhandler ["keydown",bis_fnc_halo_para_keydown_eh];
	(finddisplay 46) displayremoveeventhandler ["mousemoving",bis_fnc_halo_para_mousemoving_eh];
	(finddisplay 46) displayremoveeventhandler ["mouseholding",bis_fnc_halo_para_mouseholding_eh];

	bis_fnc_halo_para_vel = nil;
	bis_fnc_halo_para_velLimit = nil;
	bis_fnc_halo_para_velAdd = nil;
	bis_fnc_halo_para_dir = nil;
	bis_fnc_halo_para_dirLimit = nil;
	bis_fnc_halo_para_dirAdd = nil;
	bis_fnc_halo_para_keydown = nil;
	bis_fnc_halo_para_loop = nil;
	bis_fnc_halo_para_keydown_eh = nil;
	bis_fnc_halo_para_mousemoving_eh = nil;
	bis_fnc_halo_para_mouseholding_eh = nil;
};
};

=> http://pastebin.jonasscholz.de/900

Edited by Cyborg11

Share this post


Link to post
Share on other sites

LOL!

And here I thought I made sure I didn't copy the line numbers >_<

--

Ok, so it works now...

Thanks, and thanks again for not stating the obvious and calling me an idiot ;-)

Edited by crazyrobban

Share this post


Link to post
Share on other sites

Cyb, please repastebin your script.

edit: nm, I see it above. Duh.

edit2: CYB, is your halo script is pulled directly from bi_fnc_halo? Any idea why the player is inserted into "ParachuteC" instead of a steerable chute? Avoiding the eject from steerable bug?

Edited by Mr.Peanut
large brown trout

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  

×