Simple Autotext/Cutscenes [4.15]

Bucket Mouse

Active member
Okay, two new problems:

1: Go To Warp doesn't work as an AI action either, even though this one is built into the program already. Instead of the coordinates you have entered, it warps you to some place a few screens off. I remember having this problem with the PRGE demo, and duct-taping the issue by putting a warp tile on the spot of the wrong screen where the player appeared, which led to the right screen. But is there a better fix?

2: DeactivateCurrentObject seems to deactivate the player.....forever? That doesn't make any sense. Yet when I warp to a screen that is not tagged with screentype 249, the player sprite does not reappear. Shouldn't it be reloading every sprite on every screen?
Ironically, the Go To Warp AI actually goes to the right place when this happens. So somehow the issue with Go To Warp AI is related to the player sprite, which I don't understand.

I could add another screen type that reactivates the player sprite, but the command for that is more complicated. Tried this:

Code:
	CPX player1_object
	BNE +
	LDA screenType
	CMP #$F9 ;; #249 ;whatever screen type you want
	BNE +
	DeactivateCurrentObject
	RTS
	+
	CMP #$F8 ;; #248
	BNE ++
	LDX player1_object
	LDA Object_x_hi,x
	STA temp
	LDA Object_y_hi,x
	STA temp1
	
	CreateObject temp, temp1, player1_object, #$00, currentNametable
	RTS
	++
This is supposed to redraw the player if the screentype is 248. But it doesn't work.
 

dale_coop

Moderator
Staff member
1) For your warp: http://nesmakers.com/viewtopic.php?f=60&t=2540&p=15863


2) This code is correct:
Code:
	LDA screenType
	CMP #$F9 ;; #249 ;whatever screen type you want
	BNE +
	LDX player1_object
	DeactivateCurrentObject
	+
You don't need to add the code to recreate the player... it's (almost) automatically created (it will be after you fix the warp with my link for 1)
 

Bucket Mouse

Active member
Fixing the warp did the trick. The altered code you posted made ALL the sprites disappear though. The solution was the code from the first post in this topic combined with the warp fix.
 

Hippokittie

Member
Following through with the tutorial here, I am finding (with both codes) that the sprite for my character is still drawn, and when Hide Hud is active it freezes the game. Also, when the text is printing, it draws blue lines through the entire text box?
 

Hippokittie

Member
Here is my code for the textaction

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     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

Here is my code for the hide hud stuff

Code:
HandleHudData:
	LDA screenFlags
	AND #%00000001
	BEQ +
	RTS
+
	LDA textboxHandler
	BEQ +
	RTS
+

	LDA HudHandler
	AND #%10000000
	BNE +
	RTS
+
	;; we may have to test to see if any other tiles are updating this frame.
	;; and skip if there are tiles updating.
	;; NOW let's find which element might be updating.
	LDA ActivateHudUpdate
	BEQ + ;; hud is not currently being updated
	;; HUD IS being currently activated
	JMP UpdateHudTiles
+ 
	;;;;;;;;;;;;;;;;;; FIRST, reset values:
	LDA #$00
	STA updateCHR_counter
	STA updateCHR_offset
	STA hudElementTilesMax	;; dale_coop fix for the hud updating issue (when 2 updates called at the same time)
	
;;; CHECK FIRST ELEMENT
	LDA DrawHudBytes
	AND #%10000000 
	BEQ +
	;; do first element
	LDY #$00
	JSR LoadHudElementInfo
	LDA #BOX_0_ASSET_0_STRING
	STA updateHUD_STRING
	LDA #BOX_0_ASSET_0_IMAGE
	STA updateHUD_IMAGE
	HudUpdateForNumericDisplay #BOX_0_ASSET_0_STRING
	JMP UpdateHudTiles
+
;;; CHECK SECOND ELEMENT
	LDA DrawHudBytes
	AND #%01000000 
	BEQ +
	;; do second element
	LDY #$01
	JSR LoadHudElementInfo
	LDA #BOX_0_ASSET_1_STRING
	STA updateHUD_STRING
	LDA #BOX_0_ASSET_1_IMAGE
	STA updateHUD_IMAGE
	HudUpdateForNumericDisplay #BOX_0_ASSET_1_STRING
	JMP UpdateHudTiles
