Kanbei85
Member
I thought it might be useful as a puzzle mechanic to have monster blocks that only worked if you triggered some variable first. Now introducing: conditional monster blocks.
Add a new variable to your Zero Page RAM: CondMonsterBlock
Then alter your Handle Monster Hurt script to have a second subroutine that mirrors the code for monster blocks, but has a check for the CondMonsterBlock variable that skips out if it is equal to zero. (I'm attaching my own script as a TXT, but keep in mind it is also using the STR/DEF modifications as well).
Now add a new tile type (mine happens to be #$0C). If yours is not 0C, then you'll have to change the hurt script accordingly!
This tile is now your Conditional Monster Block. You'll need to assign it the same script as the regular monster block.
This will now work just like a regular monster block, but ONLY if the CondMonsterBlock variable is not equal to 0.
Now you can do whatever you like with this, INCLUDING creating a "Trigger" tile type that will set the variable to 1 if you step on it, thus enabling the conditional monster blocks on that screen.
Seems like this could be used for puzzles and other types of applications.
If you want to reset the variable when loading a new screen, simply add this:
to the very top of your doLoadScreen script.
Another thing I thought about is that you could copy the chunk of code from the MonsterHurt script into a new Tile script and have it automatically trigger the conditional monster blocks (without needing to kill any monsters), making for yet another possible puzzle mechanic.
Add a new variable to your Zero Page RAM: CondMonsterBlock
Then alter your Handle Monster Hurt script to have a second subroutine that mirrors the code for monster blocks, but has a check for the CondMonsterBlock variable that skips out if it is equal to zero. (I'm attaching my own script as a TXT, but keep in mind it is also using the STR/DEF modifications as well).
Now add a new tile type (mine happens to be #$0C). If yours is not 0C, then you'll have to change the hurt script accordingly!
This tile is now your Conditional Monster Block. You'll need to assign it the same script as the regular monster block.
This will now work just like a regular monster block, but ONLY if the CondMonsterBlock variable is not equal to 0.
Now you can do whatever you like with this, INCLUDING creating a "Trigger" tile type that will set the variable to 1 if you step on it, thus enabling the conditional monster blocks on that screen.
Seems like this could be used for puzzles and other types of applications.
If you want to reset the variable when loading a new screen, simply add this:
PHA
LDA #$00
STA CondMonsterBlock ;;RESET CondMonsterBlock Variable
PLA
to the very top of your doLoadScreen script.
Another thing I thought about is that you could copy the chunk of code from the MonsterHurt script into a new Tile script and have it automatically trigger the conditional monster blocks (without needing to kill any monsters), making for yet another possible puzzle mechanic.
Attachments
Last edited: