(4.5.2) Please help me with multiple warps per screen?

TolerantX

Active member
How would I make more than 1 warp per screen? I would want to be able to warp to a bonus level from the screen and can warp back, but not be the place the warp on the screen warps to (because the warp out screen would be for another "level")? Please help me with this. Thank you. (*possibly a part of maze/adventure type module thing for people)
 

Bucket Mouse

Active member
If you really really need more than one warp, you can hard-code them. The warp script that exists now is a variable script that responds to whatever warp coordinates you have set for that screen. I'm assuming you want this extra warp to be activated by stepping on a tile. This is the existing script for the Warp Tile:

Code:
	CPX player1_object
	BNE notPlayerForWarpTile
	
	WarpToScreen warpToMap, warpToScreen, #$01
		;; arg0 = warp to map.  0= map1.  1= map2.
		;; arg1 = screen to warp to.
		;; arg2 = screen transition type - most likely use 1 here.
			;; 1 = warp, where it observes the warp in position for the player.
notPlayerForWarpTile:

But we can make a second script, using a modified version of this, that warps to a specific screen. Argument 1 is the screen to warp to, and what we need to change. So check this out:

Code:
	WarpToScreen warpToMap, #$00, #$01

If I change the variable to a specific number (NOT ON THE ORIGINAL WARP TILE, BUT OUR NEW TILE TYPE) we can make it go wherever we want. #$00 sends you to the upper left corner screen in the overworld.

So find your bonus screen and observe where it is. The overworld is on a 16 by 16 grid, and the numbers are in hexadecimal (1 through 9 and then A through F). So the far right corner of the first row would be #$0F. Directly below that would be $1F. And on like that....you get the idea.

This is easy to do. That's just for one extra warp though. What I don't know yet is if you have just one bonus level, or a different bonus level for each screen. To use the same script over and over, things get a bit more complicated....

Code:
	CPX player1_object
	BNE notPlayerForWarpTile
	
	LDA #$88
	CMP (whatever the variable that names the current screen is called)
	BNE notbonus1
	
	LDA #$F0
	STA bonusWarp
	
	notbonus1:
	
	LDA #$89
	CMP (whatever the variable that names the current screen is called)
	BNE notbonua2
	
	LDA #$F1
	STA bonusWarp
	
	notbonus2:
	
	WarpToScreen warpToMap, bonusWarp, #$01
		;; arg0 = warp to map.  0= map1.  1= map2.
		;; arg1 = screen to warp to.
		;; arg2 = screen transition type - most likely use 1 here.
			;; 1 = warp, where it observes the warp in position for the player.
notPlayerForWarpTile:

What'd I do here? I made a variable in Project Settings > User Variables called bonusWarp. For every bonus screen you create, you have to use a different warp, so we have to make this cascading script where the program keeps checking the number of your current screen to the number of each screen that a bonus warp should be on. If it hits one of the matches, it loads bonusWarp with the number of the warp-to screen and then warps you there.

Unfortunately, they changed the name of the "current screen" variable in 4.5 and I don't know what it is. I can't find it. The closest equivalent I could find was "currentNametable" and that doesn't sound right to me. So this is incomplete and you shouldn't use it until Dale comes around, who knows more than me.
 

TolerantX

Active member
Thank you. Yes I want something like a cascading script for coordinates. Like the underworld a row of "*rooms*" designated for bonus levels. I want the fewest amount of scrpts for this as possible as not to use a new script for each and every bonus warp. I was hoping to do lime a checkpoint too so the player will warp back after the bomus level. Though i might be better off just doing bonus levels between levels like most older games do.
 

Bucket Mouse

Active member
I found the variable's name. It's camScreen (meaning the screen that's currently on camera).

So if you check camScreen against the rooms you want warps in, this should work.
 
Top Bottom