Jump to content
Sign in to follow this  
kazu177

Mounting into a vehicle while object attached

Recommended Posts

Hello all,

I have implemented an attach and detach script onto a suitcase.

carry.sqf :

switch (take) do

{

case 0:

{

_scase = _this select 0;

_man = _this select 1;

_scase attachto [_man, [0.035,-.055,-0.22], "LeftHandMiddle1"];

_scase setdir 90;

_scase removeAction act1;

act1 = _man addaction ["Drop Case","carry.sqf","",1,false,true,""];

take=1;scase = _scase;taken=true;

};

case 1:

{

_man = _this select 0;

detach scase;

scase setvelocity[0,0,-.3];

_man removeAction act1;

act1 = scase addaction ["Take Case","carry.sqf","",1,false,true,""];

take=0;

};

};

Now the only problem remaining is when mounting up in any vehicle while the suitcase is attached to the player, the suitcase remains outside of the vehicle (where holder mounted) and can be interacted by others. Once the suitcase holder dismounts though, the briefcase teleports and gets re-attached back to the original suitcase holder.

I would like to know how to make the suitcase instead of floating while in a vehicle, teleport it far away so no one can interact with it until the holder dismounts.

If you are in need of any more details, please ask.

Thanks guys ;)

Share this post


Link to post
Share on other sites

You need to check the player to see if he's in or out of a vehicle, you could use a getin eventhandler but that requires one to be on every vehicle.

simple way is to use a trigger set as follows

repeating

cond

player != vehicle player

on act

case_name hideobject true

on dea

case_name hideobject false

Share this post


Link to post
Share on other sites
You need to check the player to see if he's in or out of a vehicle, you could use a getin eventhandler but that requires one to be on every vehicle.

simple way is to use a trigger set as follows

repeating

cond

player != vehicle player

on act

case_name hideobject true

on dea

case_name hideobject false

Thank you F2k Sel for the fast response.

I managed to carry the suitcase, mount up in a vehicle and the suitcase disappread.

Problem is now when I dismount, it doesn't appear or is attached to me.

The end conditions will include this suitcase being extracted.

Edited by kazu177

Share this post


Link to post
Share on other sites

Try adding this at the bottom of your script:

waitUntil {vehicle player != player};
suitcase hideobject true;
waitUntil {vehicle player == player};
suitcase hideobject false;

Or try switching Sel's condition from player != vehicle player to vehicle player != player

Share this post


Link to post
Share on other sites
Try adding this at the bottom of your script:

waitUntil {vehicle player != player};
suitcase hideobject true;
waitUntil {vehicle player == player};
suitcase hideobject false;

Or try switching Sel's condition from player != vehicle player to vehicle player != player

Your script worked!

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  

×