Multiple Unlockable Weapons Questions (Adventure Base Module)

mingus.

New member
I currently have two weapons in my game that I would like to be unlockable, but when I unlock one weapon, the other unlocks as well.

The code for changeToAttack is this for lines 1-19
;; if you would like unlockable weapons,
;; that will be created with the b button
;; use this code.
;PlaySound #sfx_bonk
LDA weaponsUnlocked
BNE +canCreateWeapon
LDY weaponChoice
LDA weaponChoiceTable,y
AND #%00000001
BNE +canCreateWeapon
LDY weaponChoice
LDA weaponChoiceTable,y
AND #%00000010
BNE +canCreateWeapon
RTS
+canCreateWeapon
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;END UNLOCKABLE WEAPONS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
I did try to make some changes to this code in attempt for the system to differentiate weapon 1 and weapon 2. It still works the same, which kinda just shows me that both are being unlocked at the same time under weapon 1.
Screenshot 2026-05-30 212546.jpg
(The presets that I'm using to test this. Only weapon 1 unlocked is checked, yet both weapons work still)

Beneath is lines 176-182. I believe that the first section: weaponChoiceTable shows each weapon's ID, and the second section: weaponObjectTable shows the actual objects that the game is attributing. I have it cycling through the first 2 options.
weaponChoiceTable:
.db #%00000001, #%00000010, #%00000100, #%00001000
.db #%00010000, #%00100000, #%01000000, #%10000000


weaponObjectTable:
.db #$01, #$02, #$03, #$03, #$03, #$03, #$03, #$03

What I guess I am wondering is how I can set both weapons to their own IDs considering they seem to be under the same one? This way they can both be unlocked under their own circumstances.
 

dale_coop

Moderator
Staff member
you need to check each it individually to know if one weapon is unlocked.
For example to check if the weapon 1 is unlocked:
Code:
LDA weaponsUnlocked
AND #%00000001
BNE +weaponIsUnlocked

For weapon 2:
Code:
LDA weaponsUnlocked
AND #%00000010
BNE +weaponIsUnlocked

And so on...
 

mingus.

New member
Do I replace a section of my code with this, or do I put it before what I already have?
I have this so far:
;; if you would like unlockable weapons,
;; that will be created with the b button
;; use this code.
;PlaySound #sfx_bonk
LDA weaponChoiceTable,y
AND #%00000001
BNE +canCreateWeapon
LDA weaponChoiceTable,y
AND #%00000010
BNE +canCreateWeapon
 

mingus.

New member
I tried to do a bit more investigation on this. Could the issue possibly be that the game objects for both attacks use the same "player weapon" flag?
 
Top Bottom