Language…
12 users online:  Anorakun, bradcomp, DanMario24YT, DasFueller, DimeR, GRIMMKIN,  idol, Metal-Yoshi94,  Shoujo, signature_steve, SMW Magic, steelsburg - Guests: 303 - Bots: 418
Users: 64,795 (2,373 active)
Latest user: mathew

Problem with Locked Block 4

Originally posted by Netto Takashi
I'm trying to use the Locked Blocks that came with BlockTool, but there seems to be some kind of error with Locked Block 4. Instead of unlocking when Key Block 4 is hit, it unlocks when Key Block 1 is hit. I tried looking at the .bin file to see if I could figure out why, but a. I suck at reading ASM, and b. it's part of one large .bin file that encompasses a whole bunch of other blocks as well.

Can someone help me figure out how to make the correct key open these blocks?

As a side note, it would be nice if I didn't have to actually touch the unlocked blocks in order for them to change...but then I suppose locking them to begin with would become more difficult...

(I'm not sure this is the right forum to post this in, but whatever...)

I was getting no replies whatsoever when I posted this in the Basic Hacking forum, so I'm reposting it here. I think it better fits here anyway. <.<
- Kappatechy
Hmmmm...still no replies? Damn...doesn't anyone have any idea what's going wrong?? I suppose I could post the BIN file which no doubt contains the bug...would that help any?
- Kappatechy
Did you use the Lock Init block?
Your layout has been removed.
Yes, I did. It locks all the blocks like it should.
However, instead of Key Block 4 unlocking Locked Block 4, Key Block 1 does. The rest of the Locked Blocks are unlocked by the correct Key Blocks, just not Locked Block 4.

EDIT: How do I attach a file to my post?
- Kappatechy
Originally posted by Netto Takashi
Yes, I did. It locks all the blocks like it should.
However, instead of Key Block 4 unlocking Locked Block 4, Key Block 1 does. The rest of the Locked Blocks are unlocked by the correct Key Blocks, just not Locked Block 4.

EDIT: How do I attach a file to my post?

1. Are you using the wrong block?
2. You can't without uploading it to MediaFire or something.
1. Yes, I am using the correct block in BlockTool. I double-checked to be sure.
2. Please direct me to this "MediaFire."
3. I highly suspect the error is somewhere in smb32.bin, though it just occured to me that it might be in the Locked Block settings...

Originally posted by Settings
Block Title: Locked Block 4
ASM filename: smb32.bin
Below offset: 987
Above offset: 987
Sides offset: 987
Spr UD offset: -1
Spr LR offset: -1
Cape Offset: -1
Fire Offset: -1
Reloc Offsets:
154,221,277,2AC,2DA,300,31C,37B,
3B0,3C3,3D6,3E9,40D,414,482,491,
49D,4A9,4B5,4C1,4DF,501,523,545,
567,58F,5B7,5DF,607,62F,

- Kappatechy
What exactly do these blocks do? I could probably make my some that are better.
"quoting from Block Tool"

A block that turns itself into the next block in the map16 if the corresponding key flag is set.

So, this block basically turns into the next block in the map16 when the corresponding locked door key (I'm assuming they work for both the locked doors and locked blocks; I've used the locked doors, but I haven't tried the locked doors) is hit (or passed by, depending on what you set the key blcck to act like).

BTW, the four locked blocks use smb3.bin in Block Tool. I just checked.
Actually, KoT, the locked doors use smb3.bin, but the locked blocks use smb32.bin...at least in the version I downloaded, yours might be different. >.>
So, yeah, the Locked Block initializer clears the locked door flags, and there are four Key Blocks that set these flags. There are supposed to be four different Locked Blocks, too, but for me, Locked Block 4 is acting like a second Locked Block 1.

Now, it's worth noting that the Locked Blocks don't immediately turn into the next block in the Map16 when the key flag is set, you have to actually touch them after setting it. My guess is this was done because their creator either couldn't get them to change instantly, or couldn't figure out a way to change them back when the flag was cleared. Possibly both.

Aiyo, if you can make me some better-working blocks, I would be eternally grateful. Well...okay, maybe not ETERNALLY, but definitely grateful. Since key1.bin and such are really short, I'll copy them here manually so you can figure out what the flags you're dealing with are.

Originally posted by Key1.bin
AF 0B 01 7E 09 01 8F 0B 01 7E 60

Originally posted by Key2.bin
AF 0B 01 7E 09 02 8F 0B 01 7E 60

Originally posted by Key3.bin
AF 0B 01 7E 09 04 8F 0B 01 7E 60

Originally posted by Key4.bin
AF 0B 01 7E 09 08 8F 0B 01 7E 60

Originally posted by Lockinit.bin
A9 00 8F 0B 01 7E 60


- Kappatechy
heh, this might be time to use bits...

So do these locked blocks or whatever work at the same time? So like you can have two "unlocked" at the same time? Or is it if you unlock one, it locks the previously unlocked one?
Okay, guys, here's what's basically happening here, using Locked Door Key 1 as an example:

Code
LDA $010B
ORA #$01
STA $010B


It uses bits. This means you can have all 4 keys at once, or any combination of the four. Also, please note that bits double from the previous one, so it goes 01, 02, 04, 08, 10, etc. Last single bit is 80, I believe. With all bits enabled, you get FF. If you want more, use another byte.

Please note that it was smkdan who got the above code for me. Now. A good way to check if it's working right is to try to find the code for the fourth locked block in the file it gets its code from. When you find "0B 01 7E", check the bits after it. See if you find AND #$08. I do not remember the hex value for this, however, so try to look around for some hex tutorials that may cover this.

Hope that helps ya a bit. Also, the reason the creator didn't make them change dynamically (instantly at a moment's notice, like sprites can) is because blocks only run their code when they're touched.
<Adam> I feel like smwc is a prostitute now, because we put up a porn ad for money
Originally posted by Berserker Matthew
Also, the reason the creator didn't make them change dynamically (instantly at a moment's notice, like sprites can) is because blocks only run their code when they're touched.

