Locks not working

Here is the link to the wedNESday tutorial for making an Adventure game. Done something cool with it? Modified it in some way? Want to ask the community about creating additional features for it? Post things Adventure Module here!
Post Reply
TubbieRanger
Posts: 16
Joined: Sat Oct 27, 2018 7:54 pm

Locks not working

Post by TubbieRanger » Fri Nov 02, 2018 11:56 pm

Whenever I open a locked door, it warps me.
User avatar
dale_coop
Posts: 4473
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: Locks not working

Post by dale_coop » Sat Nov 03, 2018 7:35 am

When unlocked, doors tiles become warp tiles.
They are coded that way (it’s explained in the Adventure
Tutorial video)
So you need to set your screen to warp out to the next one.
If you don’t want this behavior for your game, Yoh will have to make some small modifications in certain scripts.
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE / UNDERGROUND ADVENTURE (Arcade version - Byte-Off-2019)
TubbieRanger
Posts: 16
Joined: Sat Oct 27, 2018 7:54 pm

Re: Locks not working

Post by TubbieRanger » Sat Nov 03, 2018 10:14 pm

how could I make those changes?
User avatar
dale_coop
Posts: 4473
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: Locks not working

Post by dale_coop » Sat Nov 03, 2018 10:57 pm

In the "TileScripts\LockedDoor.asm" script, change from:

Code: Select all

ChangeTileAtCollision #$02, underSecret
To:

Code: Select all

ChangeTileAtCollision #$00, underSecret  ;; <-- a null walkable tile 

And in the "Handle_CheckForTriggers.asm" script, change from:

Code: Select all

FindLockedDoorTilesTarget_onScreenLoad:
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	;; FIND TRIGGER TYPE HERE
	LDA collisionTable,y
	CMP #$03 ;; compare to locked door target type
			;; if your trigger type is NOT #$06
			;; then change this to the tile type
			;; of your trigger
	BNE notALockedDoorTarget_onScreenLoad
	LDA #$02
	STA collisionTable,y ;; collision table is changed.
						;; graphics are a little trickier

	ChangeTile #$00, underSecret
To:

Code: Select all

FindLockedDoorTilesTarget_onScreenLoad:
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	;; FIND TRIGGER TYPE HERE
	LDA collisionTable,y
	CMP #$03 ;; compare to locked door target type
			;; if your trigger type is NOT #$06
			;; then change this to the tile type
			;; of your trigger
	BNE notALockedDoorTarget_onScreenLoad
	LDA #$00  ;; <-- a null walkable tile 
	STA collisionTable,y ;; collision table is changed.
						;; graphics are a little trickier

	ChangeTile #$00, underSecret
I think it should be OK.
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE / UNDERGROUND ADVENTURE (Arcade version - Byte-Off-2019)
TubbieRanger
Posts: 16
Joined: Sat Oct 27, 2018 7:54 pm

Re: Locks not working

Post by TubbieRanger » Sun Nov 04, 2018 12:09 pm

Thank you!
User avatar
nroflmao
Posts: 40
Joined: Mon Aug 13, 2018 3:07 am
Location: Detroit, MI

Re: Locks not working

Post by nroflmao » Tue Dec 18, 2018 11:32 pm

I tried this as well but now i'm getting a problem where the tile in front of the locked door changes but the locked door stays there. Seems like its detecting the block my player is on at collision and changing that to the null tile, instead of changing the actual door to a null tile....any thoughts?
User avatar
nroflmao
Posts: 40
Joined: Mon Aug 13, 2018 3:07 am
Location: Detroit, MI

Re: Locks not working

Post by nroflmao » Wed Dec 19, 2018 12:06 am

OK I figured this one out. It seems there was a modification to the Adventure Tile Collision script from 4.0.6 to 4.0.11, so if you are using 4.0.6 the lock door works correctly, but if you are using the 4.0.11 version then the lock door affects the tile in front of the door, so you can never actually unlock it (i guess this doesn't matter if you are using warp tiles for locked doors, but if you change the default to use Null types then you are stuck). I changed mine to Null Type and found the issue. The solution that worked for me (fingers crossed) is replacing the Adventure_TileCollision.asm from 4.0.11 with the one from 4.0.6....now its working like 4.0.6 was....
it also seems like 4.0.11 changed the default unlock door to use warp tiles instead of null tiles.
Post Reply