The PokéCommunity Forums

The PokéCommunity Forums (https://www.pokecommunity.com/index.php)
-   Binary ROM Hacking (https://www.pokecommunity.com/forumdisplay.php?f=284)
-   -   Other help? scripting event like old man in viridian or boy in pewter (https://www.pokecommunity.com/showthread.php?t=356064)

grungefan330 September 23rd, 2015 5:31 AM

help? scripting event like old man in viridian or boy in pewter
 
I'm new to scripting and not sure how I'd go about scripting a character like the old man who won't let you pass in viridian or the boy in pewter who won't let you pass until you beat Brock. I remember seeing something in passing, but after two hours of google and YouTube searches I found nothing that could specificly help me. In short, all I need is a script to prevent the player from leaving the start town until they have received their starter pokemon but also want to e sure I understand the theory behind it completely for future use. Thinking this has to do with flags?

Vendily September 23rd, 2015 2:03 PM

Quote:

Originally Posted by grungefan330 (Post 8939944)
I'm new to scripting and not sure how I'd go about scripting a character like the old man who won't let you pass in viridian or the boy in pewter who won't let you pass until you beat Brock. I remember seeing something in passing, but after two hours of google and YouTube searches I found nothing that could specificly help me. In short, all I need is a script to prevent the player from leaving the start town until they have received their starter pokemon but also want to e sure I understand the theory behind it completely for future use. Thinking this has to do with flags?

Your thinking is correct. It's all about flags.
Here's a script I made just now for you as an example for Firered in XSE.
Code:

#dynamic 0x800000
#org @start
lock
faceplayer
checkflag 0x828
if 0x1 goto @HavePoke
msgbox @NoPass 0x2
end

#org @HavePoke
msgbox @CanPass 0x2
applymovement LASTTALKED @Move
end

#org @NoPass
= GUY: You shall not pass.

#org @CanPass
= GUY: You have a pokemon.\nYou can pass.

#org @Move
#raw 0x13
#raw 0xFE


There is a checkflag command which checks if the flag is active or not. 0x828 is the flag for the pokemon menu, which should be activated when you get your starter.
Here are the rest.
Spoiler:
0x820 – Activates First Badge
0x821 - Activates Second Badge
0x822 - Activates Third Badge
0x823 - Activates Fourth Badge
0x824 - Activates Fifth Badge
0x825 - Activates Sixth Badge
0x826 - Activates Seventh Badge
0x827 - Activates Eighth Badge
0x828 - Activates Pokemon Menu
0x829 - Activates Pokedex Menu
0x82F - Activates Running Shoes

Under the checkflag is if 0x1 goto @HavePoke. Basically it's if flag 0x828 is activated, then go to our pointer @HavePoke. 0x1 is active, 0x0 is not active.
Under @HavePoke is our applymovement. In this case it's make the guy you last talked use the movements under @Move.
#raw 0x13 makes our guy move over to the right, while 0xFE ends the movement section.
Here's the full list of movements too. (It's long)
Spoiler:
#raw 0x0 = Face Down
#raw 0x1 = Face Up
#raw 0x2 = Face Left
#raw 0x3 = Face Right
#raw 0x4 = Face Down (Faster)
#raw 0x5 = Face Up (Faster)
#raw 0x6 = Face Left (Faster)
#raw 0x7 = Face Right (Faster)
#raw 0x8 = Step Down (Very Slow)
#raw 0x9 = Step Up (Very Slow)
#raw 0xA = Step Left (Very Slow)
#raw 0xB = Step Right (Very Slow)
#raw 0xC = Step Down (Slow)
#raw 0xD = Step Up (Slow)
#raw 0xE = Step Left (Slow)
#raw 0xF = Step Right (Slow)
#raw 0x10 = Step Down (Normal)
#raw 0x11 = Step Up (Normal)
#raw 0x12 = Step Left (Normal)
#raw 0x13 = Step Right (Normal)
#raw 0x14 = Jump2 Down
#raw 0x15 = Jump2 Up
#raw 0x16 = Jump2 Left
#raw 0x17 = Jump2 Right
#raw 0x18 = Delay1
#raw 0x19 = Delay2
#raw 0x1A = Delay3
#raw 0x1B = Delay4
#raw 0x1C = Delay5
#raw 0x1D = Step Down (Fast)
#raw 0x1E = Step Up (Fast)
#raw 0x1F = Step Left (Fast)
#raw 0x20 = Step Right (Fast)
#raw 0x21 = Step on the Spot Down (Normal)
#raw 0x22 = Step on the Spot Up (Normal)
#raw 0x23 = Step on the Spot Left (Normal)
#raw 0x24 = Step on the Spot Right (Normal)
#raw 0x25 = Step on the Spot Down (Faster)
#raw 0x26 = Step on the Spot Up (Faster)
#raw 0x27 = Step on the Spot Left (Faster)
#raw 0x28 = Step on the Spot Right (Faster)
#raw 0x29 = Step on the Spot Down (Fastest)
#raw 0x2A = Step on the Spot Up (Fastest)
#raw 0x2B = Step on the Spot Left (Fastest)
#raw 0x2C = Step on the Spot Right (Fastest)
#raw 0x2D = Face Down (Delayed)
#raw 0x2E = Face Up (Delayed)
#raw 0x2F = Face Left (Delayed)
#raw 0x30 = Face Right (Delayed)
#raw 0x31 = Slide Down (Slow)
#raw 0x32 = Slide Up (Slow)
#raw 0x33 = Slide Left (Slow)
#raw 0x34 = Slide Right (Slow)
#raw 0x35 = Slide Down (Normal)
#raw 0x36 = Slide Up (Normal)
#raw 0x37 = Slide Left (Normal)
#raw 0x38 = Slide Right (Normal)
#raw 0x39 = Slide Down (Fast)
#raw 0x3A = Slide Up (Fast)
#raw 0x3B = Slide Left (Fast)
#raw 0x3C = Slide Right (Fast)
#raw 0x3D = Slide Running on Right Foot (Down)
#raw 0x3E = Slide Running on Right Foot (Up)
#raw 0x3F = Slide Running on Right Foot (Left)
#raw 0x40 = Slide Running on Right Foot (Right)
#raw 0x41 = Slide Running on Left Foot (Down)
#raw 0x42 = Slide Running on Left Foot (Up)
#raw 0x43 = Slide Running on Left Foot (Left)
#raw 0x44 = Slide Running on Left Foot (Right)
#raw 0x46 = Jump Facing Left (Down)
#raw 0x47 = Jump Facing Down (Up)
#raw 0x48 = Jump Facing Up (Left)
#raw 0x49 = Jump Facing Left (Right)
#raw 0x4A = Face Player
#raw 0x4B = Face Against Player
#raw 0x4C = Lock Sprite Facing
#raw 0x4D = Release Sprite Facing
#raw 0x4E = Jump Down
#raw 0x4F = Jump Up
#raw 0x50 = Jump Left
#raw 0x51 = Jump Right
#raw 0x52 = Jump in Place (Facing Down)
#raw 0x53 = Jump in Place (Facing Up)
#raw 0x54 = Jump in Place (Facing Left)
#raw 0x55 = Jump in Place (Facing Right)
#raw 0x56 = Jump in Place (Facing Down/Up)
#raw 0x57 = Jump in Place (Facing Up/Down)
#raw 0x58 = Jump in Place (Facing Left/Right)
#raw 0x59 = Jump in Place (Facing Right/Left)
#raw 0x60 = Hide Sprite
#raw 0x61 = Show Sprite
#raw 0x62 = Exclamation Mark (!)
#raw 0x63 = Question Mark (?)
#raw 0x64 = Cross (X)
#raw 0x65 = Double Exclamation Mark (!!)
#raw 0x66 = Happy (^_^)
#raw 0xFE = End of Movements


Feel free to use the code snippet or PM me for more help.

grungefan330 September 24th, 2015 1:21 PM

That did it, thanks!

grungefan330 September 25th, 2015 1:03 AM

Quote:

Originally Posted by Vendily (Post 8940475)
Your thinking is correct. It's all about flags.
Here's a script I made just now for you as an example for Firered in XSE.
Code:

#dynamic 0x800000
#org @start
lock
faceplayer
checkflag 0x828
if 0x1 goto @HavePoke
msgbox @NoPass 0x2
end

#org @HavePoke
msgbox @CanPass 0x2
applymovement LASTTALKED @Move
end

#org @NoPass
= GUY: You shall not pass.

#org @CanPass
= GUY: You have a pokemon.\nYou can pass.

#org @Move
#raw 0x13
#raw 0xFE


There is a checkflag command which checks if the flag is active or not. 0x828 is the flag for the pokemon menu, which should be activated when you get your starter.
Here are the rest.
Spoiler:
0x820 – Activates First Badge
0x821 - Activates Second Badge
0x822 - Activates Third Badge
0x823 - Activates Fourth Badge
0x824 - Activates Fifth Badge
0x825 - Activates Sixth Badge
0x826 - Activates Seventh Badge
0x827 - Activates Eighth Badge
0x828 - Activates Pokemon Menu
0x829 - Activates Pokedex Menu
0x82F - Activates Running Shoes

Under the checkflag is if 0x1 goto @HavePoke. Basically it's if flag 0x828 is activated, then go to our pointer @HavePoke. 0x1 is active, 0x0 is not active.
Under @HavePoke is our applymovement. In this case it's make the guy you last talked use the movements under @Move.
#raw 0x13 makes our guy move over to the right, while 0xFE ends the movement section.
Here's the full list of movements too. (It's long)
Spoiler:
#raw 0x0 = Face Down
#raw 0x1 = Face Up
#raw 0x2 = Face Left
#raw 0x3 = Face Right
#raw 0x4 = Face Down (Faster)
#raw 0x5 = Face Up (Faster)
#raw 0x6 = Face Left (Faster)
#raw 0x7 = Face Right (Faster)
#raw 0x8 = Step Down (Very Slow)
#raw 0x9 = Step Up (Very Slow)
#raw 0xA = Step Left (Very Slow)
#raw 0xB = Step Right (Very Slow)
#raw 0xC = Step Down (Slow)
#raw 0xD = Step Up (Slow)
#raw 0xE = Step Left (Slow)
#raw 0xF = Step Right (Slow)
#raw 0x10 = Step Down (Normal)
#raw 0x11 = Step Up (Normal)
#raw 0x12 = Step Left (Normal)
#raw 0x13 = Step Right (Normal)
#raw 0x14 = Jump2 Down
#raw 0x15 = Jump2 Up
#raw 0x16 = Jump2 Left
#raw 0x17 = Jump2 Right
#raw 0x18 = Delay1
#raw 0x19 = Delay2
#raw 0x1A = Delay3
#raw 0x1B = Delay4
#raw 0x1C = Delay5
#raw 0x1D = Step Down (Fast)
#raw 0x1E = Step Up (Fast)
#raw 0x1F = Step Left (Fast)
#raw 0x20 = Step Right (Fast)
#raw 0x21 = Step on the Spot Down (Normal)
#raw 0x22 = Step on the Spot Up (Normal)
#raw 0x23 = Step on the Spot Left (Normal)
#raw 0x24 = Step on the Spot Right (Normal)
#raw 0x25 = Step on the Spot Down (Faster)
#raw 0x26 = Step on the Spot Up (Faster)
#raw 0x27 = Step on the Spot Left (Faster)
#raw 0x28 = Step on the Spot Right (Faster)
#raw 0x29 = Step on the Spot Down (Fastest)
#raw 0x2A = Step on the Spot Up (Fastest)
#raw 0x2B = Step on the Spot Left (Fastest)
#raw 0x2C = Step on the Spot Right (Fastest)
#raw 0x2D = Face Down (Delayed)
#raw 0x2E = Face Up (Delayed)
#raw 0x2F = Face Left (Delayed)
#raw 0x30 = Face Right (Delayed)
#raw 0x31 = Slide Down (Slow)
#raw 0x32 = Slide Up (Slow)
#raw 0x33 = Slide Left (Slow)
#raw 0x34 = Slide Right (Slow)
#raw 0x35 = Slide Down (Normal)
#raw 0x36 = Slide Up (Normal)
#raw 0x37 = Slide Left (Normal)
#raw 0x38 = Slide Right (Normal)
#raw 0x39 = Slide Down (Fast)
#raw 0x3A = Slide Up (Fast)
#raw 0x3B = Slide Left (Fast)
#raw 0x3C = Slide Right (Fast)
#raw 0x3D = Slide Running on Right Foot (Down)
#raw 0x3E = Slide Running on Right Foot (Up)
#raw 0x3F = Slide Running on Right Foot (Left)
#raw 0x40 = Slide Running on Right Foot (Right)
#raw 0x41 = Slide Running on Left Foot (Down)
#raw 0x42 = Slide Running on Left Foot (Up)
#raw 0x43 = Slide Running on Left Foot (Left)
#raw 0x44 = Slide Running on Left Foot (Right)
#raw 0x46 = Jump Facing Left (Down)
#raw 0x47 = Jump Facing Down (Up)
#raw 0x48 = Jump Facing Up (Left)
#raw 0x49 = Jump Facing Left (Right)
#raw 0x4A = Face Player
#raw 0x4B = Face Against Player
#raw 0x4C = Lock Sprite Facing
#raw 0x4D = Release Sprite Facing
#raw 0x4E = Jump Down
#raw 0x4F = Jump Up
#raw 0x50 = Jump Left
#raw 0x51 = Jump Right
#raw 0x52 = Jump in Place (Facing Down)
#raw 0x53 = Jump in Place (Facing Up)
#raw 0x54 = Jump in Place (Facing Left)
#raw 0x55 = Jump in Place (Facing Right)
#raw 0x56 = Jump in Place (Facing Down/Up)
#raw 0x57 = Jump in Place (Facing Up/Down)
#raw 0x58 = Jump in Place (Facing Left/Right)
#raw 0x59 = Jump in Place (Facing Right/Left)
#raw 0x60 = Hide Sprite
#raw 0x61 = Show Sprite
#raw 0x62 = Exclamation Mark (!)
#raw 0x63 = Question Mark (?)
#raw 0x64 = Cross (X)
#raw 0x65 = Double Exclamation Mark (!!)
#raw 0x66 = Happy (^_^)
#raw 0xFE = End of Movements


Feel free to use the code snippet or PM me for more help.

Next question...baseing what I did on this script and a trainer battle script tutorial and not being able to connect the computer to internet at the momemt nor wanting type out 64 lines on my phone, do you have any idea why instead of ending my script it starts to repeat the beginning and then ends? It finishes the battle but instead of the rival walking away like he should, he just stands there. You step on the tile again and it says "hey if it isn't (player)" like at the beginning. Then he does the same movents he did to get to the player says the last lime about needing to go see the professor and then dissapears like he was supposed to at the end of the script. I checked all my apply movements and everything links properly as far as I can tell and my movents themselves are right?

grungefan330 September 25th, 2015 11:03 AM

#dynamic 0x2E04CF

#org @start
msgbox @1 0x6
applymovement 7 @walk1
waitmovement 7
applymovement 0xff @walk2
waitmovement 0xff
trainerbattle 0x0 0x146 0x0 @before @after
msgbox @2 0x6
applymovement 7 @walk3
hidesprite 0x7
waitmovement 7
setvar 0x6500 0x1
setflag 0x1208
release
end

#org @1
= Hey, if it isn't [player]!

#org @before
= Did you\nfinally get a pokemon of your own?\lLet's see how strong it is with a\lbattle.

#org @after
= I can't believe you beat me. I\neven have my trainers license\lalready!

#org @2
= With as strong as you are\lalready, you should go get yours\ltoo and take the pokemon league\lgym challenge. Anyway, I have to\lstop by and see Professor Swann so\lI'll catch ya later!

#org @walk1
#raw 0x12
#raw 0x12
#raw 0x12
#raw 0x12
#raw 0x12
#raw 0x4
#raw 0x4c
#raw 0x10
#raw 0x10
#raw 0xfe

#org @walk2
#raw 0x63
#raw 0xfe

#org @walk3
#raw 0x2
#raw 0x4c
#raw 0x12
#raw 0x4
#raw 0x4c
#raw 0x10
#raw 0x10
#raw 0x10
#raw 0x2
#raw 0x4c
#raw 0x12
#raw 0x4
#raw 0x4c
#raw 0x10
#raw 0x10
#raw 0x1

That's the script. It gets through the battle then he stops. You step off and back on the tile again and he does the same movements and speaking prior to the battle, then says the last line and then dissapears. The whole last movement is cuut out and replaced with the first movements again and I don't understand why.


All times are GMT -8. The time now is 2:31 AM.


Like our Facebook Page Follow us on Twitter © 2002 - 2018 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2016 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.

Acknowledgements
Use of PokéCommunity Assets
vB Optimise by DragonByte Technologies Ltd © 2023.