I figured as much...

Um, yeah, any combination of them can be locked/unlocked at one time.

That bit of ASM code describing would probably be a lot more helpful if the locked block code wasn't buried in the middle of a 0x630 byte file... >.<
I've GOT to find this "MediaFire" so you people with more knowledge of this stuff could check the code for me...

EDIT: Well, that was easy to find.

http://www.mediafire.com/file/hzmmw0md5jz/smb32.bin

EDIT2: Okay, I managed to get what you were saying, and I BELIEVE I've now fixed the problem. It had said 01 where it should have said 08.

EDIT3: Yup, I've confirmed that the problem is now solved. Thanks for all the help and support, you guys!
Oh, and uh, Aiyo? If you're still willing to make some new Locked Blocks, I wouldn't mind having a second set...like, numbers 5 to 8?
- Kappatechy
well im thinking of a way to make them change without touching the block.
Originally posted by Aiyo
well im thinking of a way to make them change without touching the block.

Here's a suggestion: Sprite. ;) Sadly, that's the only way you can do it, since blocks will not run their code until they are touched, PERIOD. Whether it be sprite, fireball, cape, or Mario, it matters not. Unless one of them touches the block in a way that it's set to respond to, the block will not run its code.

It'd be a little difficult to get a sprite to change a block, and even if you copy from the Door Generator sprite, you'd still have to do a good bit of modification to get it to respond to some other condition...
<Adam> I feel like smwc is a prostitute now, because we put up a porn ad for money
Originally posted by Berserker Matthew

Here's a suggestion: Sprite. ;) Sadly, that's the only way you can do it, since blocks will not run their code until they are touched, PERIOD. Whether it be sprite, fireball, cape, or Mario, it matters not. Unless one of them touches the block in a way that it's set to respond to, the block will not run its code.

It'd be a little difficult to get a sprite to change a block, and even if you copy from the Door Generator sprite, you'd still have to do a good bit of modification to get it to respond to some other condition...

well i was thinking of either hacking the routine of how blocks run... or creating a new universal routine that can be used by anyone. i think i have a slight idea, but i need to do a few test and think it through a bit more
running all block each frame would cause an absurd ammount of slowdown, beside, that limation make it work in a more realistic way, so why complain about it?
eh, i guess.