• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • 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.

JPAN Special 0x7F/Special 0x8F (FireRed)

DrFuji

[I]Heiki Hecchara‌‌[/I]
  • 1,689
    Posts
    15
    Years
    The best way to do this via scripting is to add/ subtract one from the 0x8004/ 0x8005 variables depending on which way the player is facing. Here's a quick and dirty script that will get the job done:

    Code:
    #dynamic 0x800000
    
    #org @start
    special 0x8F // loads coordinates into 0x8004/ 0x8005
    special2 0x8000 0x11F // Places the direction the player is facing into 0x8000. I this far more reliable than other methods of checking facing
    compare 0x8000 0x1
    if 0x1 call @FacingDown
    compare 0x8000 0x2
    if 0x1 call @FacingUp
    compare 0x8000 0x3
    if 0x1 call @FacingLeft
    compare 0x8000 0x4
    if 0x1 call @FacingRight // Checks which way the player is facing and branches/ returns depending on the answer
    special 0x7F // Places the tile's behaviour bytes into 0x8004/ 0x8005
    buffernumber 0x0 0x8004
    buffernumber 0x1 0x8005
    msgbox @talk 0x6 // Prints the values of 0x8004/ 0x8005 for testing purposes
    release
    end
    
    #org @FacingUp
    subvar 0x8005 0x1
    return
    
    #org @FacingDown
    addvar 0x8005 0x1
    return
    
    #org @FacingLeft
    subvar 0x8004 0x1
    return
    
    #org @FacingRight
    addvar 0x8004 0x1
    return
    
    #org @talk
    = [buffer1], [buffer2]

    This coordinate manipulation can also be used in other circumstances (with minor alterations) for things such as JPAN's 0x7E special or changing a tile relative to the player's position with setmaptile.
     
    Back
    Top