Jump to content
Sign in to follow this  
jc984

Help Request - Halo jump/Vehicle respawn help request

Recommended Posts

Hello I am new to scripting and I have been trying to get this Halo jump script to work properly. Now It does function decently, but the issue is at vehicle respawn you will lose the "Halo Jump" option. I already tried searching and the topics i found were similar, but they were not helpful, unless i missed something reading through them all.

I have the following in the vehicle's Init field:

this addAction ["HALO JUMP","jump.sqf",[],1,false,true,"","_this in _target"]; veh = [this, 120, 0] execVM "vehicle.sqf";

My suspicion is its initialization but then on vehicle respawn it either fails to initialize or the spawn script is overriding it some how.

Here is my spawn script(got it from armaholic):

/*  
=========================================================
 Simple Vehicle Respawn Script v1.7
 by Tophe of Östgöta Ops [OOPS]

 Put this in the vehicles init line:
 veh = [this] execVM "vehicle.sqf"


 Options:
 There are some optional settings. The format for these are:
 veh = [this, Delay, Deserted timer, Respawns, Effect, Static] execVM "vehicle.sqf"


 Default respawn delay is 30 seconds, to set a custom
 respawn delay time, put that in the init as well. 
 Like this:
 veh = [this, 15] execVM "vehicle.sqf"

 Default respawn time when vehicle is deserted, but not
 destroyed is 120 seconds. To set a custom timer for this 
 first put the respawn delay, then the deserted vehicle timer. (0 = disabled)
 Like this:  
 veh = [this, 15, 10] execVM "vehicle.sqf"

 By default the number of respawns is infinite. To set a limit
 First set the other values then the number of respawns you want (0 = infinite).
 Like this:
 veh = [this, 15, 10, 5] execVM "vehicle.sqf"


 Set this value to TRUE to add a special explosion effect to the wreck when respawning.
 Default value is FALSE, which will simply have the wreck disappear.
 Like this:
 veh = [this, 15, 10, 5, TRUE] execVM "vehicle.sqf"

 By default the vehicle will respawn to the point where it first
 was when the mission started (static). This can be changed to 
 dynamic. Then the vehicle will respawn to the position where it was destroyed. 
 First set all the other values then set TRUE for dynamic or FALSE for static.
 Like this:
 veh = [this, 15, 10, 5, TRUE, TRUE] execVM "vehicle.sqf"

 If you you want to set the INIT field of the respawned vehicle, first set all other 
 values, then set init commands. Those must be inside quotations.
 Like this:
 veh = [this, 15, 10, 5, TRUE, FALSE, "this setDammage 0.5"] execVM "vehicle.sqf"

 Default values of all settings are:
 veh = [this, 30, 120, 0, FALSE, FALSE] execVM "vehicle.sqf"




Contact & Bugreport: harlechin@hotmail.com

=========================================================
*/

if (!isServer) exitWith {};

// Define variables
_unit = _this select 0;
_delay = if (count _this > 1) then {_this select 1} else {30};
_deserted = if (count _this > 2) then {_this select 2} else {120};
_respawns = if (count _this > 3) then {_this select 3} else {0};
_explode = if (count _this > 4) then {_this select 4} else {false};
_dynamic = if (count _this > 5) then {_this select 5} else {false};
_unitinit = if (count _this > 6) then {_this select 6} else {};
_haveinit = if (count _this > 6) then {true} else {false};

_hasname = false;
_unitname = vehicleVarName _unit;
if (isNil _unitname) then {_hasname = false;} else {_hasname = true;};
_noend = true;
_run = true;
_rounds = 0;

if (_delay < 0) then {_delay = 0};
if (_deserted < 0) then {_deserted = 0};
if (_respawns <= 0) then {_respawns= 0; _noend = true;};
if (_respawns > 0) then {_noend = false};

_dir = getDir _unit;
_position = getPosASL _unit;
_type = typeOf _unit;
_dead = false;
_nodelay = false;


