[4.1] Adding Monster Locks for your game (Basic core)

vanderblade
Posts: 65
Joined: Mon Jan 07, 2019 5:20 am

Re: [4.1] Adding Monster Locks for your game

Post by vanderblade » Mon Jan 14, 2019 6:47 pm

My HUD is on every screen.

First is a shot before picking up the key and unlocking the key block.
Next is a shot of returning to the room to find the key block still displaying (but walkable).
Next is a shot of monster locks staying gone.
Finally, a shot, in the same dungeon, where the monster locks display still (but walkable).
Attachments
Screenshot (81).png
Screenshot (81).png (82.39 KiB) Viewed 839 times
Screenshot (82).png
Screenshot (82).png (82 KiB) Viewed 839 times
Screenshot (83).png
Screenshot (83).png (82.64 KiB) Viewed 839 times
Screenshot (84).png
Screenshot (84).png (81.02 KiB) Viewed 841 times
User avatar
dale_coop
Posts: 3956
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: [4.1] Adding Monster Locks for your game

Post by dale_coop » Mon Jan 14, 2019 6:56 pm

Interesting... looks like it's your key/door the problem, not the monster lock.
(all your screens have a different screen-type value?)
-----
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)
vanderblade
Posts: 65
Joined: Mon Jan 07, 2019 5:20 am

Re: [4.1] Adding Monster Locks for your game

Post by vanderblade » Mon Jan 14, 2019 7:04 pm

Yes, sir. Frustrating, right?
Attachments
Screenshot (85).png
Screenshot (85).png (597.97 KiB) Viewed 832 times
User avatar
dale_coop
Posts: 3956
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: [4.1] Adding Monster Locks for your game

Post by dale_coop » Mon Jan 14, 2019 7:42 pm

SOOOOOooooo frustrating
But... I think, I found what's happening, here.

For the key/door system you have to set some user constants, to have it working correctly.
I will do you some screenshots...
-----
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)
User avatar
dale_coop
Posts: 3956
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: [4.1] Adding Monster Locks for your game

Post by dale_coop » Mon Jan 14, 2019 8:07 pm

To make the door/key work correctly, you need to set the TILE_INDEX_LOCK (the door) in the "Project Settings > User Constants" (and it has nothing to do with the monster locks... You would have exactly the same issue with a freshly unzipped NESMaker 4.1)

The most difficult it to set this constant correctly ;)

In your tileset, (pixel editor, you have count the 8x8 tiles... (from 0 to 254... from left to right, and top to bottom)... to get the tile index.

Image

--> If you are using the tileset that comes with the tutorial, your door lock index might be "72". Then in the "Project Settings > User Constants", set the TILE_INDEX_LOCK to "72".

Your doors should work better.
-----
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)
vanderblade
Posts: 65
Joined: Mon Jan 07, 2019 5:20 am

Re: [4.1] Adding Monster Locks for your game

Post by vanderblade » Mon Jan 14, 2019 9:11 pm

Haha. That solved the lock block issue.

But since I used your new code for monster locks, now I have the problem of those not going away, too. Is this a user constant issue as well? With your old code, they worked perfectly.
User avatar
dale_coop
Posts: 3956
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: [4.1] Adding Monster Locks for your game

Post by dale_coop » Mon Jan 14, 2019 9:40 pm

With the old code it was working but not with the new one? I will test again.... and fix it ;)
-----
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)
vanderblade
Posts: 65
Joined: Mon Jan 07, 2019 5:20 am

Re: [4.1] Adding Monster Locks for your game

Post by vanderblade » Mon Jan 14, 2019 9:50 pm

As you can see in the screenshots, with the new code some of the monster lock graphic tiles come back when you re-enter the screen. This was not the case with your old fix.
User avatar
dale_coop
Posts: 3956
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: [4.1] Adding Monster Locks for your game

Post by dale_coop » Mon Jan 14, 2019 10:11 pm

Could we check again everything... :
- Your "COL_MONSTER_LOCK" value is "5" in the "Project Settings > User Constants" ?
- Your "TILE_MONSTER_LOCK_OFF" value is "0" in the "Project Settings > User Constants" ?
- What is the script assigned to the "Handle Monster Locks" element in the "Project Settings > Script Settings"?
- Could you share (again?) the content of that script?
- What is the script assigned to the "Handle Killed Last Monster" element in the "Project Settings > Script Settings"?
- Could you share (again?) the content of that script?
- You did not make any modification in the CheckTriggeredLoads.asm script?
- Could you share also the content of that script, just in case?

You might have something incorrect somewhere...
(I can't reproduce your problem on my adventure tutorial game)
-----
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)
vanderblade
Posts: 65
Joined: Mon Jan 07, 2019 5:20 am

Re: [4.1] Adding Monster Locks for your game

Post by vanderblade » Mon Jan 14, 2019 10:21 pm

1. COL_MONSTER_LOCK" value is set to "5" in the "Project Settings > User Constants".
2. TILE_MONSTER_LOCK_OFF" value is set to "0" in the "Project Settings > User Constants".
3. The Handle_CheckForMonsters_DC.asm script is assigned to to the "Handle Monster Locks" element in the "Project Settings > Script Settings".
4. The KilledLastMonster_DC.asm script is assigned to the "Handle Killed Last Monster" element in the "Project Settings > Script Settings".

Here is the Handle_CheckForMonsters_DC.asm.

Code: Select all

;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;
	;; monster bit is: #%00001000 
;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;To change collision type and graphic
	CountObjects #%00001000, #$00 ;; count monsters.
	LDA monsterCounter
	CLC
	BEQ doNoMoreMonsterCode
	JMP stillMonstersOnScreen_onScreenload
doNoMoreMonsterCode
	
	;;; all of the tiles you would like to change when this screen is loaded.
	;;; do this routine for:
	;;; FIRST, GET RID OF LOCKS:
	LDA update_screen
	BNE screenIsOffForMonsterCheck
	JMP doScreenOnMonsterCheck
screenIsOffForMonsterCheck:
	
	LDA showingNametable
	STA temp
	ChangeAllTilesDirect #COL_MONSTER_LOCK, #$00, #TILE_MONSTER_LOCK_OFF, temp
	JMP stillMonstersOnScreen_onScreenload
doScreenOnMonsterCheck:
	

	;;;;;===================
stillMonstersOnScreen_onScreenload:
;;;;  end what to do if no more objects
Here is the KilledLastMonster_DC.asm.

Code: Select all

;; Trigger the current screen:
	TriggerScreen screenType
	
	;; Remove all the monster locks:
	LDA showingNametable
	STA temp
	ChangeAllTiles #COL_MONSTER_LOCK, #$00, #TILE_MONSTER_LOCK_OFF, temp
Post Reply