[4.1.5] Trouble with custom win tile and user variables

SciNEStist

Well-known member
I am trying to make it so the win tile only works and sends you to a win screen if 4 separate user variables are changed from their default ( 0 )

I am planning on scripting it so the 4 variables are changed when different tasks are completed.

I have set up all 4 user variables in project settings, with default value of 0

here is the code along with my comments of what I think is supposed to be happening

Code:
cpx player1_object
BNE dontWintGame_tile

LDA quest1 ; load user variable
CMP #$00  ; is the variable 0?
BEQ keepplaying ; if so, move down to keepplaying

LDA quest2 ; check 2nd user variable
CMP #$00
BEQ keepplaying

LDA quest3 ; check 3rd variable
CMP #$00
BEQ keepplaying

LDA quest4 ; cehck 4th variable
CMP #$00
BEQ keepplaying


LDA #STATE_WIN_GAME ; if none of the variables are 0, then proceed with the win screen
STA change_state
LDA #$01
STA newScreen
RTS

; if any variables are 0, they are pushed down here, where something else will happen instead
keepplaying:
PlaySound #SND_WAHWAH ; just for an example, it spams this noise
RTS

dontWintGame_tile:


if i try to test the block, it doesn't seem to work. the code isn't seeing that the user variables are all 0, so it passes me to the win screen no matter what.

as a test, i would add this to the beginning of the it:

Code:
LDA #$00
STA quest1
STA quest2
STA quest3
STA quest4

and then it will work and reject the win.

so my question is, why is it not reading the user variable default correctly? Is there somewhere else I should be manually setting the variables to 0? Or am I just doing this all wrong and there is a better way?
 

SciNEStist

Well-known member
I decided that playing with so many user variables was just too unhealthy for my sanity.

A much better method I came up with is to take advantage of all my unused weapon unlock slots, and just mark them unlocked when the quests are completed. when i hit that win tile, it just makes sure everything is unlocked before giving the win screen
 
Top Bottom