+
+++++
;;; CHECK THIRD ELEMENT
	LDA DrawHudBytes
	AND #%00100000 
	BEQ +
	;; do third element
	LDY #$02
	JSR LoadHudElementInfo
	LDA #BOX_0_ASSET_2_STRING
	STA updateHUD_STRING
	LDA #BOX_0_ASSET_2_IMAGE
	STA updateHUD_IMAGE
	HudUpdateForNumericDisplay #BOX_0_ASSET_2_STRING
	JMP UpdateHudTiles
+
;;; CHECK FOURTH ELEMENT
	LDA DrawHudBytes
	AND #%00010000
	BEQ +
	;; do fourth element
	LDY #$03
	JSR LoadHudElementInfo
	LDA #BOX_0_ASSET_3_STRING
	STA updateHUD_STRING
	LDA #BOX_0_ASSET_3_STRING
		LDA #BOX_0_ASSET_3_IMAGE
	STA updateHUD_IMAGE
	HudUpdateForNumericDisplay #BOX_0_ASSET_3_STRING
	JMP UpdateHudTiles
+
;;; CHECK FIFTH ELEMENT
	LDA DrawHudBytes
	AND #%00001000 
	BEQ +
	;; do fifth element
	LDY #$04
	JSR LoadHudElementInfo
	LDA #BOX_0_ASSET_4_STRING
	STA updateHUD_STRING
		LDA #BOX_0_ASSET_4_IMAGE
	STA updateHUD_IMAGE
	HudUpdateForNumericDisplay #BOX_0_ASSET_4_STRING
	JMP UpdateHudTiles
+
;;; CHECK SIXTH ELEMENT
	LDA DrawHudBytes
	AND #%00000100 
	BEQ +
	;; do sixth element
	LDY #$05
	JSR LoadHudElementInfo
	LDA #BOX_0_ASSET_5_STRING
	STA updateHUD_STRING	
	LDA #BOX_0_ASSET_5_IMAGE
	STA updateHUD_IMAGE
	HudUpdateForNumericDisplay #BOX_0_ASSET_5_STRING
	JMP UpdateHudTiles
	
+
;;; CHECK SEVENTH ELEMENT
	LDA DrawHudBytes
	AND #%00000010
	BEQ +
	;; do seventh element
	LDY #$06
	JSR LoadHudElementInfo
	LDA #BOX_0_ASSET_6_STRING
	STA updateHUD_STRING
		LDA #BOX_0_ASSET_6_IMAGE
	STA updateHUD_IMAGE
	HudUpdateForNumericDisplay #BOX_0_ASSET_6_STRING
	JMP UpdateHudTiles
+
;;; CHECK EIGHTH ELEMENT
	LDA DrawHudBytes
	AND #%00000001 
	BEQ +
	;; do eigthth element.
	LDY #$07
	JSR LoadHudElementInfo
	LDA #BOX_0_ASSET_7_STRING
	STA updateHUD_STRING
		LDA #BOX_0_ASSET_7_IMAGE
	STA updateHUD_IMAGE
	HudUpdateForNumericDisplay #BOX_0_ASSET_7_STRING
	JMP UpdateHudTiles
+
	
	;; end of checking element bits.
	RTS
	
	
	
UpdateHudTiles:
	
	;;; one of the hud bits was flipped.
	;;; now we have all the necessary data to do the update
	;;; FIRST check the type of asset.
	LDA updateHUD_ASSET_TYPE
	BEQ + ;; is not zero asset type
	JMP notHudElement0
+
	;;;; generally, this is for the Var Image type.
	.include SCR_HUD_ELEMENT_0
	;;; rts is in the script
notHudElement0:
	CMP #$01
	BEQ +
	JMP notHudElement1
+

	.include SCR_HUD_ELEMENT_1
	;; rts is in the script
notHudElement1:
	CMP #$02
	BEQ +
	JMP notHudElement2
+
	.include SCR_HUD_ELEMENT_2
	;; rts is in the script
notHudElement2:
	;;; elements 1 and 2 have no mid-frame updates.
	CMP #$03
	BEQ +
	JMP notHudElelement3
+
	.include SCR_HUD_ELEMENT_3 
	;;; rts is in the script
	
notHudElelement3:

HandleHudData_direct:


SkipHandleHudData:

	RTS
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
LoadHudElementInfo:
	;;; hud element loaded into y.
	LDA HudActive,y
	STA updateHUD_active
	LDA HudInverse,y
	STA updateHUD_inverse
	LDA HudAssetTypes,y
	STA updateHUD_ASSET_TYPE
	LDA HudAssetX,y
	STA updateHUD_ASSET_X
	LDA HudAssetY,y
	STA updateHUD_ASSET_Y
	;LDA HudImage,y
	;STA updateHUD_IMAGE
	LDA HudBlank,y
	STA updateHUD_BLANK
	LDA HudRow,y
	STA updateHUD_ROW
	LDA HudColumn,y
	STA updateHUD_COLUMN
	LDA HudMaxValue,y
	STA hudElementTilesFull
	RTS
	
	
	
	
	
