Advertisement
bulbyVR

spagetti garbo

Aug 14th, 2019
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.06 KB | None | 0 0
  1. local sm3dwNove = {}
  2. local trueCharacterID = player:mem(0xF0, FIELD_WORD);
  3. local trueCharacterID2 = nil;
  4. local textblox = API.load("textblox");
  5.  
  6. function sm3dwNove.onInitAPI()
  7. registerEvent(sm3dwNove, "onTick", "onTick");
  8. registerEvent(sm3dwNove, "onStart", "onStart");
  9. registerEvent(sm3dwNove, "onInputUpdate");
  10. registerEvent(sm3dwNove, "onTickEnd", "onTickEnd");
  11. end
  12.  
  13.  
  14. if trueCharacterID == 1 or trueCharacterID == 2 or trueCharacterID == 4 then
  15. local footContact = false
  16. local isBannedCharacter = false
  17. local isInSomething = false
  18. local isDoingBannedStuff = false
  19. local allowCrawl = false
  20. local isHoldingSomething = false
  21. local isRunning = false
  22.  
  23. local truePowerup = 1
  24. local currentPowerUp = nil
  25. local crouchWalkEntered = false
  26. currentPowerUp = player.powerUp
  27. --[[
  28. if allow2P then
  29. currentPowerUp = {currentPowerUp, player2.powerUp};
  30. end ]]
  31. local truePowerup = currentPowerUp
  32. local inputs = API.load("inputs2");
  33. local playeranim = API.load("playerAnim");
  34.  
  35. inputs.locked[1].down = true;
  36. --[[
  37. if allow2P then
  38. inputs.locked[1][2].down = true;
  39. end]]
  40. local function sleep (a)
  41. local sec = tonumber(os.clock() + a);
  42. while (os.clock() < sec) do
  43. end
  44. end
  45.  
  46.  
  47.  
  48. local function memRecognitionFunction()
  49.  
  50. currentPowerUp = player:mem(0x112, FIELD_WORD)
  51. inGroundNow = player:mem(0x146, FIELD_BOOL)
  52. inSlopeNow = player:mem(0x48, FIELD_BOOL)
  53. inStandNPC = player:mem(0x176, FIELD_BOOL)
  54. isInVine = player:mem(0x40, FIELD_BOOL)
  55. pressedAltJump = player.altJumpKeyPressing
  56. isInMount =player:mem(0x108, FIELD_BOOL)
  57. isInWater = player:mem(0x44, FIELD_BOOL)
  58. spriteHeld = player:mem(0x154, FIELD_WORD)
  59. characterId = player:mem(0xF0, FIELD_WORD)
  60. isStatue = player:mem(0x4A, FIELD_BOOL)
  61. isInRainbowShell = player:mem(0x44, FIELD_BOOL)
  62. isLeft = player:mem(0x106, FIELD_WORD) < 0
  63. playerZoomFactor = player:mem(0xE0, FIELD_DFLOAT)
  64. isSpinning = player:mem(0x50, FIELD_BOOL)
  65.  
  66.  
  67.  
  68. end
  69. local function memFusions()
  70.  
  71. if math.abs(player.speedX) >= 5 then
  72. isRunning = true;
  73. else
  74. isRunning = false;
  75. end
  76. if not inSlopeNow and
  77. not inGroundNow and
  78. not inStandNPC then
  79. footContact = false;
  80. else
  81. footContact = true;
  82. end
  83. if characterId == 1 or
  84. characterId == 2 or
  85. characterId == 3 or
  86. characterId == 4 then
  87. isBannedCharacter = false
  88. else
  89. isBannedCharacter = true
  90. end
  91. if spriteHeld >= 1 then
  92. isHoldingSomething = true;
  93. else
  94. isHoldingSomething = false;
  95. end
  96. if isInVine or
  97. isInMount or
  98. isInWater or
  99. isInRainbowShell or
  100. isStatue then
  101. isInSomething = true;
  102. else
  103. isInSomething = false
  104. end
  105.  
  106.  
  107. end
  108. local function doingBannedStuff()
  109.  
  110.  
  111. if not footContact or
  112. isInSomething or
  113. isHoldingSomething then
  114. isDoingBannedStuff = true;
  115. else
  116. isDoingBannedStuff = false;
  117. end
  118.  
  119.  
  120. end
  121.  
  122. local function longJump()
  123. if not isDoingBannedStuff and isRunning and
  124. inputs.state[1].altjump == 1 then
  125. if isLeft then
  126. player.runKeyPressing = false;
  127. addSpeed = player.speedX
  128. player.leftKeyPressing = false;
  129. player.speedX = 0
  130. Audio.playSFX(1);
  131. player.speedX = addSpeed - 10
  132. for k=1,5 do
  133. player.jumpKeyPressing = true
  134. end
  135. else
  136. player.runKeyPressing = false;
  137. addSpeed = player.speedX
  138. player.rightKeyPressing = false;
  139. player.speedX = 0
  140. Audio.playSFX(1);
  141. player.speedX = addSpeed + 10
  142. for m=1,5 do
  143. player.jumpKeyPressing = true
  144. end
  145.  
  146.  
  147. end
  148.  
  149. end
  150. end
  151.  
  152.  
  153. local function crouchwalk()
  154.  
  155. if not isDoingBannedStuff and
  156. currentPowerUp ~= 1 then
  157. Audio.playSFX(26);
  158. truePowerup = currentPowerUp;
  159.  
  160. player:mem(0x112, FIELD_WORD, 1);
  161. end
  162. if truePowerup ~= currentPowerup and inputs.state[1].down == inputs.RELEASE then
  163. Audio.playSFX(71);
  164.  
  165. player:mem(0x112, FIELD_WORD, truePowerup);
  166. end
  167. end
  168.  
  169.  
  170. function sm3dwNove.onTick()
  171. memRecognitionFunction();
  172. memFusions();
  173. doingBannedStuff();
  174.  
  175. if inputs.state[1].down == inputs.PRESS or
  176. inputs.state[1].down == inputs.RELEASE then
  177. crouchwalk();
  178. end
  179.  
  180. textblox.printExt ("X Speed = "..tostring(player.speedX), {x=5,y=050, font=textblox.defaultSpritefont[3][1], halign=textblox.HALIGN_LEFT, valign=textblox.VALIGN_MID})
  181. end
  182.  
  183. function sm3dwNove.onInputUpdate()
  184.  
  185. if inputs.state[1].down == inputs.PRESS and
  186. ((inSlopeNow and (characterId == 1 or characterId == 2)) or isInVine or isInMount or not footContact) then
  187. inputs.locked[1].down = false;
  188. end
  189. if inputs.locked[1].down == false and
  190. not((inSlopeNow and (characterId == 1 or characterId == 2)) or isInVine or isInMount or not footContact) then
  191. inputs.locked[1].down = true;
  192. end
  193. if(player.altJumpKeyPressing) and (player:mem(0x108,FIELD_WORD) < 1) and not player.jumpKeyPressing and isRunning then
  194. player.altJumpKeyPressing = false;
  195. longJump();
  196. end
  197.  
  198.  
  199. bugInput();
  200. end
  201. -- SMBX Crouching Bugfix --
  202. -- by Nat The Porcupine --
  203. --Further work by BulbyVR --
  204.  
  205. local player_isCrouching = false;
  206. local player_lowCeiling = false;
  207. local player2_isCrouching = false;
  208. local player2_lowCeiling = false;
  209. local longJumpLeftAnim = playeranim.Anim({-2, -24, -24, -24, -24}, 5)
  210. local longJumpRightAnim = playeranim.Anim({2, 24, 24, 24, 24}, 5)
  211. local animationTimer = 0
  212. local animTimerLimit = 15
  213.  
  214.  
  215.  
  216.  
  217. function bugInput()
  218.  
  219. -- Stores the player's crouching state in a variable --
  220. if player:mem(0x12E,FIELD_WORD) == -1 then
  221. player_isCrouching = true;
  222. else
  223. player_isCrouching = false;
  224. end
  225.  
  226. -- Checks if the player is small or touching ground--
  227. if player:mem(0x112, FIELD_WORD) ~= 1 and footContact then
  228.  
  229. -- Checks for blocks above the player while they're crouching --
  230. for k,v in pairs(Block.getIntersecting(player.x, player.y - 32, player.x + player.width, player.y)) do
  231.  
  232. -- Checks for visible blocks only --
  233. if v:mem(0x1C,FIELD_WORD) == 0 then
  234.  
  235. -- Block exception list: list of blocks that will not force the player to duck --
  236. local exception = {8, 25, 26, 27, 28, 30, 38, 69, 79, 108, 121, 122, 123,130, 161, 168, 172, 175, 178,
  237. 181, 240, 241, 242, 243, 244, 245, 259, 260, 261, 287, 288, 289, 290, 370, 371, 372, 373, 374, 375, 379, 380, 381, 382, 389, 391, 392, 404, 405, 406, 420, 437, 438, 439, 440 ,441, 442, 443, 444, 445, 446, 447, 448, 459, 460
  238. ,461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 506, 507, 508, 568, 572, 575, 579};
  239. if v.id == exception then player_lowCeiling = false else player_lowCeiling = true end
  240.  
  241. end
  242.  
  243. end
  244.  
  245. end
  246.  
  247.  
  248. -- Forces the player to crouch --
  249.  
  250. if player.downKeyPressing == false then
  251.  
  252. if player_lowCeiling == true then
  253. player.downKeyPressing = true;
  254. elseif player:mem(0x146,FIELD_WORD) == 0 and player_isCrouching == true then
  255. player.downKeyPressing = true;
  256. else
  257. player.downKeyPressing = false;
  258. end
  259. end
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269. end
  270.  
  271. function sm3dwNove.onTickEnd()
  272. -- Resets the player's low ceiling variable for technical reasons --
  273.  
  274. player_lowCeiling = false;
  275.  
  276.  
  277. end
  278. end
  279. return sm3dwNove;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement