Conditional Monster Blocks [4.5.9]

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:
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

  • doHandleHurtMonster_adventureBase_improved_strDEF_edit_4.txt
    11.4 KB · Views: 3
Last edited:

TolerantX

Active 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.
Nice. I could definitely see a friend of mine using this in his game in the future. He could create another tile or a pickup that triggers like a "button" that when stepped on opens all doors in that room. :)
 

Kanbei85

Member
Nice. I could definitely see a friend of mine using this in his game in the future. He could create another tile or a pickup that triggers like a "button" that when stepped on opens all doors in that room. :)
Unfortunately, so far these blocks don't actually stay down if you reload the screen. I've had the same problem trying to make "switch blocks" that will go up and down each time you step on a tile. I'm missing something that causes the change to stay permanent after leaving and returning to the screen.
 
Top Bottom