• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Other] Beginning Hacking (Gen 1)

Fotomac

Genwunner and proud of it
909
Posts
8
Years
    • Seen Jan 9, 2023
    I would just try to add the turn counter code from the sleep section in the appropriate place in the freeze section and leave everything else be. Of course, this is coming from someone who doesn't really know what they're doing.

    Could anyone tell me exactly where in the freeze section to put the sleep (or, in this case, freeze) counter?
     
    170
    Posts
    11
    Years
  • Initialize the freeze counter at the point of the freeze/paralyze/burn effect function where the freeze status is set. Just grab a couple of unused ram address and initialize one or another depending on whose turn it is.
    Then, during the check player/enemy status conditions function, your freeze status would act similar to the sleep status. Decrement the counter by 1 if the turn's pokemon is frozen and defrost it if it hit 0, just like what happens with sleep.

    I could always save a copy of the home/""/pokered directory, compress it, and send it in a PM or email, unless its too big?
    Upload it to dropbox, mediafire or wherever you want so that I can download, check it out and build the rom if necessary.
     

    Fotomac

    Genwunner and proud of it
    909
    Posts
    8
    Years
    • Seen Jan 9, 2023
    Initialize the freeze counter at the point of the freeze/paralyze/burn effect function where the freeze status is set. Just grab a couple of unused ram address and initialize one or another depending on whose turn it is.
    Then, during the check player/enemy status conditions function, your freeze status would act similar to the sleep status. Decrement the counter by 1 if the turn's pokemon is frozen and defrost it if it hit 0, just like what happens with sleep.

    OK, how does this look?

    .freeze
    call ClearHyperBeam ; resets hyper beam (recharge) condition from target
    ld a, 1 << FRZ
    ld [wEnemyMonStatus], a
    .setFreezeCounter
    call BattleRandom
    and $7
    jr z, .setFreezeCounter
    ld [de], a
    ld a, ANIM_A9
    call PlayBattleAnimation
    ld hl, FrozenText
    jp PrintText

    And how in Arceus's name is my Quick Reply token expiring so quickly, that I'm forced to reply the hard way?
     
    56
    Posts
    8
    Years
    • Seen Nov 27, 2016
    Expiring?

    Crystal, do you have a DB account? If you send me your account name or whatever I'll add you to the appropriate folders. You can send it as a PM if you're worried about privacy.
     
    170
    Posts
    11
    Years
  • .freeze
    call ClearHyperBeam ; resets hyper beam (recharge) condition from target
    ld a, 1 << FRZ
    ld [wEnemyMonStatus], a
    .setFreezeCounter
    call BattleRandom
    and $7
    jr z, .setFreezeCounter
    ld [de], a
    ld a, ANIM_A9
    call PlayBattleAnimation
    ld hl, FrozenText
    jp PrintText

    What is de?

    Crystal, do you have a DB account? If you send me your account name or whatever I'll add you to the appropriate folders. You can send it as a PM if you're worried about privacy.
    Just PM me the link to download it
     
    170
    Posts
    11
    Years
  • I suggest you pick up a GB assembly tutorial before you attempt this kind of stuff. Not to sound harsh but if you don't understand what you're doing you're always going to need someone to do it for you and you won't learn anything in the process. You need to get a basic hang on what the common instructions do before you start messing around with assembly edits. This is definitely a good tutorial, everything is explained quite well: https://gameboy.mongenel.com/asmschool.html

    Give the first four lessons a read and try to find out why that random ld [de], a instruction you have there is not doing anything good.
     
    56
    Posts
    8
    Years
    • Seen Nov 27, 2016
    Thanks to Crystal_'s genius help, I know what the issue with my hack was. Hopefully those can be avoided in the future.

    HOWEVER, now that its working about like it should, I can't get the game to pull my swapped pokemon sprites. It only pulls the original RB sprites, even though I replaced the ones in the bmon folder that each basestats file seems to point to. If anyone has any hints I'd appreciate it, but since it runs correctly again I can live without it if it's not a pretty simple fix.

    Also, does anyone know if adding extra lines to any of the core asm's will move any following data around in a problematic way? I believe I've avoided it so far, but if there are any general rules they might be handy.
     
    Last edited:
    170
    Posts
    11
    Years
  • The problem with the base stats structure is that it has a fixed size so the game would usually be retrieving data using a simple calculation with the index and size values instead of from a table of pointers. It assumes that the size of all entries match as otherwise the calculation will output an incorrect (shifted) memory location. On the other hand, you'll be fine moving and adding asm code since there's no longer any static reference to functions or memory locations. They're just different things.

    The sprite pointers in the base stats data point to these: https://github.com/pret/pokered/blob/master/main.asm#L5137. This is where you'd have to change stuff. The INCBIN in the base stats is only incuding the sprite dimensions byte.
     
    56
    Posts
    8
    Years
    • Seen Nov 27, 2016
    Cool! Tested it a couple ways, pointing to PNGs doesn't work (I seem to recall ROMbase had a special file type for sprites) so I successfully pointed to the rgmon folder instead and voila!

    I'm sending a few of my buddies this version of the ROM for phase one play testing!
     
    56
    Posts
    8
    Years
    • Seen Nov 27, 2016
    So testing is going well, finding minor issues and correcting them as I go, although I'm getting a cygwin error that says it's "unable to load fixed ROMX section into bank $09". I checked for ROMX in the main.asm, but can only find bank "$9" not "$09". There's not much in "$9", and it's stuff that would have given me problems long before now.

    I figure bank "$09" refers to one of the named ROMX banks, like "pics" or something, but I have no idea which one to look at. Cygwin isn't giving me a asm line to look for either.

    I'm also looking into a release pokemon function outside of the regular Bill's PC (which might be more than I can handle) in which case, I'd settle for just adding PC access someplace else (although I can't find references for that either). I would've thought the script would have been tied to a map object or would check for the PC tile before starting, but am not having any luck.

    Direction?
     
    170
    Posts
    11
    Years
  • It means that what you're trying to fit into bank 9 is too large to fit into a single bank. Bet you've messed around with pics in bank 9 (PICS_9) and there's not enough space in that bank. You'll have to move some to another bank and account for it in the sprite loading function (so that each mon reads its pic from its corresponding bank).
    If you're getting an error nothing is being saved to the ROM until you fix the build so all the stuff you've modified since hasn't still been updated.
     
    56
    Posts
    8
    Years
    • Seen Nov 27, 2016
    It means that what you're trying to fit into bank 9 is too large to fit into a single bank. Bet you've messed around with pics in bank 9 (PICS_9) and there's not enough space in that bank. You'll have to move some to another bank and account for it in the sprite loading function (so that each mon reads its pic from its corresponding bank).
    If you're getting an error nothing is being saved to the ROM until you fix the build so all the stuff you've modified since hasn't still been updated.

    Like the files it's trying to load are too big, or there is now extra files that don't fit?

    Problem is there's no PICS_9 bank in main.asm. There's 5 of them, but they're not consecutive nor do any of them fall 9th in the overall order of banks, so far as I can tell. The ones that look like they could be bank 9 or 9th in order are banks I've never messed with.


    **EDIT: Partially resolved. I changed a handful of sprites back to their originals and all banks loaded correctly. This points to my first guess about actual memory and not number of lines. However, I feel like I can't just haphazardly move things from one bank to another. Or maybe I can, so long as I adjust everything else for the bank changes like you're saying.
     
    Last edited:
    170
    Posts
    11
    Years
  • My guess is that you either added more sprites to bank 9 (see PICS_1 in main.asm), or chances are, you replaced some sprites with other that are bigger.

    The pokemon sprites are splitted in five banks (9, A, B, C, D), and there's probably not much extra space to make room for additional or larger sprites. Have a look at this tutorial on how to add a new Pokemon from Dannye (https://github.com/pret/pokered/commit/16d9ec3) to see how he added a sprite to a different bank and how he reflected it in the UncompressMonSprite function. Specifically, look at changes in home.asm and main.asm. These are all you need.
     
    56
    Posts
    8
    Years
    • Seen Nov 27, 2016
    So creating a new bank in the main.asm isn't an issue? Seems simple enough to do, so long as there is no issues of data being moved in problematic ways or things overlapping each other, which I'm afraid of, since many times I'm not keen to them.
     

    Fotomac

    Genwunner and proud of it
    909
    Posts
    8
    Years
    • Seen Jan 9, 2023
    I'm trying to make wild battles so that the fainting sound effect plays when the wild Pokémon faints and the victory music plays when the Pokémon gains experience points. I got the latter taken care of thanks to Crystal_, but how do I go about the former?

    UPDATE: Disregard, I just figured out that you had to clear the ".sfx_played" branch out and merge it with the main part of that bit or something like that.
     
    Last edited:
    56
    Posts
    8
    Years
    • Seen Nov 27, 2016
    So many pages ago I added an event that overwrote data in wram (flags) that overlapped with wild pokes data. I expanded the wram as suggested, but I appear to be running into the issue again. The script for giving the item runs, but it doesn't display all the appropriate text, and nearby wild pokes are being sketchy.

    What do?
     
    56
    Posts
    8
    Years
    • Seen Nov 27, 2016
    Been a little while since my last post.

    Looking at a "new game+" idea here. How involved would it be to have all the trainers and scripts reset while keeping your pokemon party and dex intact? Would also like to increase trainer levels and MAYBE wild pokemon. Obviously I would need all this new data somewhere that I can point to with a script that activates after defeating the champion. Is this even doable?
     
    Back
    Top