Jump to content
Sign in to follow this  
eggbeast

Fixing HALO / Teamswitch conflict once and for all

Recommended Posts

http://forums.bistudio.com/showthread.php?t=74177&highlight=serialization

i think this serialization issue is at the heart of why the T menu (coded to teamswitch) breaks after a HALO drop in Evolution.

I have seen many other threads on this but no satisfactory CURRENT solution.

in the blue corner the T menu

In Evo, the T menu is a vital interface for many scripted functions.

description.ext contains

#include "evoUI.hpp"

evoUI.hpp contains

class evoUI
{
idd = 100;
movingEnable = true;
enableSimulation = true;
onLoad = "initNakup = true;DlgClosed = false;[] execVM ""data\scripts\Core.sqf""";
//etc

This runs scripts/core.sqf which starts with

disableSerialization;
displayVendor = findDisplay 100;
//later has...
(FindDisplay 46) DisplaySetEventHandler ["keydown","if ((_this select 1) In actionKeys ""TeamSwitch"") then {closeDialog 0}"];

pinit.sqf (initialises player) also contains

(FindDisplay 46) DisplaySetEventHandler ["keydown","if ((_this select 1) In actionKeys ""TeamSwitch"") then {a = createDialog 'evoUI'}"];

in the red corner enter the HALO

entering within 10m of a marker triggers a sensor which adds the action "HALO" which when activated execs scripts/parajump.sqf:

parajump sqf (calls halo) contains

if (local player) then
{
PRIVATE ["_marker","_pos","_rnd","_h"];
_marker = "HaloMarker";
_rnd=Random(200);
_h=8000;
_pos = [getmarkerpos _marker select 0,getmarkerpos _marker select 1, _h+_rnd];
player setpos _pos;
[player,_h+_rnd] exec "\ca\air2\Halo\data\Scripts\HALO_init.sqs";
//fix for HALO bug
(FindDisplay 46) DisplaySetEventHandler ["keydown","if ((_this select 1) In actionKeys ""TeamSwitch"") then {a = createDialog 'evoUI'}"];
};

HALO_init.sqs calls HALO.sqs which contains these 2 lines

keyspressed = compile preprocessFile "ca\air2\halo\data\Scripts\f\keyspressed.sqf"
(findDisplay 46) displaySetEventHandler ["KeyDown","_this call keyspressed"]

halo/data/scripts/f/keyspressed.sqf contains

disableserialization;
_key = _this select 1;
_left = actionKeys "TurnLeft";
_right = actionKeys "TurnRight";
_up = actionKeys "MoveForward";
_down = actionKeys "MoveBack";
if (_key in _left) then  
{
	[] exec "ca\air2\halo\data\Scripts\f\Freefall_ChangedirL.sqs"; 
};
if (_key in _right) then  
{
	[] exec "ca\air2\halo\data\Scripts\f\Freefall_ChangedirR.sqs"; 
};
   if (_key in _up) then  
{
	BIS_HALO_unit_speed = BIS_HALO_unit_speed + 1;
};
if (_key in _down) then  
{
	BIS_HALO_unit_speed = BIS_HALO_unit_speed - 1; 
};

the original fix proposed is to reinitialise the T menu after respawn:

scripts/spawn sqf (called after death) contains this line.

//fix for HALO bug
(FindDisplay 46) DisplaySetEventHandler ["keydown","if ((_this select 1) In actionKeys ""TeamSwitch"") then {a = createDialog 'evoUI'}"];

now I'm wondering if we can't call something from parajump to monitor the player until they are no longer in a vehicle (parachute) and then run this line. this means that HALO-ing into enemy territory you could still call a precision strike on an enemy AA gun etc...

any thoughts how to do this simply? or is there more to it?

gonna have a go

---------- Post added at 03:23 PM ---------- Previous post was at 02:21 PM ----------

and the winner is...

modify parajump.sqf to detect whether the player has joined the parachute and then left it again, then reinitialise the UI...

if (local player) then
{
PRIVATE ["_marker","_pos","_rnd","_h"];

_marker = "HaloMarker";
_rnd=Random(200);
_h=8000;
_pos = [getmarkerpos _marker select 0,getmarkerpos _marker select 1, _h+_rnd];
player setpos _pos;
[player,_h+_rnd] exec "\ca\air2\Halo\data\Scripts\HALO_init.sqs";

sleep 2;
Waituntil {vehicle player != player}; //i.e. =="BIS_Steerable_Parachute"
sleep 2;
Waituntil {vehicle player == player};//i.e. left parachute
//fix for HALO bug
(FindDisplay 46) DisplaySetEventHandler ["keydown","if ((_this select 1) In actionKeys ""TeamSwitch"") then {a = createDialog 'evoUI'}"];
//hint "T menu restored! Eggbeast you da man!";
};

tested including dying on the chute, etc...

all works fine

:yay::yay:

now go on - find a problem like the script stacking over and over lol...

Edited by eggbeast

Share this post


Link to post
Share on other sites

yeah it seems to work peachy, just hoping that not putting in a check for player is dead will not leave the script running ad infinitum, and then they might stack over and over if the player keeps dying in the air (or on the ground without opening parachute). i'm keeping an eye on it to see if any strange behaviour appears.

one thing, on evo when you spawn sometimes the server doesn't initialise the player for maybe 5 secs (you have an M4 then it loads your saved weapons in) - if you HALO durting this, then the spawn HALO fix kicks in and you lose directional control of the HALO...

maybe i should put some sort of check in the spawn to see if the players pos is higher than 2000 before execing the UI init...

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  

×