// Start monitoring the vehicle
while {_run} do 
{	
sleep (2 + random 10);
     if ((getDammage _unit > 0.8) and ({alive _x} count crew _unit == 0)) then {_dead = true};

// Check if the vehicle is deserted.
if (_deserted > 0) then
{
	if ((getPosASL _unit distance _position > 10) and ({alive _x} count crew _unit == 0) and (getDammage _unit < 0.8)) then 
	{
		_timeout = time + _deserted;
		sleep 0.1;
	 	waitUntil {_timeout < time or !alive _unit or {alive _x} count crew _unit > 0};
		if ({alive _x} count crew _unit > 0) then {_dead = false}; 
		if ({alive _x} count crew _unit == 0) then {_dead = true; _nodelay =true}; 
		if !(alive _unit) then {_dead = true; _nodelay = false}; 
	};
};

// Respawn vehicle
     if (_dead) then 
{	
	if (_nodelay) then {sleep 0.1; _nodelay = false;} else {sleep _delay;};
	if (_dynamic) then {_position = getPosASL _unit; _dir = getDir _unit;};
	if (_explode) then {_effect = "M_TOW_AT" createVehicle getPosASL _unit; _effect setPosASL getPosASL _unit;};
	sleep 0.1;

	deleteVehicle _unit;
	sleep 2;
	_unit = _type createVehicle _position;
	_unit setPosASL _position;
	_unit setDir _dir;

	if (_haveinit) then 
				{_unit setVehicleInit format ["%1;", _unitinit];
				processInitCommands;};
	if (_hasname) then 
				{_unit setVehicleInit format ["%1 = this; this setVehicleVarName ""%1""",_unitname];
				processInitCommands;};
	_dead = false;

	// Check respawn amount
	if !(_noend) then {_rounds = _rounds + 1};
	if ((_rounds == _respawns) and !(_noend)) then {_run = false;};
};
};

now i did notice in the scrript creators explainations there is a way to add another action:

If you you want to set the INIT field of the respawned vehicle, first set all other 
 values, then set init commands. Those must be inside quotations.
 Like this:
 veh = [this, 15, 10, 5, TRUE, FALSE, "this setDammage 0.5"] execVM "vehicle.sqf"

