Jump to content
Sign in to follow this  
VonNexus

Problem with attachTo

Recommended Posts

Hi,

What I want to do is quite simple, I'd like to paradrop an ammocrate near my player. So I named the crate "ammocrate" and the parachute is called "para". The code is :

    ammocrate attachTo [para,[0,0,1]]; 

When the parachute is flying, the code works like a charm. But as soon as th chute reaches the land, the crate goes under the ground. I think that this happens because the chute closes itself once it is on the land and then disappears. Maybe I could use a detach command, but I'd need a syntax in a script to activate it when the chute is on the ground and I honestly don't know how to do that. Hope that we can fix this.

Share this post


Link to post
Share on other sites

What about

ammoCrate moveInCargo para;

(or moveInDriver or moveInGunner, dunno which will work).

Share this post


Link to post
Share on other sites
What about
ammoCrate moveInCargo para;

(or moveInDriver or moveInGunner, dunno which will work).

Nope, the crate stays on the ground. It doesn't do the trick.

Share this post


Link to post
Share on other sites

Try something like this.... cut and paste it this into the init line of your chute.... a bit long winded but also detaches the chute and makes sure the box is on the ground and level.

this setpos [getpos this  select 0,getpos this  select 1,100]; ammo1 attachto [this,[0,0,1]]; nul = [] spawn {sleep 1; waituntil {(getpos ammo1) select 2 < 1}; detach ammo1; ammo1 setpos [(getpos ammo1) select 0,(getpos ammo1) select 1,0]; ammo1 setvectorup [0,0,1]};

I'm assuming you're looking to put something in the chutes init here. In this example the ammo box is called ammo1

EDIT: I'm finding that once the box is on the ground it's useless because you can't access the weapons in it! I can access another box of the same type that hasn't been for a ride in a chute. Quite weird.

Edited by twirly
Clarity

Share this post


Link to post
Share on other sites

In ammobox init:

ammo attachTo [para,[0,0,3]];

In parachute init:

this setpos [(getpos this select 0),(getpos this select 1),370];

Code:

_crate attatchTo [_para, [0,0,0], "paraEnd"];

Example can be found under modules.pbo\Functions\systems\fn_supplydrop.sqf

Share this post


Link to post
Share on other sites
In ammobox init:

ammo attachTo [para,[0,0,3]];

In parachute init:

this setpos [(getpos this select 0),(getpos this select 1),370];

Code:

_crate attatchTo [_para, [0,0,0], "paraEnd"];

Example can be found under modules.pbo\Functions\systems\fn_supplydrop.sqf

Where is the code meant to be placed? A script or an init?

Share this post


Link to post
Share on other sites
Where is the code meant to be placed? A script or an init?

to tell you the truth, i forgot! :D

I tryed that long time ago, but i know that it's good... Try to experimente... ;)

Share this post


Link to post
Share on other sites

Looks to be the code is meant for .sqf file, try putting it in the init.sqf. Making sure that it's not in any of the other 'if, then' statements.

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  

×