Advertisement
Guest User

SMBX LUNA

a guest
Mar 5th, 2014
478
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 30.44 KB | None | 0 0
  1. - Using lunadll.txt scripts -
  2.  
  3. The most important things to think about are the action you want to do
  4. and the point at which the action should happen. The scripting engine
  5. only deals with those two things: A time, and an action.
  6.  
  7. Example times:
  8. While loading a level
  9. Always
  10. In section 1
  11. In section 2
  12. When a timer runs down
  13. When touching a block of a certain type
  14. When typing a custom cheat code
  15. When a condition is met such as NPC with ID 138 no longer exists
  16.  
  17. Example actions:
  18. Change the player character
  19. Change the powerup
  20. Change the reserve powerup
  21. Play a sound
  22. Change the music
  23. Show text
  24. Trigger an event
  25. Manipulate game memory somehow
  26.  
  27.  
  28. - The basics -
  29.  
  30. The first step is creating a file named lunadll.txt in your level folder. That's it.
  31.  
  32.  
  33. - Structure -
  34.  
  35. There's only 4 things you'll be writing in your lunadll.txt.
  36.  
  37.  
  38. 1) Time designator - #
  39. # designates a time of an action. They mostly correspond to sections of the level
  40.  
  41. #-1 means during level load
  42. #0 means "always"
  43. #1 means section 1
  44. #2 means section 2
  45. ...
  46. #21 means section 21
  47.  
  48. #1000 and up is an advanced feature for designating custom events / custom blocks of commands
  49.  
  50. Once you write say #-1, then all commands you write from then on will be run
  51. during the level load time of your level, until you write #1 or some other designator.
  52.  
  53.  
  54. 2) Comments - // comment
  55.  
  56. Any line that contains a // will be understood as a comment. Comments are only
  57. for humans to read, and the scripting engine ignores them. They're actually important
  58. for remembering just what the hell your code is supposed to do, and for others to
  59. understand what your code does.
  60.  
  61.  
  62. 3) Commands - Kill,0,0,0,0,0,0
  63.  
  64. Commands are the most important part of lunadll scripts, and the most complicated.
  65. There's no way to remember them all or what all of the parts of one do usually,
  66. so you have to check the reference.
  67.  
  68. They mostly have the same parts, separated by commas
  69.  
  70. "Kill" - This first part is the command name. It's the easiest part to remember and
  71. explains what the command does, usually. This one kills something. "Infinite flying"
  72. activates infinite flying for the player, and so on.
  73.  
  74. After each command name, there are 6 parameters separated by commas. What each one
  75. does is specific to each command, and they're quite hard to remember, which is why
  76. you'll have to refer to the reference. But there is some underlying pattern.
  77.  
  78. 1 - The target parameter
  79. The first number is usually the "target" of the command. If you want the command to
  80. target the player, 0 is usually the player. If you want to target the "key" NPC
  81. (the thing you pick up that opens lockd doors), well you need to target the key's
  82. NPC ID (the key is NPC ID 38)
  83.  
  84. 2, 3, 4 - Options
  85. Parameter 2, 3, 4 are extra parameters that can mean just about anything, but for a
  86. lot of commands that aren't complicated, they usually aren't used and are just 0.
  87. Check the command reference.
  88.  
  89. 5 - Active time
  90. Parameter 5 is virtually always the "active time" specifier. Basically it's how long
  91. the command will "run" before finally deleting itself. 0 means it never runs out.
  92. 1 means it lasts 1 frame. 60 means it lasts 60 frames (1 second), and so on.
  93.  
  94. Keep in mind that commands don't run at all unless they're in the section you're in.
  95. A command in #21 with 1 frame active time will sit there forever until the player
  96. actually gets to section 21, and then it will run once and then die.
  97.  
  98. 6 - Text
  99. Unlike the others, the 6th parameter can also be entered as text, but is oftentimes
  100. just left as 0 anyway. It's usually where you type messages, decimal numbers, and
  101. options.
  102.  
  103. That's all you need to know about commands.
  104.  
  105.  
  106. 4) Script footer - #END
  107.  
  108. #END is a special string you should put at the end of your .txt file. It's pretty
  109. simple - just put #END after everything else.
  110.  
  111.  
  112. - Examples -
  113.  
  114. Here's a bunch of examples in ascending level of complexity with lots of comments
  115.  
  116.  
  117. ///--Basic filter script--///
  118.  
  119. #-1
  120. FilterToBig,0,0,0,0,0,0
  121. #END
  122.  
  123. That's the whole thing. First we have the level load designator, which is where you
  124. normally want a filter. FilterToBig lowers Demo's powerup down to mushroom level
  125. if she has anything higher than a mushroom, and does nothing if she's small.
  126.  
  127. FilterToBig's 6 parameters do nothing except the 5th, the active time. It's set to
  128. 0 which means "always", but since it's in the level load section, it only works
  129. for that 1 frame when the level is loading. If this were in section #0, Demo would
  130. never be able to get a powerup higher than a mushroom because she would constantly
  131. be filtered to bigness.
  132.  
  133.  
  134. ///--Basic filter script 2--///
  135.  
  136. #-1
  137. FilterMount,0,0,0,0,0,0
  138. #END
  139.  
  140. Same thing as filter 1, except it deletes your mount/yoshi/shoe if you have one.
  141.  
  142.  
  143. ///--Basic filter script 3--///
  144.  
  145. // Section 2
  146. #2
  147. FilterReservePowerup,0,0,0,0,180,0
  148. #END
  149.  
  150. Let's change things up. The designator is now section 2, and the active time is 180.
  151. That means when you enter section 2, the player will constantly have his reserve
  152. powerup removed over the span of 3 seconds. Why you would actually do this is
  153. another story.
  154.  
  155.  
  156. ///--Bad Example--///
  157. #-1
  158. InfiniteFlying,0,0,0,0,0,0
  159. #END
  160.  
  161. This is a bad example because the command exists in the level load section. This
  162. command in particular doesn't work unless it's continuously active, and in the level
  163. load section it won't actually do anything. It should be under #0
  164.  
  165.  
  166. ///--Multi character filter--///
  167. #-1
  168.  
  169. // Filter Raocow to Demo
  170. FilterPlayer,0,4,1,0,0,0
  171.  
  172. // Filter Princess to Demo
  173. FilterPlayer,0,3,1,0,0,0
  174.  
  175. #END
  176.  
  177. This example removes the possibility of Raocow or Princess being in your level.
  178. FilterPlayer only has 3 relevent parameters. #2 is the character you want to filter
  179. out, and #3 is the character you want it to filter to. 1 is Demo, 2 is Iris, etc.
  180. #5 is the active time as usual, but since it's the load level section, any amount is
  181. fine.
  182.  
  183.  
  184. ///--Fairness---/// (lunadll version 7+)
  185. #0
  186. ClearInputString,0,0,0,0,0,0
  187. #END
  188.  
  189. What might that do? #0 is the always section, and ClearInputString... clears the
  190. keyboard input buffer. With an active time of 0, it never stops. The keyboard
  191. input buffer is filled with keyboard strokes and used to identify when a cheat code
  192. is entered. Clearing it constantly means no one will be able to enter a cheat code.
  193.  
  194.  
  195. ///--Full level--///
  196. #-1
  197.  
  198. // Filter Demo to Sheath
  199. FilterPlayer,0,1,5,0,0,0
  200.  
  201. #0
  202. // Print the word "HI" at x:300 y:300 on the screen, with font 3
  203. ShowText,0,300,300,3,0,Hi
  204.  
  205. #1
  206.  
  207. ShowText,0,200,400,3,0,ISN'T IT HARD TO SEE WITH ALL THIS TEXT IN THE WAY?
  208.  
  209. #2
  210. // Filter a bunch of stuff and play sound effect ID 10 for no reason
  211. SFX,10,0,0,0,0,0
  212. FilterToSmall,0,0,0,0,1,0
  213. FilterReservePowerup,0,0,0,0,1,0
  214. FilterMount,0,0,0,0,1,0
  215.  
  216. #END
  217.  
  218. This is mainly here to illustrate the syntax of having a bunch of different things
  219. in one script (basically there aren't many rules in the way of syntax)
  220.  
  221.  
  222. ///--Modify boss life--///
  223. #1
  224. // Set the hit counter of NPCs of type 209 (mother brains) in section 1 to 9 hits
  225. AT_SetHits,209,1,9,0,1,0
  226. #END
  227.  
  228. NPCs in this game don't have health. They have a hit counter. So a mother brain
  229. with 9 hits has 1 hit left. A birdo with 1 hit has 2 hits left. A mother brain
  230. with -10 hits has 20 hits left. Only NPCs that can normally get hit more than
  231. once can have their hit counts manipulated. To find the NPC ID of an NPC, check
  232. the graphics folder or a list of NPC IDs. Currently there's no way to specify
  233. one single NPC among many that may be in your level. The command runs for every
  234. NPC of the type you specify. This goes for all NPC and block commands actually.
  235.  
  236.  
  237. ///--Trigger an event--/// (lunadll version 7+)
  238. #1
  239. TriggerSMBXEvent,0,0,0,0,1,MyEvent
  240. #END
  241.  
  242. This will start the event named "MyEvent" (assuming you put such an event in
  243. your level). Pretty simple.
  244.  
  245.  
  246. ///--Is this working?--///
  247. #0
  248. // Show script info on the screen
  249. DebugPrint,0,0,0,0,0,0
  250. #END
  251.  
  252. DebugPrint is a command that prints some basic info about how the scripts are
  253. running. It's useful for figuring out whether lunadll is even working at all.
  254. If you see it reporting that thousands of events are being spawned for no
  255. good reason, you should probably recheck your script.
  256.  
  257.  
  258. ///--Double the player's lives--///
  259. #1
  260.  
  261. // Multiply the decimal amount at memory location 0x00B2C5AC by 2
  262. MemAssign,0x00B2C5AC,2,3,0,1,f
  263.  
  264. #END
  265.  
  266. This is a memory manipulation command, and it's the most complicated thing you're
  267. going to find in here. You can skip this part and just not use direct memory
  268. manipulation commands and do just fine.
  269.  
  270. MemAssign performs an operation on a selected memory location in a global variable
  271. section. The game remembers all sorts of things in this space. Lives, coins,
  272. the state of switches, timers for everything, score, pointers to level names,
  273. directory names, state info like whether or not you're in the editor, in battle
  274. mode, how many players there are, how many npcs there are...
  275.  
  276. Unfortunately, there's no way to be sure which memory location contains what
  277. information, unless you poke around in a debugger or scan memory. 0x00B2C5AC
  278. just happens to be where the lives counter is always located.
  279.  
  280. If you know the address of something and the format, you can do basic operations
  281. on it with MemAssign. The 3rd parameter in 0x00B2C5AC,2,3 is the 3, which is the
  282. operation to perform, here being multiply. The 2nd is 2, meaning multiply by 2.
  283.  
  284. 0 = Assign
  285. 1 = Add
  286. 2 = Subtract
  287. 3 = Multiply <<
  288. 4 = Divide
  289. 5 = XOR
  290.  
  291. MemAssign,0x00B2C5AC,2,3 means multiply the value at 0x00B2C5AC by 2.
  292.  
  293. MemAssign,0x00B2C5AC,2,2 would be subtract lives by 2.
  294.  
  295. MemAssign,0x00B2C5AC,2,1 would be add 2 extra lives.
  296.  
  297. MemAssign,0x00B2C5AC,2,0 would be set player's lives to 2.
  298.  
  299. MemAssign,0x00B2C5AC,2,3,0 - The 4th param is 0 since it's unused
  300.  
  301. MemAssign,0x00B2C5AC,2,3,0,1 - An active time of 1. More would keep multiplying
  302. the value by 2 and it would quickly max at 99.
  303.  
  304. MemAssign,0x00B2C5AC,2,3,0,1,f - Unfortunately memory is not packed evenly. You
  305. need to know the size of the data you're trying to manipulate. For lives, it just
  306. so happens that they're a decimal / floating point value (which is odd considering
  307. lives are one thing you'd always expect to be a whole number). So the last param
  308. specifies what kind of data is operated upon. f means floating point / decimal
  309. operation.
  310.  
  311. b - 1 byte
  312. w - 2 byte (word)
  313. dw- 4 byte (double word)
  314. f - 4 byte decimal / floating point
  315. df- 8 byte decimal / double precision floating point
  316.  
  317. 1 byte memory is rarely used in this game. 2 byte words are used for many things.
  318. 4 byte double words aren't used that often and when they are it's usually something
  319. you don't WANT to manipulate this way. The decimal types are very often used for
  320. spatial positions of things on the game map.
  321.  
  322.  
  323. - Custom Events -
  324.  
  325. There are many actions you can do with all these commands, but the "time" part
  326. the equation will be lacking unless there are more ways to trigger them besides
  327. entering sections.
  328.  
  329. Any commands designated under a section header higher than 999 will be marked
  330. as a custom event block.
  331.  
  332. // Custom event block 1000. It plays sfx 10 when activated.
  333. #1000
  334. SFX,10,0,0,0,0,0
  335.  
  336. // Custom event block 1001. It plays sfx 11 and kills you when activated.
  337. // It also calls the delete command on this whole block, so it can't be
  338. // activated any more. (lunadll version 7+)
  339. #1001
  340. SFX,11,0,0,0,0,0
  341. Kill,0,0,0,0,1,0
  342. DeleteEventsFrom,1001,0,0,0,1,0
  343.  
  344. These are two examples of custom event blocks. They need something to trigger
  345. them though. There are many commands that trigger custom events on a condition.
  346.  
  347. Trigger - All it does is trigger a custom event.
  348. Timer - It can trigger a custom event when it counts down to 0.
  349. BlockTrigger - It can trigger an event when the target touches a certain block.
  350. OnInput - Trigger an event when you press a certain something (lunadll 7+)
  351. OnCustomCheat - Trigger an event when you type something (lunadll 7+)
  352.  
  353.  
  354. ///--Cheat a layer--///
  355. #0
  356. // Wait for you to type "go", then activates custom event 1000
  357. OnCustomCheat,0,0,0,1000,0,go
  358.  
  359. #1000
  360. // Set layer3 X speed to 2.5 (assuming you added blocks to layer number 3)
  361. LayerXSpeed,3,0,0,0,0,2.5
  362.  
  363. #END
  364.  
  365. Really it's self explanatory. Just type "go" and the layer command is run.
  366. By the way, layer 0 is "default" layer, so 3 is the first custom layer you can
  367. make.
  368.  
  369. There's actually a terrible problem here. The layer command is set to have
  370. infinite time. If you type "go" about 15,000 times, your game will start
  371. to lag because there are 15,000 commands being run per frame. When you
  372. trigger a custom event, it actually means the event is copied into the
  373. "always section", so events are like blueprints. The solution is to lower the
  374. active time. 1 is fine since the layer doesn't stop.
  375.  
  376.  
  377. ///--Player switch--/// (lunadll 7+)
  378. #0
  379.  
  380. // When tapping up, copy event 1000
  381. OnInput,0,1,1,1000,0,0
  382.  
  383. #1000
  384. // If tapping up again in the next 10 frames, copy event 1001
  385. OnInput,0,1,1,1001,10,0
  386.  
  387. #1001
  388. // Event 1001, switch to next player and play sound
  389. CyclePlayerRight,0,0,0,0,1,0
  390. SFX,0,13,0,0,0,0
  391.  
  392. #END
  393.  
  394. Now it's getting complicated.
  395.  
  396. OnInput triggers when you press a certain button. Param2 is 1, which is "up".
  397. Param3 is also 1, which means it only detects the key press, not holding them
  398. down. With this behavior you can simulate the detection of double taps (or more).
  399.  
  400. In this code, When you push up the first time, another OnInput (event 1000) is
  401. activated for 10 frames. This also waits for an up key press. If you successfully
  402. double tap, finally, event 1001 is triggered, which switches the character.
  403.  
  404.  
  405. ///--Suicide dance--/// (lunadll 7+)
  406. #0
  407.  
  408. // When tapping up, copy event 1000
  409. OnInput,0,1,1,1000,0,0
  410.  
  411. #1000
  412. // If tapping down in the next 20 frames, copy event 1001
  413. OnInput,0,2,1,1001,20,0
  414.  
  415. #1001
  416. // If tapping left in the next 20 frames, copy event 1002
  417. OnInput,0,3,1,1002,20,0
  418.  
  419. #1002
  420. // If tapping right in the next 20 frames, copy event 1003
  421. OnInput,0,4,1,1003,20,0
  422.  
  423. #1003
  424. // Tap jump...
  425. OnInput,0,6,1,1004,20,0
  426.  
  427. #1004
  428. // And then the dance is complete
  429. Kill,0,0,0,0,1,0
  430. DeleteEventsFrom,1003,0,0,0,1,0
  431.  
  432. #END
  433.  
  434. A big button sequence. Just a more contrived version of the last one.
  435.  
  436.  
  437. ///--Timer--///
  438. #0
  439.  
  440. // Activate #1000 after 600 frames
  441. Timer,0,1000,1,0,600,0
  442.  
  443. // Time's up
  444. #1000
  445. Kill,0,0,0,0,1,0
  446.  
  447. #END
  448.  
  449. This is mainly about Timer. Timer is a useful command for automatic
  450. repetition or... timing. It activates the custom event specified in its 2nd
  451. param whenever it reaches 0. Param 3 specifies whether or not to display
  452. the timer at the top right of the screen. Param 4 specifies whether or not
  453. the timer should reset itself whenever it reaches 0. 5 is both the frame
  454. countdown time and the time it should reset itself to if it's set to reset.
  455.  
  456.  
  457. ///--Pushable layer--///
  458. #0
  459.  
  460. //Apply permanent friction/air resistance to layer 3
  461. DeccelerateLayerX,3,0,0,0,0,0.02
  462.  
  463. //Trigger event 1000 when wooden square pushed from right
  464. BlockTrigger,0,1,2,1000,0,0
  465.  
  466. //Trigger event 1001 when wooden square pushed from left
  467. BlockTrigger,0,1,4,1001,0,0
  468.  
  469.  
  470. //Move layer left, stop when length runs out
  471. #1000
  472. AccelerateLayerX,3,-2,0,0,2,-0.1
  473.  
  474. //Move layer right, stop when length runs out
  475. #1001
  476. AccelerateLayerX,3,2,0,0,2,0.1
  477.  
  478. #END
  479.  
  480. If you put some wood blocks (Block ID 1) on layer 3, this script will
  481. create the illusion that you're pushing them around by running into them
  482. from the sides.
  483.  
  484. DeccelerateLayerX when active slows a layer (towards 0) by the amount in
  485. param 6. This simulates something like friction/air resistance.
  486.  
  487. BlockTrigger triggers custom events when the target interacts with a certain
  488. block type from a certain direction.
  489.  
  490. BlockTrigger,0,1,2,1000,0,0
  491. 0 = player triggers the event, 1+ would be NPC IDS
  492. 1 = the Block ID
  493. 2 = The direction the block should be touched from to trigger. 1=U 2=R 3=D 4=L
  494. 1000 = The event to trigger
  495. 0 = active time (forever)
  496. 0 = unused
  497.  
  498. Accelerate layer is just the opposite of deccelerate. The second param is the
  499. max speed it'll be allowed to accelerate to.
  500.  
  501.  
  502. ///--Play custom sound effect when you collect the axe--/// (luna version 7+)
  503. #0
  504.  
  505. // Activate #1000 after getting the axe (NPC ID 178)
  506. IfNPC,178,2,0,1000,0,once
  507.  
  508. // Plays custom sound effect in the level folder "kefka.wav"
  509. #1000
  510. SFX,0,0,0,0,1,kefka.wav
  511.  
  512. #END
  513.  
  514. IfNPC triggers an event based on an NPC condition. 178 means the condition is
  515. for axe NPCs. 2 means "no longer exists", so it triggers once the axe is gone.
  516.  
  517.  
  518. ///--Infinite looping gimmick--///
  519. #0
  520.  
  521. // Just starts the looping events with #1000
  522. Trigger,0,1000,0,0,0,0
  523.  
  524. // All enemies friendly, and trigger 1001
  525. #1000
  526. Timer,0,1001,1,0,200,0
  527. NPCMemSet,-1,0x46,0xFFFF,0,200,short
  528. ShowText,0,400,550,3,200,YAY!
  529.  
  530. // All enemies unfriendly, and trigger 1000
  531. #1001
  532. Timer,0,1000,1,0,200,0
  533. NPCMemSet,-1,0x46,0x0000,0,200,short
  534. ShowText,0,400,550,3,200,GRR!
  535.  
  536. #END
  537.  
  538. Starts the friendly enemy event, which calls the unfriendly enemy event when it
  539. ends, which calls the friendly enemy event again when that ends. Loops forever.
  540. Check the reference to be sure about NPCMemSet and IfNPC.
  541.  
  542.  
  543. ///--Judgement--/// (luna version 7+)
  544. #0
  545.  
  546. // Constantly check if 0x00B2C8C4 equals 0xFFFF, and if so copy #1000
  547. OnGlobalMem,0x00B2C8C4,0xFFFF,0,1000,0,w
  548.  
  549. // Constantly check if 0x00B2C8C4 equals 0, and if so copy #1001
  550. OnGlobalMem,0x00B2C8C4,0,0,1001,0,w
  551.  
  552. #1000
  553. ShowText,0,100,250,3,1,THOU HATH CHEATED
  554.  
  555. #1001
  556. ShowText,0,100,250,3,1,THOU HATH NOT CHEATED
  557.  
  558. #END
  559.  
  560. OnGlobalMem is a powerful trigger command that activates events based on whatever
  561. memory location you like. It just so happens that 0x00B2C8C4 is an address which
  562. contains a two byte value that represents whether or not you've entered a
  563. cheat code before. This is the memory that's checked to see if you can save,
  564. and it's cleared by the cheat which lets you save again.
  565.  
  566. OnGlobalMem,0x00B2C8C4,0xFFFF,0,1000,0,w
  567. 0x00B2C8C4 = address
  568. 0xFFFF = value to check
  569. 0 = "equals" operation. 1 checks "greater than", 2 checks "less than"
  570. 1000 = activate #1000 if the check is true
  571. 0 = last forever
  572. w = check it like a 2 byte value
  573.  
  574. Remember that either trigger is constantly being activated every frame because
  575. the test is either true or untrue, so one ShowText will be copied per frame.
  576. The ShowText commands must not have an active time of 0, because then the old
  577. ones would never expire while new ones are constantly being added ever frame.
  578. You'd end up with thousands of identical showtext commands being spawned and you
  579. would lag out really quickly.
  580.  
  581.  
  582. ///--Hide layer when player is Raocow or Sheath--/// (luna version 7+)
  583. #0
  584.  
  585. // Constantly check if player memory at 0xF0 is greater than 3, and if so copy #1000
  586. OnPlayerMem,0xF0,3,1,1000,0,w
  587.  
  588. // Trigger an smbx event, assuming you added one to your level with this name
  589. #1000
  590. TriggerSMBXEvent,0,0,0,0,1,layerhide
  591.  
  592. #END
  593.  
  594. It's almost the same as OnGlobalMem, but the player doesn't have a fixed memory
  595. address, so you use a short offset this time. It just so happens that 0xF0 is the
  596. offset to the memory which contains what character you currently are. To find more
  597. offsets, check the reference at the end of the document.
  598.  
  599. First, keep in mind that these are the character IDs
  600. 0 = invalid
  601. 1 = demo
  602. 2 = iris
  603. 3 = princess
  604. 4 = raocow
  605. 5 = sheath
  606.  
  607. OnPlayerMem,0xF0,3,1,1000,0,w
  608. 0xF0 = target is player memory offset 0xF0, which contains the character ID
  609. 3 = value to test against is 3
  610. 1 = operation to perform is "greater than"
  611. 1000 = 1000 is the event to trigger if the character ID is greater than 3
  612. 0 = active forever
  613. w = check the memory like it's a 2 byte word
  614.  
  615.  
  616. ///--The same exact thing--/// (luna version 7+)
  617. #0
  618.  
  619. InfIniteFlying,0,0,0,0,0,0
  620.  
  621. PlayerMemSet,0,+0x170,50,0,0,w
  622.  
  623. These both do the exact same thing. InfiniteFlying is just an easier to understand
  624. wrapper around the same operation.
  625.  
  626.  
  627. ///--Random refill--/// (luna version 7+)
  628. #-1
  629. // Set coins to 0 on level load
  630. MemAssign,0x00B2C5A8,0,0,0,1,w
  631.  
  632. #0
  633. // Whenever you have more than 0 coins, activate #1000
  634. OnGlobalMem,0x00B2C5A8,0,1,1000,0,w
  635.  
  636. // Continuously reset coins to 0
  637. MemAssign,0x00B2C5A8,0,0,0,0,w
  638.  
  639. #1000
  640. // Random trigger called when you get a coin.
  641. // One of four choices is chosen with an even* 25% chance.
  642. // #1003 has a 50% chance since it's listed twice.
  643. TriggerRandom,1001,1002,1003,1003,1,0
  644.  
  645. #1001
  646. // Become small
  647. FilterToSmall,0,0,0,0,1,0
  648. ShowText,0,200,200,3,60,TRIGGERING 1001
  649.  
  650. #1002
  651. // Become big
  652. PlayerMemSet,0,0x112,2,0,1,w
  653. ShowText,0,200,300,3,60,TRIGGERING 1002
  654.  
  655. #1003
  656. // Become firey
  657. PlayerMemSet,0,0x112,3,0,1,w
  658. ShowText,0,200,400,3,60,TRIGGERING 1003
  659.  
  660. #END
  661.  
  662. The comments explain it all.
  663.  
  664.  
  665. ///--Scroll text up--/// (luna version 7+)
  666. #0
  667.  
  668. // The command we'll modify
  669. ShowText,0,300,700,3,0,FAREWELL...
  670.  
  671. // This command won't be modified (and won't appear because it's off screen)
  672. ShowText,0,300,700,3,0,FAREWELL?
  673.  
  674. // Modify 3rd param, by 1, subtraction, section #0, forever, "FAREWELL..." what?
  675. ModParam,3,1,2,0,0,FAREWELL...
  676.  
  677. #END
  678.  
  679. ModParam is a powerful command that can also totally foul everything up beyond
  680. imagining. It changes the params of other commands. The challenge is identifying
  681. the commands. Param 4 and 6 are used to specify which command you're looking for.
  682. Param 4 is which # section the command is in, and Param 6 must match the text
  683. exactly of the command you want to modify. Since most commands don't use text
  684. you can just write anything in them and then match it later with ModParam.
  685.  
  686. ModParam,3,1,2,0,0,FAREWELL...
  687. 3 = modify the third param (ShowText's Y coordinate)
  688. 1 = amount to modify by
  689. 2 = modify by subtracting
  690. 0 = look in #0 for the command to modify
  691. 0 = modify forever
  692. FAREWELL... = the command to modify will have this in the text field
  693.  
  694.  
  695.  
  696.  
  697. - Reference -
  698.  
  699. Most of the structure of the player's data is known actually. You can trigger off
  700. of any of it with OnPlayerMem, or change any of it with PlayerMemSet, but a lot
  701. of them are useless or not well understood at the moment.
  702.  
  703. (qw is the same as df / double precision float)
  704.  
  705.  
  706. // - Player MOB Struct. size = 0x184 (388 bytes)
  707. //
  708. //+0x00 w = Toad doublejump ready (FFFF = true)
  709. //+0x02 w = Star sparkling effect on player
  710. //+0x04 w = Horizontal and ducking disabled (?)
  711. //+0x06 w = Ducking enabled?
  712. //+0x08 w = Water or quicksand timer
  713. //+0x0A w = Is on slippery ground
  714.  
  715. // - SHEATH
  716. //+0x0C w = Is a fairy
  717. //+0x0E w = Fairy already used this jump (1 = true)
  718. //+0x10 w = Frames until fairy runs out
  719. //+0x12 w = Sheath has a key
  720. //+0x14 w = Sheath slash cooldown timer
  721. //+0x16 w = # of hearts
  722.  
  723. // - PRINCESS
  724. //+0x18 w = Princess hover is available
  725. //+0x1A w = Holding jump button
  726. //+0x1C w = Princess hover timer
  727. //+0x1E w = Unused (not cleared on level load)
  728. //+0x20 f = Princess hover Y tremble speed
  729. //+0x24 w = Princess hover Y tremble direction
  730.  
  731. //+0x26 w = Ground item pull-up timer
  732. //+0x28 f = Ground item pull-up momentum save
  733. //+0x2A w = Unused (not cleared on level load)
  734.  
  735. //+0x2C w = Climbing related
  736. //+0x30 w = Climbing related
  737. //+0x32 w = Climbing related
  738.  
  739. //- WATER
  740. //+0x34 w = 2 when in water
  741. //+0x36 w = 0xFFFF when in water
  742. //+0x38 w = Water stroke timer (can't stroke again until 0)
  743.  
  744. //- MISC
  745. //+0x3A w = Unknown hover timer
  746. //+0x3C w = Is sliding
  747. //+0x3E w = Is generating sliding smoke puffs
  748. //+0x40 w = Climbing state (3 = climbing, 2 = pushed up against edge of climbable area)
  749. //+0x42 w = Unknown timer42
  750. //+0x44 w = Unknown flag44
  751. //+0x46 w = Unknown46 (powerup pickup related)
  752. //+0x48 w = Slope modifier
  753.  
  754. //- TANOOKI SUIT
  755. //+0x4A w = Tanooki suit statue flag
  756. //+0x4C w = Statue transform cooldown frame timer
  757. //+0x4E w = Frames spent as statue
  758.  
  759. //- SPINJUMP
  760. //+0x50 w = Spinjump flag (-1 = true)
  761. //+0x52 w = Spinjump state counter
  762. //+0x54 w = Spinjump land direction (will face this direction when landing)
  763.  
  764. // - STATES
  765. //+0x56 w = Current enemy kill combo count
  766. //+0x58 w = Ground sliding smoke puffs state
  767. //+0x5A w = Warp is nearby this player (1 = pipe, 2 = instant, 3 = door)
  768.  
  769. //+0x60 w = Has jumped
  770.  
  771. //+0x62 w = Unknown62
  772. //+0x64 w = Unknown64
  773. //+0x66 w = Unknown66
  774. //+0x68 w = Unknown68
  775. //+0x7A w = Unknown70
  776. //+0x7C w = Unknown72
  777.  
  778. // - MOUNT
  779. //+0x7E w = Mount upper X offset
  780. //+0x80 w = Mount upper Y offset
  781. //+0x82 w = Mount upper GFX index
  782. //+0x84 w = Mount item in mouth swallow timer
  783. //+0x86 w = Mount lower X offset
  784. //+0x88 w = Mount upper Y offset
  785. //+0x8A w = Mount lower GFX index
  786. //+0x8C w = Unknown82
  787. //+0x8E w = Unknown82
  788. //+0x90 qw = Tongue X position
  789. //+0x98 qw = Tongue Y position
  790. //+0xA0 qw = Tongue height or hitbox related
  791. //+0xA8 qw = Tongue height or hitbox related
  792.  
  793. // - POSITION
  794. //+0xC0 qw = Player X position (absolute coordinates within level)
  795. //+0xC8 qw = Player Y position (absolute coordinates within level)
  796. //+0xD0 qw = Player height or hitbox related
  797. //+0xD8 qw = Player width or hitbox related
  798. //+0xE0 qw = Player X speed
  799. //+0xE8 qw = Player Y speed
  800.  
  801. //+0xF0 w = Player identity index (0 = nothing! don't use, 1 = demo, 2 = iris, 3 = princess, 5 =
  802.  
  803. sheath)
  804.  
  805. /// - KEYS -
  806. //+0xF2 w = U key pressing
  807. //+0xF4 w = D key pressing
  808. //+0xF6 w = L key pressing
  809. //+0xF8 w = R key pressing
  810. //+0xFA w = J key pressing
  811. //+0xFC w = SJ key pressing
  812. //+0xFE w = X key pressing
  813. //+0x100 w = RN key pressing
  814. //+0x102 w = SEL key pressing
  815. //+0x104 w = STR key pressing
  816.  
  817. //+0x106 w = Direction faced (-1 = left)
  818.  
  819. /// - MOUNT
  820. //+0x108 w = Mount identity (0 = no mount,1 = boot, 2 = clowcar, 3 = yoshi)
  821. //+0x10A w = Mount color
  822. //+0x10C w = Mount state
  823. //+0x10E w = Mount height offset or something
  824. //+0x110 w = Mount gfx index
  825.  
  826. /// - STATES
  827. //+0x112 w = Current powerup
  828. //+0x114 w = Current player sprite index being displayed
  829. //+0x116 w = Unused
  830. //+0x118 f = X momentum assumption (used when determining how to draw the sprite)
  831. //+0x11C w = Current upward jumping force (2 byte integer representation)
  832. //+0x11E w = Holding jump button
  833. //+0x120 w = Holding spinjump button
  834. //+0x122 w = Forced animation state (1 = powerup, 2 = powerdown, 3 = entering pipe, 4 =
  835.  
  836. getting fire flower,
  837. // 7 = entering door, 500
  838.  
  839. = tanooki statue poof state)
  840. //+0x124 f = Unknown124
  841. //+0x128 f = Unknown128
  842. //+0x12C w = Down button mirror (redundant?)
  843. //+0x12E w = In ducking state
  844. //+0x130 w = Select button mirror (redundant?)
  845. //+0x132 w = Unknown powerup change related
  846. //+0x134 w = Down button pressed this frame (reset next frame)
  847. //+0x136 w = Unknown136
  848. //+0x138 f = X momentum push (eg. pushed by a bully)
  849. //
  850. //+0x13C w = Player death state
  851. //+0x13E w = Player death animation timer
  852. //
  853. //+0x140 w = Powerup blinking timer
  854. //+0x142 w = Powerup blinking state
  855. //+0x144 w = Unknown144
  856. //
  857. // - LAYER INTERACTION
  858. //+0x146 w = Bottom state (0 = not on the ground or standing on sprite, 2 = foot contact with a
  859.  
  860. solid layer)
  861. //+0x148 w = Left state (0 = no left contact, 1 = half or pushed back by a solid layer, 2 = pushing
  862.  
  863. against layer)
  864. //+0x14A w = Top state (0 = no top contact, 1 = half or pushed back by a solid layer, 2 = pushing
  865.  
  866. against layer)
  867. //+0x14C w = Right state (0 = no right contact, 1 = half or pushed back by a solid layer, 2 =
  868.  
  869. pushing against layer)
  870. //+0x14E w = Pushed by a moving layer (0 = not pushed by any, 2 = being pushed to the left or
  871.  
  872. right)
  873. //+0x150 w = Unused150
  874. //+0x152 w = Unused152
  875.  
  876. //+0x154 w = Index of sprite being held (index to a specific sprite object that was generated only,
  877.  
  878. -1 = can't carry anything)
  879. //+0x156 w = Unknown156, usually reset to 0
  880. //+0x158 w = Powerup box contents (0 = no item)
  881. //
  882. // - SECTIONS
  883. //+0x15A w = Current section player is in
  884. //+0x15C w = Warp timer (can't warp / pipe until 0)
  885. //+0x15E w = Unknwon15E
  886. //
  887. // - PROJECTILES / ATTACKS
  888. //+0x160 w = Projectile timer (fireballs, hammers, link slash...)
  889. //+0x162 w = Projectile timer 2 (link projectiles)
  890. //+0x164 w = Tail swipe timer
  891. //+0x166 w = Unknown166
  892. //
  893. // - FLIGHT
  894. //+0x168 f = Run speed aggregate until flight achieveable
  895. //+0x16C w = Can fly
  896. //+0x16E w = Is flying
  897. //+0x170 w = Flight time remaining
  898. //+0x172 w = Holding flight run button
  899. //+0x174 w = Holding flight button
  900.  
  901. //+0x176 w = Index of sprite being stood on
  902. //+0x178 w = Unknown X momentum with sprites
  903.  
  904. //+0x17A w = Usually forced to -1
  905. //+0x17C w = Unused17C
  906. //+0x17E w = Unused17E
  907. //+0x180 w = Unused180
  908. //+0x182 w = Unused182
  909. //+0x184 w = Unused184
  910.  
  911.  
  912.  
  913. There's less information on the structure of NPC data. You can manipulate NPCs with NPCMemSet.
  914.  
  915. (pt is the same as dw)
  916.  
  917. // -- NPC structure -- ( 0x158 bytes )
  918. // 0x+00 pt = wchar_t* Attached layer name?
  919. // 0x+04 w = Unknown
  920. // 0x+06 w = Unknown decrementing timer
  921.  
  922. // +0x2C pt = wchar_t* Activate event layer name
  923. // +0x30 pt = wchar_t* Death event layer name
  924. // +0x34 pt = ptr to unknown string
  925. // +0x38 pt = wchar_t* No More Objs event layer name
  926.  
  927. // +0x3C pt = wchar_t* Attached layer name?
  928.  
  929. // 0x+44 w = Activated / interacted with player flag
  930. // 0x+46 w = Friendly (on = 0xFFFF)
  931. // 0x+48 w = Don't Move (on = 0xFFFF)
  932.  
  933. // 0x+64 w = Is a generator
  934. // 0x+68 f = Generator delay setting
  935. // 0x+6C f = Generator delay countdown
  936. // 0x+70 w = Direction to generate NPC?
  937. // 0x+72 w = Which layer to spawn NPC on
  938. // 0x+74 w = Invalidity or offscreen flag?
  939.  
  940. // 0x+78 qw = X position
  941. // 0x+80 qw = Y position
  942. // 0x+88 qw = w/h?
  943. // 0x+90 qw = h/w?
  944. // 0x+98 qw = X speed
  945. // 0x+A0 qw = Y speed
  946.  
  947. // 0x+E2 w = Sprite GFX index
  948. // 0x+E4 w = Animation frame
  949.  
  950. // 0x+E8 f = Animation timer
  951.  
  952. // 0x+FC w = Grabbable gun projectile timer
  953.  
  954. // 0x+110 f = Lakitu throw timer
  955.  
  956. // 0x+118 f = Direction faced
  957. //
  958. // 0x+124 w = Unknown
  959. // 0x+12C w = Unknown grabbing-related
  960. // 0x+12E w =
  961.  
  962. // 0x+136 w = FFFF on spawn
  963. //
  964. // 0x+146 w = Current section this NPC is on
  965. // 0x+148 f = Hit count
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement