Advertisement
FT_

placeShellscrape.sqf

FT_
Nov 8th, 2015
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. //Written by beta
  2. //Ideas from GeneralCarver
  3. //Places shellscrape
  4.  
  5. private["_type", "_id", "_pos", "_dir", "_obj", "_nearShellscrapes", "_newObj"];
  6.  
  7. _id = _this select 2;
  8. _type = _this select 3 select 0;
  9. _obj = _this select 3 select 1;
  10.  
  11. _nearShellscrapes = nearestObjects [player, [_type], 3];
  12. _nearShellscrapes = _nearShellscrapes - [_obj];
  13.  
  14. if ((count _nearShellscrapes) < 1) then {
  15.  
  16. player removeAction _id;
  17. player setVariable ["objDeployed", true, false];
  18.  
  19. _pos = getPosATL _obj;
  20. _dir = getDir _obj;
  21. deleteVehicle _obj;
  22. _pos = [_pos select 0, _pos select 1, 0.05];
  23. _newObj = _type createVehicle _pos;
  24. _x = _pos select 0;
  25. _y = _pos select 1;
  26. _z = _pos select 2;
  27. _newObj setDir _dir;
  28.  
  29. player playMove "AinvPknlMstpSlayWrflDnon_medic";
  30. _startTime = time;
  31. _duration = 150;
  32. _startDepth = 0.46;
  33. _newObj setPosATL [_x, _y, _z - _startDepth];
  34.  
  35. _top = getTerrainHeightASL [_x, _y +1];
  36. _bottom = getTerrainHeightASL [_x, _y -1];
  37. _left = getTerrainHeightASL [_x -1, _y];
  38. _right = getTerrainHeightASL [_x +1, _y];
  39. _newObj setVectorUp [_left - _right, _bottom - _top, 2];
  40.  
  41. _stopAction = player addAction ["Stop Digging", "bScripts\deploy\stopShellscrape.sqf", [_obj], 99, true, false, "", ""];
  42.  
  43. _depth = _startDepth;
  44. while {_depth >= 0 && !(player getVariable ["stopDigging", false])} do {
  45. if (animationState player != "AinvPknlMstpSlayWrflDnon_medic") then {
  46. player playMove "AinvPknlMstpSlayWrflDnon_medic";
  47. };
  48. _depth = (1 - ((time - _startTime) / _duration)) * _startDepth;
  49. _newObj setPosATL [_x, _y, _z - _depth];
  50. sleep 0.1;
  51. };
  52. player removeAction _stopAction;
  53. player setVariable ["stopDigging", false, false];
  54.  
  55. } else {
  56. hintSilent "You cannot deploy a shellscrape within 3m of another shellscrape";
  57. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement