Checkpoint Tiles in NoScroll Core

Rustocrat

New member
My question is two-fold:

1: Is it possible for me to just transplant the old "checkpoint tile" script into the NoScroll core and use it in a 4.1.5 game?

2: Is it possible for that code to be activated as an "end of text action" as well?

Basically, I'd like to be able to save my game by talking to an NPC. I figured that it would be as easy as copying the code from one of the other cores and transplanting somewhere into the NoScroll folder and then editing the list of script defines. But honestly, I figure it's probably not going to be that simple. I'd imagine that there would be some other users out there that would love to do that in their games as well. Any Ideas?
 

dale_coop

Moderator
Staff member
1) I think so, yeah.
2) Doable... The most difficult is currently we can't add end of text action. This list is fixed. So we could just modify one of the action to execute a checkpoint instead.
 

Rustocrat

New member
Interesting... I might just try the tile solution first, and experiment with the concept of editing the End of Text Actions after the contest is over, unless anyone else feels brave enough to try it.
 

Rustocrat

New member
All right, so I set the setCheckpoint.asm tile in my TileScripts folder, changed my script settings to make it my Tile Collision 02 and then this happened:

Capture-2.png


Looks like line 12 has something to do with scrolling and line 16 does... something with ChangeTileAtCollision.asm

Is there any way I can modify this to work within the NoScroll core?
 

Rustocrat

New member
Code:
	CPX player1_object
	BEQ +
	JMP dontDoCheckpoint
+

	LDA Object_x_hi,x
	STA continuePositionX
	LDA Object_y_hi,x
	STA continuePositionY
	LDA currentMap
	STA continueMap
	LDA Object_scroll,x
	STA continueScreen
	PlaySound #SND_VICTORY
	TriggerScreen continueScreen
	ChangeTileAtCollision #$00, #TILE_CHECKPOINT_CLEARED
dontDoCheckpoint:
 

dale_coop

Moderator
Staff member
You just need add a new user constant (in "Project Settings > User Constants") named "TILE_CHECKPOINT_CLEARED" with a value of "0 (the index of the tile you want to use to replace your checkpoint when removed)
 

Rustocrat

New member
OK, so now my game will compile and run as without throwing up errors, but whenever I trigger a setCheckpoint tile, none of the monsters that I placed will appear on any of my other screens. I tried switching the screen type just to make sure that it wasn't triggering the rest of my screens by mistake, but that didn't work either. When I bypass the checkpoint tile, everything spawns as it should. But when I trigger it, all other screens will not spawn monsters at all.
 

dale_coop

Moderator
Staff member
Because a check point trigger the screen.
And each screen has a "screen-type". When a screen is triggered, all others that are the same screen type will be triggered too.
And monsters on normal screen and on triggered screens are not the same.
You should change the screen-type of your screen where the checkpoint is placed (in the "screen infos", set another value... anything you want) ;)
 

Rustocrat

New member
I've done that, but I still get the same result. I set a screen to 1 and placed a checkpoint tile and the player in it and the neighboring screen to 0. I walked into 0 from 1 without triggering the checkpoint and everything spawned as expected. I returned to 1, triggered the tile and walked back to 0, and now nothing.

Here's where it gets weird, I then went to my screen set to 0 and set it to 1, and set my 1 screen to 0. Now when I hit the checkpoint on the 1 screen, things will spawn in the 0 screen just fine. So yes, hitting the checkpoint DOES trigger screens, but it looks like if it's a 0 screen, for some reason, it triggers numbered screens as well.

Or at least that's what I've found. I have yet to test it's ability to respawn the player properly.
 

dale_coop

Moderator
Staff member
The setCheckpoint script is not correct. Try this one:
Code:
: SELECT ALL
	CPX player1_object
	BEQ +
	JMP dontDoCheckpoint
+

	LDA Object_x_hi,x
	STA continuePositionX
	LDA Object_y_hi,x
	STA continuePositionY
	LDA currentMap
	STA continueMap
	LDA currentScreen
	STA continueScreen
	PlaySound #SND_VICTORY
	TriggerScreen continueScreen
	ChangeTileAtCollision #$00, #TILE_CHECKPOINT_CLEARED
dontDoCheckpoint:
 

Rustocrat

New member
It looks like it works! The problem is now that checkpoints work, I'm having trouble properly activating player death. I have my player death object set up like in all of the tutorials (Effect 0, detail pane unchanged, end animation set to "Restart Game"). For some reason, after I die nothing happens though. It does replace the player with the "player death" object effect 0, it plays the animation I have set up, but after the animation, my player's corpse just sits there on the screen and nothing happens.

