Advertiser Content

epseta

Don't let your memes be dreams.

Male
Realm 6.2
Seen September 2nd, 2016
Posted August 7th, 2016
8 posts
4.3 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.

INDIAN MEW(ARAZI)

THE WORLDS MOST DUMB MAN

Male
Sleeping in clouds.
Seen June 19th, 2019
Posted March 8th, 2018
411 posts
4.4 Years
did you just cheked the behavior byte on advance map.
MY DEVIANT ART
http://arazitheman.deviantart.com
RUMOUR RED(FIRE RED BASE)
https://www.pokecommunity.com/showthread.php?t=396639
A2z GUIDE
http://www.pokemonhackersonline.com/showthread.php?t=15772-A2z-PokeRED-a-guide-for-fire-red
START LEARNING C,C++ OR PYTHON FOR FREE
https://www.sololearn.com

epseta

Don't let your memes be dreams.

Male
Realm 6.2
Seen September 2nd, 2016
Posted August 7th, 2016
8 posts
4.3 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.
Male
Spain
Seen January 23rd, 2019
Posted July 1st, 2018
170 posts
6.5 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).
Advertiser Content