Guest User

SpacePlaneBugged.ks

a guest
Dec 30th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.93 KB | None | 0 0
  1. //Basic spaceplane takeoff and ascent to orbit program
  2. //causes KSP to think the ship's state is 'landed' permanently.
  3. //initially I thought this only happened on the version of the craft with a 'Mk1 Cargo Bay CRG-50-1',
  4. //but after a few mutations of the script and tidying up the code it seems to be consistent across all versions of the craft.
  5.  
  6.  
  7. SAS ON.
  8.  
  9. STAGE.
  10. TOGGLE AG3.
  11. LOCK THROTTLE TO 1.
  12.  
  13. Wait until SHIP:AIRSPEED > 130.
  14. SET SHIP:CONTROL:PITCH to 1.
  15.  
  16. WAIT UNTIL ALT:RADAR > 3.
  17. SET SHIP:CONTROL:PITCH to 0.
  18.  
  19. FUNCTION WaitUntilTopSpeed
  20. {
  21. DECLARE PARAMETER minAccel IS 0.01.
  22. SET topspeed TO SHIP:AIRSPEED.
  23. WAIT 3.
  24. UNTIL FALSE
  25. {
  26. set topspeed to SHIP:AIRSPEED.
  27. WAIT 1.
  28. IF SHIP:AIRSPEED - topspeed < minAccel
  29. BREAK.
  30. }
  31. }
  32.  
  33. SAS OFF.
  34. GEAR OFF.
  35.  
  36. lock steering to heading(90,15).
  37. lock targetspeed to max(200,altitude / 10).
  38. lock throttle to targetspeed / SHIP:AIRSPEED.
  39.  
  40. wait until altitude > 2500.
  41. set warp to 1.
  42.  
  43. wait until altitude > 8000.
  44. set warp to 2.
  45.  
  46. wait until altitude > 12000.
  47. lock steering to heading(90,5).
  48.  
  49. Toggle ag2. // Afterburner
  50. WaitUntilTopSpeed.
  51.  
  52. set warp to 0.
  53.  
  54. lock steering to heading (90, 18).
  55. Toggle ag3. //Rocket engine
  56.  
  57. SET numOut to 0.
  58. UNTIL apoapsis > 75000
  59. {
  60. until numOut > 0
  61. {
  62. LIST ENGINES IN engines.
  63. FOR eng IN engines
  64. {
  65. IF eng:FLAMEOUT
  66. {
  67. SET numOut TO numOut + 1.
  68. }
  69. }
  70. if numOut > 0 { Toggle ag1. Toggle ag2. }.
  71. }
  72. }
  73.  
  74. lock throttle to 0.
  75. lock steering to prograde.
  76.  
  77. set warp to 3.
  78. Wait until altitude > 70000.
  79. set warp to 0.
  80.  
  81. WAIT UNTIL KUNIVERSE:CANQUICKSAVE.
  82. KUNIVERSE:QUICKSAVETO("_Script node ahead").
  83. PRINT "game saved to '_Script node ahead'".
  84.  
  85. //Exec maneuver node.
  86. Unlock all.
  87. SET SHIP:CONTROL:PILOTMAINTHROTTLE to 0.
  88. RUNPATH("0:/CIRCULARISEAPOAPSIS").
  89. RUNPATH("0:/EXECNODE").
  90.  
  91. WAIT UNTIL KUNIVERSE:CANQUICKSAVE.
  92. KUNIVERSE:QUICKSAVETO("_Script finished").
  93. PRINT "game saved to '_Script finished'".
Advertisement
Add Comment
Please, Sign In to add comment