Hopefully this is my fault and I just setup the Player Death object wrong, but I've gone over the tutorials numerous times and don't see where I went wrong.

Any ideas?
 

dale_coop

Moderator
Staff member
Check again your player death object... the end of animation (or end of action) set to "restart game" and animation speed or timer has a value.
Also check that the "Action Anim End 7" element in "Project Settings > Script Settings" is assign the a script that does "JSR LoseLife". And same for the "Handle Lose Life" element in "Project Settings > Script Settings" is assign to a script (that checks myLives... and do some stuffs and maybe a JSR RESET).
 

Rustocrat

New member
It looks like mine is set to Timer_DoPlayerDeath.asm. I don't plan on keeping track of "lives" so to speak. I just wan't the player to spawn at the last checkpoint. Would I just need to change that to JSR Reset instead?
 

dale_coop

Moderator
Staff member
The content of the script matters, no the name.
I think your problem is just the script assigned to the "Handle Lose Life" element in "Project Settings > Script Settings"...
It might be PlayerLoseLife.asm...
but the content might be just a
Code:
  JMP RESET
(that means reset the game)
You shoot change it for somehting like:
Code:
;;; do loss of life stuff here
	DEC myLives
	LDA myLives
	BNE gameNotOver
	;;do gameover stuff here.  Warp to screen?  Show animation?  Just restart?
	JMP RESET
	
gameNotOver:
	;;;;;
	;;; do warp to continue screen stuff here.
	LDA #$00
	STA newGameState
	LDA continueMap
	CLC
	ADC #$01
	STA temp
	GoToScreen continueScreen, temp, #$04	
	LDA #$00
	STA playerToSpawn
	;LDX player1_object
	;DeactivateCurrentObject	
	LDA #$01
	STA loadObjectFlag
	
	JSR DeactivateAllObjects
 
	LDA continuePositionX
	STA newX
	LDA continuePositionY
	STA newY	

	;; player1 reset health:
	LDA #$03		;;  <--- HERE reset with your player's Health value (for example, 3 for myHealth)
	STA myHealth
(With that, when you die, the game will continue, using the checkpoint)
 

Rustocrat

New member
WHOA, so the stupidity thickens...

I looked up the script that it points to in my script settings, and for some reason it's the script for a solid tile type. I have NO idea how it got changed (or why my dumbass did it), but I changed it back to PlayerLoseLife.asm and replaced it's contents with the code you sent.

Now it's giving me an error whenever I try to export and test, 2 lines before it refuses to compile that read:

Routines\Basic_NoScroll\ModuleScripts\HurtWinLoseDeath\PlayerLoseLife.asm(2): Unknown Label
Routines\Basic_NoScroll\ModuleScripts\HurtWinLoseDeath\PlayerLoseLife.asm(3): Unknown Label

Looks like my game doesn't dig those lines with myLives for some reason. I tried commenting out those lines and now the game compiles and the player dies and respawns, but not at the checkpoint.
Any idea what I'm doing wrong this time?
 

dale_coop

Moderator
Staff member
Perfect... we are progressing ;)
The errors means that you don't have the "myLives" variable
I would suggest you to go to "HUD & Boxes", then in the "User variables" tab... and if you don't have any "myLives" there. Just rename an unused one ("UserVar_?" ) to "myLives" with a initial value "0" (infinite... or "3" for three lives, ...)
And test again
 

Rustocrat

New member
YES!

Dale Coop with the speedy response AND the fix! Everything works fine now. The player can both die AND respawn at a checkpoint, just as it should be.

Thanks again, dude. You're the man!
 
dale_coop said:
The setCheckpoint script is not correct. Try this one:
Code:
: SELECT ALL
	CPX player1_object
	BEQ +
	JMP dontDoCheckpoint
+

	LDA Object_x_hi,x
	STA continuePositionX
	LDA Object_y_hi,x
	STA continuePositionY
	LDA currentMap
	STA continueMap
	LDA currentScreen
	STA continueScreen
	PlaySound #SND_VICTORY
	TriggerScreen continueScreen
	ChangeTileAtCollision #$00, #TILE_CHECKPOINT_CLEARED
dontDoCheckpoint:

Hey Dale, I tried this, and whenever I try to compile, I get an error

"illegal instruction" User variable is set up with the same name, so not sure what else could cause it?

EDIT: That ": SELECT ALL" was copied with it, that's not supposed to be there! Removed and fixed.

EDIT2: So I got the checkpoint working, but it's doing weird things. It's changing the colors of tiles around it, and my song stops playing when I respawn... I think that's covered in another thread, I'll try to track down.
 
Top Bottom