Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- a: reyhard
- adds ability to move around flying c130 cargo bay
- kind of attachToWithMovment but using attachTo command
- */
- _v = _this select 0;
- _p = call lala_c17_fnc_rhs_findPlayer;
- _p action ["eject",_v];
- USAF_c130J_attached = true;
- _pos = [0,14,-1.21];
- _posOld = _pos;
- _p attachTo [_v,_pos];
- _vc = [0,0,0];
- _h1 = [0,0,0];
- _h2 = [0,0,0];
- _h3 = [0,0,0];
- _dir = getdir _p;
- hint format["to get back to seat press %1",actionKeysNames "LockTarget"];
- _p forceWalk false;
- while {USAF_c130J_attached} do
- {
- if(inputAction "LockTarget" > 0)then
- {
- detach _p;
- USAF_c130J_attached = false;
- _p setVelocity [0,0,0];
- _p moveInCargo _v;
- };
- if(inputAction "moveForward" > 0)then
- {
- _pos = _pos vectorAdd (([(vectorDir _p),getDirVisual _v] call BIS_fnc_rotateVector2D) vectorMultiply 0.05);
- };
- if(inputAction "moveBack" > 0)then
- {
- _pos = _pos vectorAdd (([(vectorDir _p),getDirVisual _v] call BIS_fnc_rotateVector2D) vectorMultiply -(0.05));
- };
- if(inputAction "turnLeft" > 0)then
- {
- _vc = [vectorDirVisual _p,(getDirVisual _v)-90] call BIS_fnc_rotateVector2D;
- _pos = _pos vectorAdd (_vc vectorMultiply -0.05);
- };
- if(inputAction "turnRight" > 0)then
- {
- _vc = [vectorDirVisual _p,(getDirVisual _v)+90] call BIS_fnc_rotateVector2D;
- _pos = _pos vectorAdd ( _vc vectorMultiply -(0.05) );
- };
- if(not(_pos isEqualTo _posOld))then
- {
- _pos set [2,-1.21];
- if( (getPosASL _v select 2) > (getPosATL _v select 2) )then{
- _h1=ATLToASL(_v modelToWorldVisual [(_pos select 0 )*1.2,(_pos select 1)*1.2,(_pos select 2)+0.2]);
- _h2=ATLToASL(_v modelToWorldVisual (_posOld vectorAdd [0,0,0.2]));
- }else{
- _h1=(_v modelToWorldVisual [(_pos select 0)*1.2,(_pos select 1)*1.2,(_pos select 2)+0.2]);
- _h2=(_v modelToWorldVisual (_posOld vectorAdd [0,0,0.2]));
- };
- if(not(lineIntersects [_h1,_h2]))then{_p attachTo [_v, _pos]; _posOld = _pos}else{_pos = _posOld};
- if((getpos _p select 2) > 1)then{
- _p allowDamage false;
- detach _p;
- _p setVelocity [0,0,0];
- USAF_c130J_attached = false;
- sleep 1;
- _p allowDamage true;
- };
- };
- if (inputAction "AimRight" > 0) then {_dir = _dir+(2*(inputAction "AimRight")); _p setdir _dir;};
- if (inputAction "AimLeft" > 0) then {_dir = _dir-(2*(inputAction "AimLeft")); _p setdir _dir;};
- sleep 0.01;
- };
- _p forceWalk false;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement