• 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✓] (Red) Pushing the player downwards while surfing

epseta

Don't let your memes be dreams.
8
Posts
9
Years
  • Hello.

    I've set up a room so that when the player is surfing, he automatically goes downwards. Here's a crude diagram of what I'm trying to convey:

    PW
    WW
    WW
    XX


    where P is the player facing right, W is water, and X is dry land. When the player gets on his pokemon and surfs, he'll initially go right as normally, but then he'll be forced downward on the blue path until he reaches the red X, as if by a current. I've gotten that part down, but I have two problems that I cannot solve:

    1. Here's an excerpt of the script that forces the player downward when sloping:

    LD A, ($C45C) ; check tile under player
    CP $14 ; is it water?
    JP NZ, $3219 ; if not, then jump away to address irrelevant for this question
    LD A, $80 ; down
    LD ($CCD3), A ; simulated joypad states end
    LD A, $01 ; one simulated button press
    LD ($CD38), A ; simulated joypad states index
    CALL $3486 ; start simulating joypad states

    He'll go down automatically, but if I hold any other button, he'll go in that direction as well. This is a similar effect to what happens in the Cycling Road. How do I make sure that he'll always go down and only down when he's surfing, no matter what buttons are pressed?

    EDIT (2/10/16, 2:38 PM): RESOLVED.

    2. The player will eventually reach land and will stop, but the game still thinks he's surfing, i.e. 0xD700 is set to $02. If the player goes further inland, the game then realizes he's walking and goes back to normal. I want the player to stop surfing and begin walking as soon as he reaches land, without having a button being pressed. How do I do that?
    EDIT (2/10/16, 6:23 PM): RESOLVED.

    Thanks in advance for any help you give.
     
    Last edited:

    epseta

    Don't let your memes be dreams.
    8
    Posts
    9
    Years
  • I don't know what you are talking about.
    Is Advance Map a Gen 3 tool? Because my problem is for Gen 1 Red.

    I've seen something on pokered about $CD6B being the address that controls what buttons are ignored, and the Viridian Gym arrows set this byte to $FF (all buttons) when you step on them. Maybe this has something to do with it? I'll try it out.
     
    170
    Posts
    11
    Years
  • Button presses can be ignored by writing to the wJoyIgnore register which is indeed at address $cd6b, so from what I'm seeing I looks like you have already sorted this out.

    2. The player will eventually reach land and will stop, but the game still thinks he's surfing, i.e. 0xD700 is set to $02. If the player goes further inland, the game then realizes he's walking and goes back to normal. I want the player to stop surfing and begin walking as soon as he reaches land, without having a button being pressed. How do I do that?
    If button presses are being simulated while surfing the collision checks are skipped. So while they're being simulated (bit 7 of wd730 is set), it will never be detected that the character has collided with land and should stop surfing. If I'm understanding you correctly, the step you take after reaching land is the first non-simulated button press so it gets caught here, clearing bit 7 of wd730 allowing the game to notice the collision.

    I'm not absolutely sure, but I don't think there's anywhere in the game where button presses are simulated while surfing, so unless I'm missing something it's probably safe to remove that check from CollisionCheckOnWater (plus that's probably just a fail safe to prevent scripted movements from freezing if a collision occurs). If you're not confident with this solution you could use some flag so that the check is skipped in the circumstances that you want (you could set the flag when your custom simulated movements starts for example, then reset it when you step on land).
     
    Back
    Top