Jump to content
Sign in to follow this  
seedo81

How to make Copter lift tanks?

Recommended Posts

Does any one can help about how i can lift tanks using copters/

thank you

Share this post


Link to post
Share on other sites

Thank u man but i want just the helicopter lift thingy only, how?

Share this post


Link to post
Share on other sites

A while ago I made a really, really simple script for lifting vehicles, just to try out the attachto function. Its never really been used, but if I remember correctly it does work.

Feel free to rip parts out of it:

In init: this addAction["Attach/Detach","script.sqf",[]]

_helo = _this select 0;
_player = _this select 1;
_id = _this select 2;
_args = _this select 3;

if (_player != (driver _helo)) exitWith { hint "You're not the pilot!"; };
if ( (getPos _helo) select 2 <= 3 OR (getPos _helo) select 2 >= 8) exitWith { hint "You're either too high or too low to attach or detach a vehicle"; };

_nearestObjects = nearestObjects [_helo, ["LandVehicle","Air"],10];

if (count _nearestObjects >=2) then {
_liftVehicle = _nearestObjects select 1;
_attached = _helo getVariable "vehicle_attached";
if (_attached) then {
	detach _liftVehicle;
	hint format ["detaching %1",(_helo getVariable "vehicle_attached")];
	_liftVehicle setVelocity [0,0,0];
	_helo setVariable ["vehicle_attached",false,false];
}
else {
	_helo setVariable ["vehicle_attached",true,false];
	_liftVehicle engineOn false;
	_liftVehicle attachTo [_helo, [0,0,-2.5]];
	hint format ["lifting %1",_liftVehicle];
};

};

Share this post


Link to post
Share on other sites

i made R3F works but i dont want the artillery thing to work i just wont the Airlift feature only, is that possible?

Share this post


Link to post
Share on other sites
i made R3F works but i dont want the artillery thing to work i just wont the Airlift feature only, is that possible?

Ask him in his forum.

Share this post


Link to post
Share on other sites

Just wanted to say Murklor:

Your script works brilliantly, exactly what I've been after for a while.

Just one note though...

In order to get it to work, I had to add...

this setVariable ["vehicle_attached",false,false];

...to the "Init" line of the helicopter in question (along with the addAction...), in order to get it to work.

Otherwise, the If...Then...Else loop didn't seem to fire.

Other than that, thanks very much, you're a star!

Peace

Share this post


Link to post
Share on other sites

I have used the attachto script and it works great. But is there a way to have everything in the script and just call the script.sqf ?

Right now I add these 2 lines in the init field of the chopper.

this setVariable ["vehicle_attached",false,false];

and

this addAction["Attach/Detach","script.sqf",[]]

Is there a way to add the addaction and setVariable lines to the script its self and then only have ( nul = [this,30] execVM ""script.sqf"""; to call the script?

Hard to understand because they called the script - script.sqf

Please let me know if I need to explain more clear.

If some one can do it please post fixed code and rename the script. LOL

Thank you.

Share this post


Link to post
Share on other sites

Murklor, is there a way to have the hint say "Vehicle Released", instead of "detached true"?

I renamed the "script.sqf" to be called "heli_lift.sqf" and referred the add action to use the new script file name.

As Holyman suggested, I also added... this setVariable ["vehicle_attached",false,false];

and I removed the ability to lift other "Air" vehicles. However, I would like to be able to lift an ammo crate if possible.

Share this post


Link to post
Share on other sites

When I removed ,"Air" from the line:

_nearestObjects = nearestObjects [_helo, ["LandVehicle","Air"],10];

... it then would not allow me to release the vehicle at all.

Here's my problem. I don't want player being able to airlift another chopper. I also don't want them to be able to lift any of the tripod guns, because when they release the tripod gun, the gun is then left hovering in the air.

I just want it so the cars and tanks can be lifted and released. I decided against lifting ammo crates unless I can set it so they can only lift 1 specific ammo crate. I don't want them lifting the main ammo crate at base, but maybe let them lift a different ammo crate near the chopper helipad wouldn't be a bad idea. Anyway, how can I change the script so the pilot can only lift tanks and cars?

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  

×