Jump to content
Sign in to follow this  
CyDoNgr

Can't carry briefcase in car.

Recommended Posts

I have this line in the init of the case:
this setPos [getPos this select 0, getPos this select 1, 15]; take=0; act1 = this addaction ["Take Case","carry.sqf","",1,false,true,""]
 

and this is my script:

 

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;
    };
};

 

 

So i can pickup a case etc. My problem is that when I get in car or something the item is dropped. Do you have any idea how could this be changed?
THX!

Share this post


Link to post
Share on other sites

You cant store the case in any inventory without config patches.

But  you can attach the case to vehicle inside specific place or delete it and create+attach again when player get out from vehicle.

Or hide dropped one and restore+attach on get out

  • Like 1

Share this post


Link to post
Share on other sites

For sake of simplicity I would just use hideObjectGlobal on the briefcase whenever the carrier is in a vehicle and make it visible again when he gets out.

In fact I think we could run a universal script that fixes this for everything attached to the player.

 

 

put this in your init.sqf:

if (hasInterface) then {
    waitUntil {alive player};
    player addEventHandler ["GetInMan", {
        {
            [_x, true] remoteExec ["hideObjectGlobal",2,true];
        } count attachedObjects;
    }];
    player addEventHandler ["GetOutMan", {
        {
            [_x, false] remoteExec ["hideObjectGlobal",2,true];
        } count attachedObjects;
    }];
    player addEventHandler ["Killed", {
        params ["_unit"];
        {
            if !(_unit isEqualTo (vehicle _unit) then {
                detach _x;
                _x setPos getPos _unit;
                [_x, false] remoteExec ["hideObjectGlobal",2,true];
            } else {
                detach _x;
            };
        } count attachedObjects;
    }];
};

That should take care of things (haven't tested it yet).

Share this post


Link to post
Share on other sites

I never tried it using "hideObjectGlobal" as the command didn't exist at the time but "hideobject" did so as Tajin says it should work.

Share this post


Link to post
Share on other sites

You cant store the case in any inventory without config patches.

Yes, good point, i was thinking of it being an item for some reason. My mistake.

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  

×