Jump to content
Sign in to follow this  
skelebob9

Unit refuses to enter vehicle

Recommended Posts

I cannot for the life of me get my unit into the cargo of a vehicle. It works with moveInCargo but I don't want it to be teleported straight into the cargo.

These are the codes I've tried:

Does not work:

Shah addEventHandler ["AnimDone", {if(_this select 1 == "ActsPercMstpSnonWpstDnon_sceneBardakPistol02") then { hint "Go"; Tech lock false; Shah assignAsCargo vehicle TechDriver; Shah orderGetIn true; }}];

Does not work:

Shah addEventHandler ["AnimDone", {if(_this select 1 == "ActsPercMstpSnonWpstDnon_sceneBardakPistol02") then { hint "Go"; Shah assignAsCargo Tech; Shah orderGetIn true; }}];

Does not work:

Shah addEventHandler ["AnimDone", {if(_this select 1 == "ActsPercMstpSnonWpstDnon_sceneBardakPistol02") then { hint "Go"; Shah assignAsCargo Tech; Shah allowGetIn true; }}];

Does not work:

Shah addEventHandler ["AnimDone", {if(_this select 1 == "ActsPercMstpSnonWpstDnon_sceneBardakPistol02") then { hint "Go"; Shah assignAsCargo Tech; Shah allowGetIn true; Shah orderGetIn true; }}];

Does not work:

Shah addEventHandler ["AnimDone", {if(_this select 1 == "ActsPercMstpSnonWpstDnon_sceneBardakPistol02") then { hint "Go"; group Shah addVehicle Tech; Shah assignAsCargo Tech; Shah orderGetIn true; }}];

Works:

Shah addEventHandler ["AnimDone", {if(_this select 1 == "ActsPercMstpSnonWpstDnon_sceneBardakPistol02") then { hint "Go"; Shah moveInCargo Tech; }}];

The 'Go' hint appears but the unit 'Shah' does not enter the vehicle. It works when I use moveInCargo. I have tried using vehicle TechDriver as well as simply Tech (the name of the vehicle). I've searched through others' posts but they all say that addVehicle, assignCargo, allowGetIn and orderGetIn are the only ways to do it. I've tried putting them in the same group before making 'Shah' enter the vehicle but it still does not work. Does anyone have any ideas? This is killing me and I have no idea how to get this to work.

EDIT:

Shah addEventHandler ["AnimDone", {[_this select 1] exec "ShahGetIn.sqf";}];

ShahGetIn.sqf:

if(_this select 0 == "ActsPercMstpSnonWpstDnon_sceneBardakPistol02") then { hint "Go"; Tech lock false; Shah assignAsCargo Tech; Shah orderGetIn true; }; 

Still hints 'Go' but doesn't get in the car. Again, moveInCargo works.

Edited by Skelebob9

Share this post


Link to post
Share on other sites

You should be using brackets as it's an array

[shah] orderGetIn true;

Share this post


Link to post
Share on other sites

Even with brackets it doesn't work. I should have mentioned that I tried as an array and as a normal unit, sorry.

Share this post


Link to post
Share on other sites

I don't know how your getting your action but for my test I used shah setunitpos "middle" to set the EVH off

vehicle named Tech

unit named Shah

place in units init box

Shah addEventHandler ["AnimDone", {if(_this select 1 == "aidlpknlmstpslowwrfldnon_idlesteady02") then { 
hint "Go"; 
Tech lock false; 
Shah assignAsCargo Tech;
[shah] orderGetIn true; 
}
}
];
shah setunipos "middle";

It takes a while but he does get in

Edited by F2k Sel

Share this post


Link to post
Share on other sites

Shah playMove "ActsPercMstpSnonWpstDnon_sceneBardakPistol01";

This is called when the technical enters within 20m of Shah. ActsPercMstpSnonWpstDnon_sceneBardakPistol01 transitions into ...Pistol02 when completed.

I've tried what you suggested and now he just crouches and aims his gun.

EDIT: I tried moving the SetUnitPos into the if statement before ordering him to get into the vehicle and it didn't work that way either.

EDIT 2:

In my sqf file:

_AnimName = _this select 0;
_Shah = _this select 1;
_Tech = _this select 2;
hint format["%1\n%2\n%3", _AnimName, _Shah, _Tech];

The hint works but still Shah does not get into Tech.

EDIT 3:

hint format["%1\n%2\n%3\n%4", _AnimName, _Shah, _Tech, assignedVehicle _Shah]; _Tech lock false; _Shah assignAsCargo _Tech; [_Shah] orderGetIn true;

The hint is called in the above.

_Shah switchMove ""; _Tech lock false; _Shah assignAsCargo _Tech; [_Shah] orderGetIn true; hint format["%1\n%2\n%3\n%4", _AnimName, _Shah, _Tech, assignedVehicle _Shah];

The hint is not called in the above.

Is there anything in there that I have done wrong? I have checked but I can't see anything that is wrong with the second snippet.

I managed to get the hint to work, now it's just orderGetIn that doesn't work:

_AnimName = _this select 0;
_Shah = _this select 1;
_Tech = _this select 2;
if(_AnimName == "ActsPercMstpSnonWpstDnon_sceneBardakPistol02") then 
{ 
   _Tech lock false; 
   _Shah assignAsCargo _Tech; 
   [_Shah] orderGetIn true; 
   hint format["%1\n%2\n%3\n%4", _AnimName, _Shah, _Tech, assignedVehicle _Shah];
}; 

orderGetIn doesn't work for some reason. Have I done something wrong? (the assigned vehicle is returned as 'Tech' which is correct)

---------- Post added at 23:16 ---------- Previous post was at 22:28 ----------

Found my problem:

Shah disableAI "MOVE";

Whoops..

Thanks, F2k Sel for offering advice!

Edited by Skelebob9

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  

×