which i tried by doing this:

 veh = [this, 120, 0, "this addAction ["HALO JUMP","jump.sqf",[],1,false,true,"","_this in _target"] execVM "vehicle.sqf"; 

And it will just say its missing a " ] " next to HALO until the move the " sign. But it will never show the halo jump menu option.

I am at a loss here and hopefully someone can point me to my mistake.

FYI: i am using the halo jump add method from kylania DOT com and I am trying to run it on my dedicated server O_o. We like to fly the aircraft ourselves and do scenarios.

Share this post


Link to post
Share on other sites

not tested but this may work.

veh = [this, 120, 0, "this addAction ['HALO JUMP','jump.sqf',[],1,false,true,'','_this in _target'];"] execVM "vehicle.sqf"

Share this post


Link to post
Share on other sites
not tested but this may work.

veh = [this, 120, 0, "this addAction ['HALO JUMP','jump.sqf',[],1,false,true,'','_this in _target'];"] execVM "vehicle.sqf"

Yea that don't bring up the halo option when put in the vehicle init. I have a feeling is something simple and stupid I am missing.

Share this post


Link to post
Share on other sites

This shows up for me, I place it in the vehicles init.

veh = [this, 15, 10, 5,true,false, "this addAction ['HALO JUMP','jump.sqf',[],1,false,true,'','_this in _target'];"] execVM "vehicle.sqf"   

you will still need the original addaction added to the vehicles init so it would be

this addAction ["HALO JUMP","jump.sqf",[],1,false,true,"","_this in _target"];veh = [this, 15, 10, 5,true,false, "this addAction ['HALO JUMP','jump.sqf',[],1,false,true,'','_this in _target'];"] execVM "vehicle.sqf"   

it only shows when in the vehicle. (not sure what the true,false does)

Share this post


Link to post
Share on other sites
This shows up for me, I place it in the vehicles init.

veh = [this, 15, 10, 5,true,false, "this addAction ['HALO JUMP','jump.sqf',[],1,false,true,'','_this in _target'];"] execVM "vehicle.sqf"   

you will still need the original addaction added to the vehicles init so it would be

this addAction ["HALO JUMP","jump.sqf",[],1,false,true,"","_this in _target"];veh = [this, 15, 10, 5,true,false, "this addAction ['HALO JUMP','jump.sqf',[],1,false,true,'','_this in _target'];"] execVM "vehicle.sqf"   

it only shows when in the vehicle. (not sure what the true,false does)

Well that 2nd works good. it keeps letting me halo every time the vehicle respawns. But now the vehicle wont crash on the ground and wait until the proper amount of time before it respawns. it will like explode in mid-air with no explosion sound and the vehicle will instantly respawn. Even after i changed back the "15" back to "120". it seems to do it randomly so dunno. but it seems to be working now pretty good. just need to test it with my teammates. We post the results here.

Share this post


Link to post
Share on other sites

yea the halo jum only works for the pilot of the vehicle and not the passengers. It will give them the option to halo jump, and kick them out of the vehicle. But after they are in the air it will not give them a "open parachute" option.

This is my jump.sqf that it calls:

player action [ "eject", vehicle player];
player spawn bis_fnc_halo;
player setvelocity [0,120*0.8,0];
player setdir 0;

while {((getposATL player)select 2) > 1} do
{
hintsilent format ["Altimeter: %1", round (getPosATL player select 2)];
};
if (((getposATL player)select 2) < 1) then
{
hintsilent "";
};

Share this post


Link to post
Share on other sites

I just tried that code while being in cargo of the chopper and it works. I can only think it's a locality issue and the reason I don't like messing with MP.

Share this post


Link to post
Share on other sites

Maybe I am not following / read correctly, but what are you attaching the addAction to? If its just a plane to start the jump, and nothing else special, you could save time and use JTK HALO.

Ignore that if I mis-read and didn't follow.

Share this post


Link to post
Share on other sites
I just tried that code while being in cargo of the chopper and it works. I can only think it's a locality issue and the reason I don't like messing with MP.

were you flying with another player? cause it seems only the pilot can successfully do it, and this is on a dedicated server.

Maybe I am not following / read correctly, but what are you attaching the addAction to? If its just a plane to start the jump, and nothing else special, you could save time and use JTK HALO.

Ignore that if I mis-read and didn't follow.

JTK halo is not what i am looking for as I am looking for something that will work on other planes/helicopters as well. And my group and I would like to practice our flying skills as well. I know this is possible as it's done on a dayz taviana server where you can halo jump out of almost anything with a extremely high success rate. But sadly the server admin who implemented it wouldn't answer me (or most likely ignoring me) when i asked if he could tell me what he did, so my group and I can practice on the dedicated server I setup so we can practice and mess around.

It's ejecting the passenger player just fine....it's just not bringing up the open parachute option.

Share this post


Link to post
Share on other sites

I can only test in SP, I just wanted to make sure it was working if I wasn't a pilot.

check this post out and the last script

http://forums.bistudio.com/showthread.php?144103-halo-script-not-working-on-dedicated-server&highlight=halo

Just another thought, do you have a function module on the map?

Edited by F2k Sel

Share this post


Link to post
Share on other sites
I can only test in SP, I just wanted to make sure it was working if I wasn't a pilot.

check this post out and the last script

http://forums.bistudio.com/showthread.php?144103-halo-script-not-working-on-dedicated-server&highlight=halo

Just another thought, do you have a function module on the map?

Yes i do have a functions module. hmmm.....so the last post. Would i put both scripts in the "jump.sqf"? or is that something completely separate? Guess I got more digging to do.

Edited by jc984

Share this post


Link to post
Share on other sites

It looks like the last calls the executes the first script, however it's setup to eject all crew - the driver.

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  

×