GetHudDrawPositionAndOffset:
	;; keep in mind, a HUD will always be in the first nametable.
	LDA #BOX_0_ORIGIN_X
	STA tileX
	LDA #BOX_0_ORIGIN_Y
	STA tileY 
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	JSR coordinatesToMetaNametableValue
	;; establishes updateNT_pos and updateNT_pos+1
	;;; FIRST, IF this has been tripped, blank all of the values
	LDA updateHUD_ASSET_Y
	ASL
	ASL
	ASL
	ASL
	ASL
	STA temp
	ORA updateHUD_ASSET_X
	STA temp
	
	LDA updateHUD_ASSET_Y
	LSR 
	LSR
	
	STA temp1
	
	LDA updateNT_pos 
	CLC
	ADC temp
	CLC
	ADC updateHUD_offset
	STA updateHUD_fire_Address_Lo
	LDA updateNT_pos+1
	ADC temp1
	STA updateHUD_fire_Address_Hi
	RTS

Here is my hide sprite code

Code:
HandleDrawingSprites:
	;;; HANDLE HURT FLICKER
	;;;;; if you don't want your objects to flicker when hurt, delete this block
	;;; also look down for another block when drawing y value
	LDA Object_status,x
	BNE objectNotDeactivated
	RTS

CPX player1_object
	BNE +
	LDA screenType
	CMP #$F9 ;; #20 ;whatever screen type you want
	BNE +
	DeactivateCurrentObject
	RTS
	+

objectNotDeactivated:


	LDA Object_status,x
	AND #HURT_STATUS_MASK
	BEQ ignoreHurtFlicker
	LDA vBlankTimer
	AND #%00000001
	BEQ ignoreHurtFlicker
	LDA #$01
	STA DrawFlags ;; if DrawFlags is 1, do flicker.  If 0, do not.
	JMP gotFlickerValue
ignoreHurtFlicker:
	LDA #$00
	STA DrawFlags
gotFlickerValue:
	;;;;;;;;;;;;;;;;;;;;;;;;;;;
	;;; END HANDLE HURT FLICKER
	
	
	;; still at the *object* level right now.
	LDA Object_type,x
	CMP #$10
	BCC dontAddTilesetOffset
	;; this offset is added for monsters.
	LDA #$80
	STA tileset_offset
	JMP gotTilesetOffset
dontAddTilesetOffset:
	LDA #$00
	STA tileset_offset
gotTilesetOffset:
	LDA gameHandler
	AND #%10000000 ;; is updating sprites turned on
	BNE skipGettingStartingOffset
	RTS ;; draw no sprites
skipGettingStartingOffset:
	LDY Object_type,x
	LDA ObjectSize,y
	AND #%00000111
	STA tempy ;; is good for height
	LDA ObjectSize,y
	LSR
	LSR
	LSR 
	STA tempx ;; is good for width.
	STA tempz ;; double up on this one, because we'll need to restore it
			;; and won't have access to tempx anymore
			
	;; we also need to know how far beyond our offset we should be.
	;; this can be calculated by the number of ((tiles x 2) x animation offset).  We can find it with a quick loop.	
	LDA #$00
	STA sprite_tileOffset
	LDA Object_animation_frame,x
	BEQ noNeedToFactorForOffset ;; if it is zero, no need for an offset.
	STA temp2

	LDY Object_type,x
GetFrameOffset:
	LDA Object_total_sprites,y
	ASL
	CLC
	ADC sprite_tileOffset
	STA sprite_tileOffset
	DEC temp2
	LDA temp2
	BNE GetFrameOffset

