Jump to content
Sign in to follow this  
Gunnykat

How do you set height on detatch

Recommended Posts

Using this script how would I raise and lower height on detatch

// mount_vcl_init.sqf
// © JUNE 2009 - norrin (norrin@iinet.net.au)
/*
Name playable units and vehicle in the editor
Put this in the init line of the vehicle in the editor: nul = [this] execVM "tow\mount_vcl_init.sqf";
*/

_vcl 		= _this select 0;
_typeOfVcl	= _this select 1;
_c 			= 0;
_load = _vcl addAction ["conect", "tow\mount_vcl.sqf", _typeOfVcl, 0, false, true];
_unload = _vcl addAction ["disconect", "tow\dismount_vcl.sqf","", 0, false, true];
_toAttach 	= objNull;
_vcl removeAction _load;
_vcl removeAction _unload;

if (isServer) then
{
_vcl setVariable ["NORRN_mountOn_vcl_pos0", [false, _toAttach], true];
sleep 2;
};
while {alive _vcl} do
{ 
if (!((_vcl getVariable "NORRN_mountOn_vcl_pos0") select 0) && _c == 0 && count (nearestObjects [_vcl, ["Plane"], 30]) > 0 && count (nearestObjects [_vcl, [_typeOfVcl], 30]) > 0) then
{	
	_load = _vcl addAction ["conect", "tow\mount_vcl.sqf", _typeOfVcl, 0, false, true];
	_vcl removeAction _unload;
	_c = 1;
};

if (((_vcl getVariable "NORRN_mountOn_vcl_pos0") select 0) && _c == 1) then
{	
	_unload = _vcl addAction ["disconect", "tow\dismount_vcl.sqf","", 0, false, true];
	_vcl removeAction _load;
	_c = 0;
};
if (count (nearestObjects [_vcl, ["Plane"], 30]) == 0 || count (nearestObjects [_vcl, [_typeOfVcl], 30]) == 0) then
{
	_vcl removeAction _load;
	_vcl removeAction _unload;
	if (!((_vcl getVariable "NORRN_mountOn_vcl_pos0") select 0)) then {_c = 0};
	if ((_vcl getVariable "NORRN_mountOn_vcl_pos0") select 0) then {_c = 1};
};	
//hint format ["%1", (_vcl getVariable "NORRN_mountOn_vcl_pos0")];
sleep 2;
};
if (!alive _vcl) exitWith {};



// dismount_vcl.sqf
// © JUNE 2009 - norrin (norrin@iinet.net.au)

_vcl 			= _this select 0;
_caller			= _this select 1;
_mountVcl		= (_vcl getVariable "NORRN_mountOn_vcl_pos0") select 1;
_vclDir			= getDir _vcl;


if (vehicle player == player) then 
{	
detach _mountVcl;
_mountVcl setPos [(getPos _vcl select 0) - (15 * sin _vclDir), (getPos _vcl select 1) - (15 * cos _vclDir),0];
_vcl setVariable ["NORRN_mountOn_vcl_pos0", [false, objNull], true];
};

if (true) exitWith {};

// mount_vcl.sqf
// © JUNE 2009 - norrin (norrin@iinet.net.au)

_vcl 			= _this select 0;
_caller			= _this select 1;
_typeOfVcl		= _this select 3;
_dir			= getdir _vcl;
_mountVcl 		= objNull; 
_blogs			= 0; 
_c				= 0;

if (count nearestObjects [player, [_typeOfVcl], 30] > 0) then
{
_mountVcl = nearestObjects [player, [_typeOfVcl], 30] select 0;
}; 

if (vehicle _caller != _caller) then {_caller action ["GetOut", vehicle _caller]; sleep 1};

if (!((_vcl getVariable "NORRN_mountOn_vcl_pos0") select 0)) then
{	
_mountVcl attachTo [_vcl,[0,-8.50,1.50]]; 
sleep 0.1;
_vcl setVariable ["NORRN_mountOn_vcl_pos0", [true, _mountVcl], true];
};

if (true) exitWith {};

---------- Post added at 01:05 AM ---------- Previous post was at 12:23 AM ----------

This is for my tow car on the LHD just to let you know.

Share this post


Link to post
Share on other sites

I honestly haven't used the script and haven't looked at it to figure it out too in-depth just now but here's a quick thought:

Edit the last variable here (the 0) to the height you want, in this line on the dismount code:

_mountVcl setPos [(getPos _vcl select 0) - (15 * sin _vclDir), (getPos _vcl select 1) - (15 * cos _vclDir),0];

Why would you want to change the height, if I may ask?

Oh, since you're using it on a LHD, is the "0" there causing it to teleport to the surface of the water when you dismount it or what?

Share this post


Link to post
Share on other sites

Heh that must be it then. Try changing to zero to the height of the flight deck... think it's somewhere around 17.

Share this post


Link to post
Share on other sites

cry it still likes takeing a dip lol oh wait 17 lol i was puting 1.50 lol. let me try that

---------- Post added at 01:54 AM ---------- Previous post was at 01:47 AM ----------

It worked ok how does the mesurments work on this code some are in meters in the into line I put 1,15.9 to put them top deck this gets so confusing.

Share this post


Link to post
Share on other sites
It worked ok how does the mesurments work on this code some are in meters in the into line I put 1,15.9 to put them top deck this gets so confusing.

Punctuation please lol, can't help if I don't understand. Not sure what you mean by "I put 1,15.9".

If you're asking about how the setPos command works:

From the comref:

Format:

--- [x,z] or [x,z,y]

Description:

--- Position, x coordinates are from East to West, z coordinates are from South to North, y is the height above ground and the default y is 0.

Basically I find the only one I ever toy with is the last one, to alter the height, as you need to now. Otherwise for the first two values you just use the position the object is already in or perhaps the position of another object.

Edited by JDog

Share this post


Link to post
Share on other sites

Hehe. Sorry I get kind carried away typeing. In the init part of the unit. I put this code to put them on top deck. this setPosASL [position this select 0, position this select 1, 15.9] And from what I have read its in meters. When I used the other code we where messing with you said 17. So that kinda lost me. hehe. And thanks very much for helping me out with this.

Edited by Gunnykat

Share this post


Link to post
Share on other sites

Yea pretty sure it's meters. So you have it set to 15.9, which would be like 15 meters above the water since you're using ASL. The LHD surely is more than 15.9 feet high :)

Share this post


Link to post
Share on other sites

7m seems to be the lower hold, 10m human on deck, but 15.9m or so for vehicles on deck, it's odd.

Share this post


Link to post
Share on other sites

LOL well there up there lol. I have no clue got the setup off one of Xeno's map. First bit of baby script I learnt. Found out how to use the Into line that way. His scripting is wack. But it works if you figar it out.

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  

×