After hours of fixing scripts, testing, I figured how to brink back the Monster Locks (tiles that are removed when all the monsters are killed).
Here's how to do...
Here, for the Adventure Module --> http://nesmakers.com/viewtopic.php?p=10841#p10841
ADD MONSTER LOCK FOR THE PLATFORMER MODULE (Basic core)
THE EASY WAY (NESMaker 4.1.3)
With a ZipScript patch:
1/ Download the ZipScript file from here: https://drive.google.com/open?id=1FtogExd20JguXVDWGgKcoJDPART-B_Ai
2/ On your scrolling game project, select the "Project > Run Project Script" menu:
And select the "ScrollingPlatform_MonsterLocks.zip" you just downloaded. Validate and after confirming the warnings message, you should have the patch installed:
3/ In your "Project Settings > User Constants", check the "TILE_MONSTER_LOCK" value and set the value corresponding to YOUR monster lock tile (in your tileset... I just count the 8x8 tiles in the tileset starting from 0. For example, mine in the GIF is the 46 ).
Now, the monster tiles should work.
If you have error to if the patch doesn't work, you could try the normal manual way.
THE NORMAL MANUAL WAY
Doing manually the modifications in some scripts:
1/ In your "Project Settings > Project Labels", renamed the unused Tile Type "14 - NULL" to "14 - Monster Lock".
2/ In your "Project Settings > User Constants", add a constant named "COL_MONSTER_LOCK" with a value of "14" (because we choosed to use 14 for our Monster Lock)
Still in your "Project Settings > User Constants", add also:
- a new constant named "TILE_MONSTER_LOCK" with a value "46" (the monster block tile in your tileset... mine is the 46. I just count the 8x8 tiles in the tileset starting from 0)
- a new constant named "TILE_MONSTER_LOCK_OFF" with a value of "0" (the tile used when the monsterLock is removed)
- a new constant named "TILE_OPENDOOR" with a value "0"
3/ Make a new script "CheckTriggeredTileLoads_DC.asm" in the "GameEngineData\Routines\Basic\System" folder, with this code:
4/ Make a new script "CheckTriggeredColLoads_DC.asm" in the "GameEngineData\Routines\Basic\System" folder, with:
5/ Modify the content of the "LoadCollisionBytes.asm" script in the "GameEngineData\Routines\Basic\System", with this code (make a copy before, to keep the original one):
6/ Make a new script, named "KilledLastMonster_DC.asm" in your "GameEngineData\Routines\Basic\ModuleScripts\MainScripts\ScrollingPlatformer" folder, with that code:
7/ In the "Project Settings > Script Settings", add a new script element (button "Add") , named it "Handle Triggered Collisions" with the code "SCR_TRIGGERED_COL_LOADS"
And assign it the script "Routines\Basic\System\CheckTriggeredColLoads_DC.asm".
8/ Also, assign the script "Routines\Basic\System\CheckTriggeredTileLoads_DC.asm" to the "Handle Triggered Tiles" element.
9/ And, assign the "KilledLastMonster_DC.asm" to the "Kill Last Monster" element:
10/ Duplicate the "HandleSpriteWeapon.asm" script located in your "GameEngineData\Routines\Basic\ModuleScripts\MainScripts\ScrollingPlatformer" folder, and name it "HandleSpriteWeapon_DC.asm".
Modify your new "HandleSpriteWeapon_DC.asm" script, around line 75, from that:
To that:
11/ In your "Project Settings > Script Settings", assign the "HandleSpriteWeapon_DC.asm" script to the "Use Sprite Based Weapon" element:
12/ Modify the "HandleHurtMonster.asm" script, that is located in the "GameEngineData\Routines\Basic\ModuleScripts\HurtWinLoseDeath" folder, around line 80, from that:
To that:
Voilà, now you can create your monster lock tiles, put it on your screen with monsters... and test
As usual the script might not be perfect, it might be some errors, might cause some issues... feel free to make modifications, fix it, ... or not using it
Note: if you are using the "Jump On Kills", you have one step more, here: http://nesmakers.com/viewtopic.php?p=10807#p10807
And here, for the Adventure Module --->> http://nesmakers.com/viewtopic.php?p=10841#p10841
UPDATES
2019/01/19:
Updated the ZipScript patch versions for NESMaker 4.1.3 (that support user constants,... now)
2019/01/16:
Added some user constants, the checkTriggeredTileLoads, checkTriggeredTColLoads, LoadCollisionBytes scripts, made modifications in the KilledLastMonster_DC and removed the Handle_CheckForMonsters_DC that is no more needed (to fix the odd number screen issue).
Updated the ZipScript patch versions.
2019/01/13:
Fixed a problem with the sprite-based weapon, that was when you killed the 1st monster the locks was removed.
Modified the script assigned to "Kill Last Monster", to not trigger the screen, by default (like in previous NESMaker versions).
Added the ZipScript patch versions.
Here's how to do...
Here, for the Adventure Module --> http://nesmakers.com/viewtopic.php?p=10841#p10841
ADD MONSTER LOCK FOR THE PLATFORMER MODULE (Basic core)
THE EASY WAY (NESMaker 4.1.3)
With a ZipScript patch:
1/ Download the ZipScript file from here: https://drive.google.com/open?id=1FtogExd20JguXVDWGgKcoJDPART-B_Ai
2/ On your scrolling game project, select the "Project > Run Project Script" menu:
And select the "ScrollingPlatform_MonsterLocks.zip" you just downloaded. Validate and after confirming the warnings message, you should have the patch installed:
3/ In your "Project Settings > User Constants", check the "TILE_MONSTER_LOCK" value and set the value corresponding to YOUR monster lock tile (in your tileset... I just count the 8x8 tiles in the tileset starting from 0. For example, mine in the GIF is the 46 ).
Now, the monster tiles should work.
If you have error to if the patch doesn't work, you could try the normal manual way.
THE NORMAL MANUAL WAY
Doing manually the modifications in some scripts:
1/ In your "Project Settings > Project Labels", renamed the unused Tile Type "14 - NULL" to "14 - Monster Lock".
2/ In your "Project Settings > User Constants", add a constant named "COL_MONSTER_LOCK" with a value of "14" (because we choosed to use 14 for our Monster Lock)
Still in your "Project Settings > User Constants", add also:
- a new constant named "TILE_MONSTER_LOCK" with a value "46" (the monster block tile in your tileset... mine is the 46. I just count the 8x8 tiles in the tileset starting from 0)
- a new constant named "TILE_MONSTER_LOCK_OFF" with a value of "0" (the tile used when the monsterLock is removed)
- a new constant named "TILE_OPENDOOR" with a value "0"
3/ Make a new script "CheckTriggeredTileLoads_DC.asm" in the "GameEngineData\Routines\Basic\System" folder, with this code:
Code:
LDA temp
CMP #TILE_INDEX_LOCK
BNE ++
LDA #TILE_OPENDOOR ;; what tile do you want under lock?
STA temp
JMP notPath
++
LDA temp
CMP #TILE_MONSTER_LOCK
BNE ++
LDA #TILE_MONSTER_LOCK_OFF ;; what tile do you want under Monster Lock?
STA temp
JMP notPath
++
4/ Make a new script "CheckTriggeredColLoads_DC.asm" in the "GameEngineData\Routines\Basic\System" folder, with:
Code:
LDA temp
CMP #COL_INDEX_LOCK
BNE ++
;;; if it was a locked tile, make sure it is
LDA #$00
STA temp ;; set it to a walkable tile.
++
LDA temp
CMP #COL_MONSTER_LOCK
BNE ++
;;; if it was a monster locked tile, make sure it is
LDA #$00
STA temp ;; set it to a walkable tile.
++
5/ Modify the content of the "LoadCollisionBytes.asm" script in the "GameEngineData\Routines\Basic\System", with this code (make a copy before, to keep the original one):
Code:
LoadCollisionBytes:
JSR LoadEvenCollisionPoint
INX
DEC updateCol_columnCounter
notEndOfColumn:
JSR LoadOddCollisionPoint
INX
DEC updateCol_columnCounter
LDA updateCol_columnCounter
BNE notEndOfColumn2
;; is end of column.
LDA updateCol_columns
STA updateCol_columnCounter
TXA
SEC
SBC updateCol_columns
CLC
ADC #$10
TAX
LDA updateCol_columns
LSR
STA temp2
TYA
SEC
SBC temp2
CLC
ADC #$08;; one more will get added below as part of flowing into notEndofColumn2
TAY
INC updateCol_rowCounter
LDA updateCol_rowCounter
CMP updateCol_rows
BEQ doneWithColBytes
notEndOfColumn2:
INY
;CPY #$78
;BEQ doneWithColBytes
JMP LoadCollisionBytes
doneWithColBytes
RTS
doEndOfColumn:
INC updateCol_rowCounter
LDA updateCol_columns
STA updateCol_columnCounter
RTS
LoadEvenCollisionPoint:
;; get the first point:
LDA (collisionPointer),y
LSR
LSR
LSR
LSR
STA temp
;;;;;;;;;;;; CHECK FOR TRIGGERED.
;;;;;;;;;;;; Do all triggered updates here.
GetTrigger
BEQ noTriggerStateEvenCollisionPoint
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; ALL POSSIBLE "CHANGE COLLISIONS", make the caveat here:
.include SCR_TRIGGERED_COL_LOADS
noTriggerStateEvenCollisionPoint:
;;; this is the first point.
LDA updateCol_table
BNE loadFirstPoint_ToSecondNametable
LDA temp
STA collisionTable,x ;; the collision table in RAM
LDA newScreen
AND #%00000001
BNE loaded_FirstPoint ;; skip checking for prize counter.
LDA temp
CMP #COL_INDEX_PRIZE
BNE +
INC screenPrizeCounter
+
JMP loaded_FirstPoint
loadFirstPoint_ToSecondNametable:
LDA temp
STA collisionTable2,x
LDA newScreen
AND #%00000001
BEQ loaded_FirstPoint ;; skip checking for prize counter.
LDA temp
CMP #COL_INDEX_PRIZE
BNE +
INC screenPrizeCounter
+
loaded_FirstPoint:
RTS
LoadOddCollisionPoint:
LDA (collisionPointer),y
AND #%00001111
sta temp
GetTrigger
BEQ noTriggerStateOddCollisionPoint
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; ALL POSSIBLE "CHANGE COLLISIONS", make the caveat here:
.include SCR_TRIGGERED_COL_LOADS
noTriggerStateOddCollisionPoint:
LDA updateCol_table
BNE update_CollisionTable2_2
LDA temp
STA collisionTable,x
LDA newScreen
AND #%00000001
BNE loaded_SecondPoint ;; skip checking for prize counter.
LDA temp
CMP #COL_INDEX_PRIZE
BNE +
INC screenPrizeCounter
+
JMP loaded_SecondPoint
update_CollisionTable2_2:
LDA temp
STA collisionTable2,x
LDA newScreen
AND #%00000001
BEQ loaded_SecondPoint ;; skip checking for prize counter.
LDA temp
CMP #COL_INDEX_PRIZE
BNE +
INC screenPrizeCounter
+
loaded_SecondPoint:
RTS
6/ Make a new script, named "KilledLastMonster_DC.asm" in your "GameEngineData\Routines\Basic\ModuleScripts\MainScripts\ScrollingPlatformer" folder, with that code:
Code:
;; Remove all the monster locks:
ChangeAllTiles #COL_MONSTER_LOCK, #$00, #TILE_MONSTER_LOCK_OFF, #$00
ChangeAllTiles #COL_MONSTER_LOCK, #$00, #TILE_MONSTER_LOCK_OFF, #$01
7/ In the "Project Settings > Script Settings", add a new script element (button "Add") , named it "Handle Triggered Collisions" with the code "SCR_TRIGGERED_COL_LOADS"
And assign it the script "Routines\Basic\System\CheckTriggeredColLoads_DC.asm".
8/ Also, assign the script "Routines\Basic\System\CheckTriggeredTileLoads_DC.asm" to the "Handle Triggered Tiles" element.
9/ And, assign the "KilledLastMonster_DC.asm" to the "Kill Last Monster" element:
10/ Duplicate the "HandleSpriteWeapon.asm" script located in your "GameEngineData\Routines\Basic\ModuleScripts\MainScripts\ScrollingPlatformer" folder, and name it "HandleSpriteWeapon_DC.asm".
Modify your new "HandleSpriteWeapon_DC.asm" script, around line 75, from that:
Code:
; LDA DrawHudBytes
; ora #HUD_myScore
; STA DrawHudBytes
UpdateHud HUD_myScore
++
To that:
Code:
; LDA DrawHudBytes
; ora #HUD_myScore
; STA DrawHudBytes
UpdateHud HUD_myScore
;; check for monter locks begin:
CountObjects #%00001000, #$00
LDA monsterCounter
CLC
BEQ +
JMP ++
+
.include SCR_KILLED_LAST_MONSTER
;; check for monter locks end.
++
INX
11/ In your "Project Settings > Script Settings", assign the "HandleSpriteWeapon_DC.asm" script to the "Use Sprite Based Weapon" element:
12/ Modify the "HandleHurtMonster.asm" script, that is located in the "GameEngineData\Routines\Basic\ModuleScripts\HurtWinLoseDeath" folder, around line 80, from that:
Code:
CountObjects #$00001000, #$00
BEQ +
JMP ++
+
.include SCR_KILLED_LAST_MONSTER
To that:
Code:
CountObjects #%00001000, #$00
LDA monsterCounter
CLC
BEQ +
JMP ++
+
.include SCR_KILLED_LAST_MONSTER
Voilà, now you can create your monster lock tiles, put it on your screen with monsters... and test
As usual the script might not be perfect, it might be some errors, might cause some issues... feel free to make modifications, fix it, ... or not using it
Note: if you are using the "Jump On Kills", you have one step more, here: http://nesmakers.com/viewtopic.php?p=10807#p10807
And here, for the Adventure Module --->> http://nesmakers.com/viewtopic.php?p=10841#p10841
UPDATES
2019/01/19:
Updated the ZipScript patch versions for NESMaker 4.1.3 (that support user constants,... now)
2019/01/16:
Added some user constants, the checkTriggeredTileLoads, checkTriggeredTColLoads, LoadCollisionBytes scripts, made modifications in the KilledLastMonster_DC and removed the Handle_CheckForMonsters_DC that is no more needed (to fix the odd number screen issue).
Updated the ZipScript patch versions.
2019/01/13:
Fixed a problem with the sprite-based weapon, that was when you killed the 1st monster the locks was removed.
Modified the script assigned to "Kill Last Monster", to not trigger the screen, by default (like in previous NESMaker versions).
Added the ZipScript patch versions.