;;;now temp should contain the offset.
noNeedToFactorForOffset:

	
	
	
	;; we want to cycle forward through the sprites if odd frame, backwards through the sprites if even frame?
	;; first, we need to determine where our starting position is:
	LDA Object_movement,x
	AND #%00000111 ;; this is where we'll store direction
	STA temp
	;;;;;multiply that by 8 (directions) to get the starting point of pointers.
	;; so we have to do a quick look up of the anim speed table.
	;; bits 7654 represent the offset, while 3210 represent the animation speed.
	LDA Object_animation_offset_speed,x
	LSR
	AND #%11111000
	CLC 
	ADC temp
	;;; effectively, we're shifting the offset 4 bits,
	;; but then multiplying it by 8 since each "action offset" is 8 values (one for each direction)
	;; so this is a shortcut.  
	
	TAY
	
	
	
	
	LDA Object_x_hi,x
	SEC
	SBC xScroll
	STA spriteDrawLeft
	
	LDA Object_table_lo_lo,x
	STA temp16
	LDA Object_table_lo_hi,x
	STA temp16+1
	LDA (temp16),y

	STA sprite_pointer
	
	LDA Object_table_hi_lo,x
	STA temp16
	LDA Object_table_hi_hi,x
	STA temp16+1
	LDA (temp16),y
	STA sprite_pointer+1
	

	
	;;;now we have the right grouping for the right direction for the right object.

	;; now, should be able to run right through the values pretty easily.
	;; we're going to pick up wherever the last object left off drawing
	LDA Object_x_hi,x
	SEC
	SBC xScroll
	STA temp1 ;; this will be used to keep track of horizontal placement, increasing by 8 and 
				;; decreaseing tempx to see if we're out of horizontal spacing.
	LDA Object_y_hi,x
	sec
	sbc #$01
	STA temp2	;; this will be used to keep track of vertical placement, increasing by 8 and
				;; decreasing tempy to see if we're out of vertical spacing (ie-done).
	
;;;; FIND OUT IF THIS SPRITE SHOULD BE DRAWN BEHIND THE BACKGROUND	
	 LDA Object_state_flags,x
	AND #%00100000
	 STA temp3  ;; holds whether or not this object's sprite is drawn behind backgrounds.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	TXA
	PHA

	LDY #$00
	LDA (sprite_pointer),y
	STA objectFrameCount
	
	LDX spriteOffset 
	LDA sprite_tileOffset  
	CLC 
	ADC #$01
	TAY
DrawSpritesForThisObjectLoop:
	LDA DrawFlags ;; are we flickering?
	BEQ noFlicker
	LDA #$fe
	JMP drawTileOffScreen_flicker
noFlicker:
	LDA temp2 ;; LDA the y value, not drawn off screen
drawTileOffScreen_flicker:
	STA SpriteRam,x ;; store it to the y value byte for this sprite
	INX ;; increase the index to draw to
	LDA (sprite_pointer),y  ;; load the table pointer to the tile number
	CLC
	ADC tileset_offset

	STA SpriteRam,x ;; store to the tile index
	INX ;; increase index
	INY ;; increase the position to read in the table (which alternates tile/attribute)
	LDA temp3
	ORA (sprite_pointer),y ;; load the table pointer to the attribute
	STA SpriteRam,x ;; store it to the attribute index
	INY ;; increase the position to read in the table...this next value is for the next sprite.
	INX ;; increase index
	LdA temp1 ;; load the x value
	STA SpriteRam,x ;; store to the x index
	;;=======================================
	;;;; DONE WITH THIS SPRITE.
	INX  ;; increase index to get ready to draw the next sprite.
	
	DEC tempx ;; decrease the variable holding the width.
	BEQ doneWithSpriteColumns ;; if it is at zero, that means the column is over
	;;; more sprites to draw in this column.
	
	;;;;;;;;;; increase the x value to the next 'column' to draw the next sprite.
		;;;; conceivably, this is where we could put a horizontal offset. 
	LDA temp1 
	CLC
	ADC #$08   ;; each tile is 8 wide.
	STA temp1
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	JMP DrawSpritesForThisObjectLoop
doneWithSpriteColumns:
	DEC tempy ;; decrease the variable holding height
	BEQ doneDrawingThisObjectsSprites ;; if there is no horizontal, and no vertical tiles left to count
										; then this sprite is done being drawn
	;;; there are still sprites to draw here
	;;; so now, we must:
	LDA tempz
	STA tempx ;; restore the temp size of the column
	;;======= increase the y value by 8px / one tile
	LDA temp2 
	CLC
	ADC #$08
	STA temp2 
	;;==============================================
	;and
	;;======= move horizontal position back all the way to the left
	LDA spriteDrawLeft
	STA temp1
	JMP DrawSpritesForThisObjectLoop
	
