Help finding Witch Assistant's item flag

View previous topic View next topic Go down

Help finding Witch Assistant's item flag

Post by Trivial Man on Sat 15 Jul 2017 - 5:01

I'm working on an automatic item tracker for the LttP Randomizer. One of the last things I'd like to implement is logic that checks if the mushroom has been handed over to the witch. As it turns out though, you can give the witch as many mushrooms as you want. If you edit the RAM to give yourself another mushroom after handing over the first, the witch takes that one too. However, no matter how many times you do this the witch's assistant inside the shop only has 1 item to hand over.

The problem I'm running into is that I have no idea how the game is tracking that that item has or hasn't spawned, or that it has or hasn't been picked up. There has to be something in the RAM somewhere that describes this item's state since it only spawns once, but I've been trying to figure out what that is for hours to no avail.

Does anyone here have some sort of lead I might be able to go off of?

Trivial Man
Newcomer

Since : 2017-07-15

Back to top Go down

Re: Help finding Witch Assistant's item flag

Post by Trivial Man on Sat 15 Jul 2017 - 6:15

Of course, after posting this I finally found my answer. The leftmost bit of 0x7EF212 (or 0x00F212 in WRAM) spawns the item. If I'm understanding the documentation correctly, this is simply one of the chest bits for the low byte for the Potion Hut's room.

Hopefully someone else finds this through a search engine one day and is helped by it.

Trivial Man
Newcomer

Since : 2017-07-15

Back to top Go down

Re: Help finding Witch Assistant's item flag

Post by Conn on Sat 15 Jul 2017 - 6:26

I am not sure I understand what exactly you need.
7ef344-01 Mushroom (can be given to the witch unlimited times, the flag whether you collected it is saved on the overworld progression I guess).
7ef344-02 Magic powder (if you have it, the assistant won't spawn it)

The flag I think you are looking for is in the dungeon room progress. The witch hut room is hex 01 09 (dec 265).
Room information is stored as 2 bytes (refer to MoN's disassembly to get further infos here).
So 0109*2 = 212 (hex), so add it to 7ef000
So your witch hut flags are at 7ef212, 7ef213.

At 7ef212 you will find a 02 before giving the mushroom to the witch, after you gave it to her, this has an 82.
Means, with 7ef212-82, the powder spawns inside the witch hut in case you have no magic powder in your inventory (7ef344-00)

If you have powder (7ef344-02) or didn't give the mushroom to the witch (7ef212-02) the magic powder won't spawn.
avatar
Conn
                        
                        

Since : 2013-06-30

Back to top Go down

Re: Help finding Witch Assistant's item flag

Post by Conn on Sat 15 Jul 2017 - 6:28

Ah you found out at the same time as me Very Happy
avatar
Conn
                        
                        

Since : 2013-06-30

Back to top Go down

Re: Help finding Witch Assistant's item flag

Post by Trivial Man on Sat 15 Jul 2017 - 14:01

Yeah, thanks for looking into it either way. To be slightly clearer (mostly for posterity), the item tracker I am writing is going to have 3 states for the mushroom item: 1. Link hasn't found the mushroom 2. Link has the mushroom 3. Link traded the mushroom in. The first 2 states are sufficient to look at the RAM value for the mushroom item, but the 3rd is trickier.

The randomizer changes what item the witch gives you, so a simple check for Magic Powder isn't enough. Furthermore, though the game removes the mushroom when you give it to the witch, checking if the player had it and then lost it isn't enough either since things like saving and quitting have the same effect of temporarily setting the RAM to have no mushroom.

However the chest/item bit for the potion shop is only ever set when the mushroom is given to the witch. Since even in the randomizer that is the only use for the mushroom, it is a safe assumption that if that bit is set the mushroom has been traded away. And even if through some shenanigans a player managed to glitch the game so that bit gets set and the item spawns without trading in the mushroom, it still makes sense to mark the mushroom as traded in since it is now functionally useless even if collected.

Trivial Man
Newcomer

Since : 2017-07-15

Back to top Go down

Re: Help finding Witch Assistant's item flag

Post by qwertymodo on Sat 15 Jul 2017 - 14:26

Looks like you both beat me to it, but I had to figure out this exact same situation to fix the PW second mushroom.
avatar
qwertymodo
    
    

Since : 2014-10-21

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum