• 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.

Research: "Background" Scripts

5,256
Posts
16
Years

Running Background Scripts

The following is referring to FireRed, BPRE.

Let me preface this with the fact that I know almost nothing about the game engine, how scripts are executed, and only understand the bare basics of ASM. I wonder, however, how possible it would be to execute scripts; level scripts, in particular; that run in the background without locking events such as the player.

The main purpose for this includes JPAN's engine's button checking specials running in the background which would activate a chain of events whenever you push a specific button/combination of buttons.

One theoretical problem I have thought of is lag: having a script constantly running in the background would surely cause lag, but would it be crippling? If so, are there other more direct ways of having an event occur from a button press in certain situations?

Hopefully this "brief" is enough to get some minds turning. I think this would open up loads of possibilities for minigamems, different types of gameplay, etc. I look forward to your ideas!
 
Last edited:

tajaros

Hi I'm dawg
855
Posts
12
Years
Hmm...

This is Interesting could be useful for some hacks...

Maybe we can learn how to do this if we knew how the Movement Types in A-map work and how they execute. It may also be called using callasm that will call the ASM Routine that would let us do that. Maybe some People like (Jambo51, Darthathron, shiny quagsire, etc.)
 
5,256
Posts
16
Years
Well, I think special 0xcb in JPAN's Hacked Engine allows you to set scripts upon button pressing but its really glitchy and I cant get it to work.
 

itman

Back to ROM hacking. :D
98
Posts
16
Years
  • Age 30
  • Seen Feb 5, 2014
Well, I think special 0xcb in JPAN's Hacked Engine allows you to set scripts upon button pressing but its really glitchy and I cant get it to work.

You're supposed to make the script loop. Since you need to press the button at the "exact" second of execution (just the way the script was made). In his guide he shows how to make it loop so it'll get the button press. I've gotten it to work.


Speaking of the topic,
JPAN started this with his hack Engine, with having scripts activate everytime you take a step.
As he states in his guide, unfortunately, this CANNOT be used to make a follow me script, since it takes priority and has "lock" commands upon activating. Since script tiles naturally have a "lock" effect and that's what this feature was based on.

Jambo51 has made a successful follow me script (well, he says it's not completed, but it's the farthest anybody has gotten). Which means he understands running background scripts (from what I can see).
http://www.youtube.com/watch?v=y2hUoO2yxcA&list=UUrYOFkbLGlELKwwN3bfmAkw&index=24&feature=plcp
 

itman

Back to ROM hacking. :D
98
Posts
16
Years
  • Age 30
  • Seen Feb 5, 2014
No, you're thinking of a different special.

I know which one you're referring to. I got it to work by making it loop. The guide that comes with it doesn't give a full example of how to use that special. -_-
 

Darthatron

巨大なトロール。
1,152
Posts
18
Years
I know where the check for the L/R button press is. It'd be easy to call a script based on that. :) Either way, it's easy to check the buttons every frame anyway. Really easy. Calling scripts is also really easy.
 

tajaros

Hi I'm dawg
855
Posts
12
Years
I know where the check for the L/R button press is. It'd be easy to call a script based on that. :) Either way, it's easy to check the buttons every frame anyway. Really easy. Calling scripts is also really easy.
Woah, you already know how to do this? Can you please share it to us? Please... :)
 

Darthatron

巨大なトロール。
1,152
Posts
18
Years
Woah, you already know how to do this? Can you please share it to us? Please... :)
Sure thang.

Keypresses are handled as so:
Spoiler:

Calling scripts from ASM is also fairly simple:
You can run any script by calling 0x08069B48 with the script offset in the r0 register. This is how the game calls most scripts, such as level scripts and the flag setting script when you start a new game.

I hope this helps. :)

All offsets are for FireRed US (1.0) and may not work with other games or versions. Also, no code was tested. I just wrote it with the post.
 

tajaros

Hi I'm dawg
855
Posts
12
Years
Sure thang.

Keypresses are handled as so:
Spoiler:

Calling scripts from ASM is also fairly simple:
You can run any script by calling 0x08069B48 with the script offset in the r0 register. This is how the game calls most scripts, such as level scripts and the flag setting script when you start a new game.

I hope this helps. :)

All offsets are for FireRed US (1.0) and may not work with other games or versions. Also, no code was tested. I just wrote it with the post.

Cool, I'll be sure to try this out when I'm on my free time... :)
 
Back
Top