doneDrawingThisObjectsSprites:
	TXA
	STA spriteOffset
	;; restore x so we're talking about the right object
	PLA
	TAX
	
	
	JSR getNewEndType
	;;;Handle This object's animation:
	;;; fist, count down the animation timer.
	DEC Object_animation_timer,x
	LDA Object_animation_timer,x
	BNE notAtEndOfFrame
	;; is at end of frame.
	LDA Object_animation_frame,x
	CLC
	ADC #$01
	CMP objectFrameCount
	BNE notTheLastFrameYet
	;; this is the last frame
	;;=========================== check for end animation
	LDA Object_end_action,x
	
	LSR
	LSR
	LSR
	LSR

	BNE checkForEndAnimType

	;;; looping type animation - just reset the frame and continue on.
	LDA #$00
	JMP notTheLastFrameYet 
checkForEndAnimType:
	JSR doMoreThanResetTimer ;; this is in handle update objects
								;;uses the same table as 
								;;action timer end
	LDA #$00 ;; to reset frames.
	;;===================================================
notTheLastFrameYet:
	STA Object_animation_frame,x
		LDA Object_animation_offset_speed,x
		;;; set the initial animation timer
		AND #%00001111 ;; now we have the animation speed value displayed in the tool
						;; are 16 values enough for the slowest?  Or do we want to have multiples?  Or maybe a table read?	
	
		;ASL
		;ASL
		ASL
		STA Object_animation_timer,x

	
notAtEndOfFrame:
	

	
	
	RTS

Am I missing something?
 

crazygrouptrio

Active member
Do you use sprite zero? I'm guessing that the game is freezing because sprite zero is being drawn but there's no hud for it to hide behind so its freezing the game (you would see that one sprite still being drawn on the frozen screen). In predraw you should see something like this:
Code:
	LDA gameState
	CMP #GS_MainGame	
	BNE + ;dont draw sprite zero
	LDA #HIDE_HUD
	BNE +
	;DrawSprite #$f8, #$1e, #$7F, #%00000000, spriteOffset
				;248   30    127   bit 5 = priority
	DrawSprite #SPRITE_ZERO_X, #SPRITE_ZERO_Y, #SPRITE_ZERO_INDEX, #%00100000, spriteOffset
	UpdateSpritePointer
;dont draw sprite zero.
+
which checks to see if Hide Hud is checked to not draw Sprite Zero, but sometimes this doesn't work for me. Sometimes it gives different results for different screens. Just before "DrawSprite #Sprite_ZERO..." you can add
Code:
LDA screenType
	CMP #$F9 ;; your screen type
	BNE +
this will check the screen type you use also to not draw sprite zero. It's just an extra contingency but sometimes it works better for me, maybe it will for you.

Which screen type are you using? You have "CMP #$F9 ;; #20 ;whatever screen type you want" in your script, which is set to 249, maybe you intended for it to be 20? Just change that to " CMP #$14 " which is 20 in Hex. Anything after a ; is irrelevant in ASM so that ;;#20 is doing nothing. Also if you change this be sure to change it in the predraw script as well if you use that.

As for the blue lines, I have no idea. I'm not the best at code :oops: hope this fixes some of your issues tho.
 

Hippokittie

Member
Update: The hide hide sprite codes are now working, where I discover that the text blocks loop after the group 0 entries are finished. I am using the update script here
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

I learned you need to set the NPC group for the text to work; but don't know how to set it so that it auto changes the group in screen(or simple trigger it to be night and have that second group used). So my work around is to create a duplicate screen and warp to it with the new group set. This works for both cutscenes for story, and level change graphics. The only concerns I have run into is I need to make an NPC for level loading screens and the music restarting loop when changing screens. I am working on a simple track that can be restarted at any point and sound like it fits to work around the musical issues. A small bug I noticed when doing my warp for graphic transitions is that it will sometimes fill the screen with garbage mix of tiles, not sure if a bug with the warp or the engine. Noted the same bug with one of my screens not set to scroll and still scrolls. Am experimenting with an auto scrolling cutscene to see if I can do away with the warping as well. I will update with what I have run into; but if you have any suggestions to help with the group change or something please let me know.
 

mouse spirit

Well-known member
Thanks for this tutorial.Everything seems to work except my textbox doesnt show up.The monster actions and warp works.I double checked my code and am not sure whats up. Also my textbox works with normal npc interaction.

Fixed:

I had my script in wrong action!



Thanks again for this post.Used this for a boss screen without warp at the end(used destroy me) so we have some banter before the fight!

But can i make the text boxes more seamless?Like faster than timer 1?
 

crazygrouptrio

