crazygrouptrio
Active member
For anyone looking for a simple or less intrusive way to make cutscenes for your game, this may be for you! Using this method you can have all 4 entries of a text group flow together (or even space them out if you prefer) without having to dig deep into the code. You could make things like this!
Short version of how this works, is we make a monster action that brings up a text entry based on a numbered variable. Each entry sets up the variable for the next entry, so we can use the same monster action over and over to bring up the next text entry within the group. Note that if you have done anything else that effects how text boxes or monster actions work this may not work. But it works fine out of the box. So let's set it up!
EDIT: Consider this method "finicky" as it seems to misbehave depending on other scripts being used. This method doesn't mess with your files much, but ALWAYS MAKE A BACKUP ANYWAY.
First we need to make two user variables:
Next we need to add the monster ai script to bring up the text.
Go ahead and save this script, then go to script settings and add it to whatever AI Action slot you have available (remember to change the project label for it as well!) As stated above, this script runs an autotext function based on what the textaction variable is set to. E.g. When it runs the first time, it sees the textaction variable is at 0, so it runs the script for bringing up text entry 1 then sets the variable to 1. So the next time this SAME action script runs it will see that the variable is set to 1 and run the script for text entry 2, and so on. Neat right?
Now we need to be able to use a button to make this text proceed. Dale Coop's script for the autotext input works here.
Go ahead and add this to your input scripts and set it to whatever button press you like. (I prefer the A button).
Now for the fun part, actually implementing this into our cutscene. We'll just do a basic setup right now. Make your monster and set up its first 4 action steps just like this.
I like to set the end action timer to 2 for some wiggle room dealing with other monster's animations, but whatever you want should be fine as long as it isn't 0. Also note DO NOT use "end animation" with monsters using the Text Action. The reason this code works is that the end action timer is put on hold while a text box is on screen, and then resumes when the text leaves. So when you set the timer, that timer won't actually start until the text entry is over. End Animation on the other hand IS NOT put on hold while text is on screen. This can mess up your timing for other actions if the player skips through the text.
So what does all this mean? Well, any other monsters actions need to be setup between text entries. Like in the example above, the face on the left is set to a talking animation in action step 1 with a timer of 1 to make sure it advances within the end of the timer of the text action monster. The 2nd action is an idle face with a timer of 3 to make sure it doesn't appear for the 2nd text entry, then advances to action step 3 talking animation again for the 3rd text entry. In short it's a lot of math and coordination between actions. I find it easier to set all my text actions to 1 monster, but you can spread the actions around to other monsters in the scene if you prefer. As long as you don't exceed 4 text actions per screen.
Make sure the last end action is a warp to screen to get off the screen (and probably shouldn't be the same action as your last text action). If you don't plan to use all 4 text entries in a screen, you may want to add these 2 lines to your Warp to Screen script:
This resets the textaction variable to 0, so the text on the next screen will start with the first text entry. The textaction script does this on its own after text entry 4, but adding it to the warp to screen would probably be more stable anyway.
Now all you need to do is use your own method for hiding the HUD and the player. For hiding the player I find adding this script near the top of DrawSprites works best:
In this instance all screens using type 249 will skip drawing the player (which also shouldn't allow the player to use controls).
That's it! I hope this helps out some of you who have been struggling with cutscenes and look forward to seeing how you're able to use this!
Short version of how this works, is we make a monster action that brings up a text entry based on a numbered variable. Each entry sets up the variable for the next entry, so we can use the same monster action over and over to bring up the next text entry within the group. Note that if you have done anything else that effects how text boxes or monster actions work this may not work. But it works fine out of the box. So let's set it up!
EDIT: Consider this method "finicky" as it seems to misbehave depending on other scripts being used. This method doesn't mess with your files much, but ALWAYS MAKE A BACKUP ANYWAY.
First we need to make two user variables:
- npc_autotext
textaction
Next we need to add the monster ai script to bring up the text.
Code:
LDA textaction
CMP #$03
BNE +
JMP textFour
+
LDA textaction
CMP #$02
BNE +
JMP textThree
+
LDA textaction
CMP #$01
BNE +
JMP textTwo
+
LDA textaction
CMP #$00
BNE +
JMP textOne
+
RTS
textFour:
LDA #$03 ;;<<-- it will use the "Text 4" of your screen
STA textVar
LDA #$01
STA npc_autotext
;; activate the text-box:
LDA gameHandler
ORA #%00100000
STA gameHandler
LDA #%10000000
STA textboxHandler
LDA #$00
STA textaction
RTS
textThree:
LDA #$02 ;;<<-- it will use the "Text 3" of your screen
STA textVar
LDA #$01
STA npc_autotext
;; activate the text-box:
LDA gameHandler
ORA #%00100000
STA gameHandler
LDA #%10000000
STA textboxHandler
LDA #$03
STA textaction
RTS
textTwo:
LDA #$01 ;;<<-- it will use the "Text 2" of your screen
STA textVar
LDA #$01
STA npc_autotext
;; activate the text-box:
LDA gameHandler
ORA #%00100000
STA gameHandler
LDA #%10000000
STA textboxHandler
LDA #$02
STA textaction
RTS
textOne:
LDA #$00 ;;<<-- it will use the "Text 1" of your screen
STA textVar
LDA #$01
STA npc_autotext
;; activate the text-box:
LDA gameHandler
ORA #%00100000
STA gameHandler
LDA #%10000000
STA textboxHandler
LDA #$01
STA textaction
RTS
Now we need to be able to use a button to make this text proceed. Dale Coop's script for the autotext input works here.
Code:
LDA textboxHandler
AND #%00010000 ;; if the b button is pressed
;; but the box + text have been activated
;; and also the 'do box' bit is OFF
;; that means this is ready to "go away".
BEQ checkToTurnTheTextboxOn ;; hasn't started yet
;; begin turning the textbox off.
LDA gameHandler
ORA #%00100000
STA gameHandler
;;; are we turning this on or off?
;;; check for more
;;; check for 'choice'.
LDA #$00
STA updateNT_offset
STA updateNT_H_offset
STA updateNT_V_offset
STA npc_autotext ;;<-- dale_coop: for autotext tiles
LDA #%10001000
STA textboxHandler
RTS
checkToTurnTheTextboxOn:
LDA npc_autotext ;;<-- dale_coop: for autotext tiles
BEQ +
JMP ++
+
LDA npc_collision
BEQ noNPCcollision
++
LDA textboxHandler
AND #%10000000
BNE noNPCcollision
LDA gameHandler
ORA #%00100000
STA gameHandler
;;; are we turning this on or off?
;;; check for more
;;; check for 'choice'.
turnTheTextboxOn:
LDA #%10000000
STA textboxHandler
noNPCcollision:
RTS
Now for the fun part, actually implementing this into our cutscene. We'll just do a basic setup right now. Make your monster and set up its first 4 action steps just like this.
I like to set the end action timer to 2 for some wiggle room dealing with other monster's animations, but whatever you want should be fine as long as it isn't 0. Also note DO NOT use "end animation" with monsters using the Text Action. The reason this code works is that the end action timer is put on hold while a text box is on screen, and then resumes when the text leaves. So when you set the timer, that timer won't actually start until the text entry is over. End Animation on the other hand IS NOT put on hold while text is on screen. This can mess up your timing for other actions if the player skips through the text.
So what does all this mean? Well, any other monsters actions need to be setup between text entries. Like in the example above, the face on the left is set to a talking animation in action step 1 with a timer of 1 to make sure it advances within the end of the timer of the text action monster. The 2nd action is an idle face with a timer of 3 to make sure it doesn't appear for the 2nd text entry, then advances to action step 3 talking animation again for the 3rd text entry. In short it's a lot of math and coordination between actions. I find it easier to set all my text actions to 1 monster, but you can spread the actions around to other monsters in the scene if you prefer. As long as you don't exceed 4 text actions per screen.
Make sure the last end action is a warp to screen to get off the screen (and probably shouldn't be the same action as your last text action). If you don't plan to use all 4 text entries in a screen, you may want to add these 2 lines to your Warp to Screen script:
Code:
LDA #$00
STA textaction
Now all you need to do is use your own method for hiding the HUD and the player. For hiding the player I find adding this script near the top of DrawSprites works best:
Code:
CPX player1_object
BNE +
LDA screenType
CMP #$F9 ;; #249 ;whatever screen type you want
BNE +
RTS
+
That's it! I hope this helps out some of you who have been struggling with cutscenes and look forward to seeing how you're able to use this!