Title: Chest Reader Post by: Lin on June 26, 2010, 04:54:30 AM Well, in my hack I wanted to make the sword obtainable from a chest, but I guess by default there is no such chest value that does this (As far as my experimentation went). I also noticed a lot of freezes from random items, so I thought I'd see just makes what do what. Here's what I came up with.
(http://img24.imageshack.us/img24/4707/zocr.png) 1602 is the ID of the Power Gloves. I've played around with those "Useless" values quite a bit, but I never got anywhere. It turns out if the first byte of the ID is less than 0x20, it's detected as weapon. If anything greater, it's something else like money or a key. One thing I haven't figured out is what controls the level of the weapon. If the weapon is 05 (Which requires a run-time memory edit to not freeze the game), which is the sword, it turns out Level 3 instead of Level 1. I know there's a separate value in the memory for this, but I can't see why it's not by default 01. I know for a fact the level doesn't depend on the second byte of the chest ID, because a Level 3 Sword has 03 at C6B2, not 02. A 00 sword does no damage. But yea, just a small experimentation. Maybe it'll go somewhere further! EDIT: I guess the second byte does control the level. The byte that gets written is that + 1. ~Lin Title: Re: Chest Reader Post by: Jigglysaint on June 26, 2010, 04:13:04 PM Actually, like with everything in this game, the second value is an index. How it works is that all items are global, which means that anything and everything, from a falling key to a power glove chest is an index to code. For the power bracelet, the first value is for the power bracelet in level 1. 16 01 is for when you get your power bracelet back at Cresent Island. 16 02 is for the power glove, and because you find it in a chest, it comes out like a chest.
Most items have specific values that do specific things. The key, byte 30, has 3 types. 30 00 will make a key instantly appear, 01 makes a key fall down, and 02 is for a chest. You can actually change the ID value for a chest and a key can fall down from the celing(though the game will freeze as it's awating imput that never comes). So that also means that with the sword, well the level 1 sword does not have a chest index value, so you have to code one from scratch(not hard but would require some code movement). Level 3's sword can be found in a chest since it appears as a secret link. Edit: Scratch all of that. The first byte determines if the item is found, dropped, or in a chest. Second byte is the item level, if applicable. Third byte is text value, and last byte is the item's appearance. Edit2: Furthermore, the first byte controls several key factors: If bit 0 is active, then the item get sfx is played and Link uses one hand to lift up the item. If bit 1 is active, then do the same thing, except hold item with both hands If both bits are active, then the sfx won't play but Link will do a spinslash and aquire the item. If neither bits are set, Link will walk into the item and collect with with no fanfare or pose Bit 2 is not used, and if combined with the other bits will actually crash the game. Bit 3 is used to set bit 5 in the room flags signifying that an item has been obtained in that room Bit 4 makes the item appear in a puff of smoke Bit 5 makes the item fall down from the celing If bit 4 and 5 are both active, then the item will appear to come out of a treasure chest If neither bits are active, the item will appear from the getgo. Bit 6 makes the item not appear Bit 7 turns the item into a collectable item, both sfx and pose are automatically added Title: Re: Chest Reader Post by: Lin on June 26, 2010, 08:01:45 PM Ah. I couldn't figure out what they were for because the game does AND 7 for "Useless" 1, AND 8 for "Useless" 2, and (>> 4) AND 7 for the effect (How it appears, like if it's dropped from the ceiling or what). According do your bit flags, making the tool write 38 was a good idea since it makes the chest work how you would expect it too.
And actually, every item is already there if everything uses the same table. The only thing that has to be changed is the first byte or else it would freeze. For example, the Level 1 Sword uses the data when Impa gives you the sword (Or some other data that's completely identical), but if you try to use 500 as a chest ID, the game crashes. However, if you write 38 as the first byte, it comes out of the chest and everything is perfect. |