Active member
mouse spirit said:
But can i make the text boxes more seamless?Like faster than timer 1?
Unfortunately thats the downside of this method. It's possible to get them closer if you get creative enough on the order the actions are executed (like using the text action on different monsters) just make sure you dont have the text action after an "end animation" because that gets things all messed up. It can be extremely confusing to coordinate as well.
I'll be honest. I came up with this method and I don't like it :lol:
 

mouse spirit

Well-known member
Thanks. It still is kinda cool with my boss monster cause he talks, then runs at me. I yell at him, we get closer then he laughs and we start the fight.So it's kinda anime like.
 

Hippokittie

Member
I noticed on doing some testing that sometimes the character will be invisible now when he dies? Is there something in the hide character script that could be doing this?
 

dale_coop

Moderator
Staff member
Hippokittie said:
I noticed on doing some testing that sometimes the character will be invisible now when he dies? Is there something in the hide character script that could be doing this?

Is it related to that autotext / cutscene topic ?
 

Hippokittie

Member
dale_coop said:
Hippokittie said:
I noticed on doing some testing that sometimes the character will be invisible now when he dies? Is there something in the hide character script that could be doing this?

Is it related to that autotext / cutscene topic ?

It has something to do with it, I believe. Much like the blue lines, it was started when following the steps in this tutorial. It also occurs sometimes when I warp to a new area, it hides my character until it dies. I have been tweaking a bit of the code to remove the blue lines (now they change colors on each screen yay), and fix the warp not showing character sometimes.
 

dale_coop

Moderator
Staff member
Make sure that you screen is no the screenType 249 (in the tutorial of this topic... if the screen is type 249 the player will be hidden)
Could be that.
 

Hippokittie

Member
dale_coop said:
Make sure that you screen is no the screenType 249 (in the tutorial of this topic... if the screen is type 249 the player will be hidden)
Could be that.

It wasn't; but by manually assigning type 1 to all of them (they had been 0 before) it seems to have fixed itself (with the invisible sprites). Still have no idea on what to do about the text having the colored lines spawn before the text and stuff though.
 

mouse spirit

Well-known member
Thank you for this but i can't get it to do the fourth text.And so it never resets to the first text,which
in turn makes it so the next time i use the autotext script,it doesnt work seemingly because its stuck after
the third text line and before activating the fourth... or something. Also after the fourth action i destroy
this object.I can see that the item gets destroyed so maybe it just skips the fourth text.
Edit: I put
Code:
LDA #$00
    STA textaction
into mosterloads to reset to text 0 atleast for now.

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
STA textVar
LDA #$01
STA npc_autotext
LDA gameHandler
ORA #%00100000
STA gameHandler
LDA #%10000000
STA textboxHandler
LDA #$00
STA textaction
RTS

 textThree:
LDA #$02
STA textVar
LDA #$01
STA npc_autotext
LDA gameHandler
ORA #%00100000
STA gameHandler
LDA #%10000000
STA textboxHandler
LDA #$03
STA textaction
RTS

 textTwo:
LDA #$01
STA textVar
LDA #$01
STA npc_autotext
LDA gameHandler
ORA #%00100000
STA gameHandler
LDA #%10000000
STA textboxHandler
LDA #$02
STA textaction
RTS

textOne:
LDA #$00
STA textVar
LDA #$01
STA npc_autotext
LDA gameHandler
ORA #%00100000
STA gameHandler
LDA #%10000000
STA textboxHandler
LDA #$01
STA textaction
RTS

dgjhfd-1.png
 

dale_coop

Moderator
Staff member
Should work, make sure you haven't set any DestroyMe in the Action Steps... and use a "WarpToScreen" for the last one.
If you placed the
Code:
LDA #$00
    STA textaction
in the correct "warp to screen" script that should be good.
 

mouse spirit

Well-known member
Thanks dale_coop.I tried and it warps fine but still just skips right over the fourth text.Maybe i did something somewhere else.My fourth text works fine when talking to a "fourth" npc.
I have made a work around and am doing it with just the first 3 texts until i figure it out.No worries.I tried alot of different things like added more actions with autotext or made the action timers slower also to no avail.

Edit: I changed the script to LDA and STA text 4 (#$03) first.
It plays text 4,2,3,4! I dont know why at all. But looks to be heading in the right direction.

Edited Edit: Ok, changed the code back, now it works.Maybe an old version of the script was loaded or it would never update.I loaded it from project settings and saved it.Whatever. Works now even with destroy me because i add that small script on load.And it works all the time.Thank you both.
 
Top Bottom