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

Development: Pokémon Fire Red Hacked Engine

masterquestmq

Enthusiastic Rom Hacker
194
Posts
13
Years
  • Seen Nov 19, 2023
I've been having trouble with the nurse joy script on this hacked engine

the game crashes after she gives me back the pokemon(before the hope we see you again script)

is it the script or we just cant recreate the nurse joy script?

some help here

#dynamic 0x720000
#org @nurse_start
lock
faceplayer
special 0x187
compare LASTRESULT 0x2
if 0x1 goto @error_release
preparemsg @heal_q '"Welcome to our POKéMON CENTER!\pWo..."
waitmsg
multichoice 0x13 0x8 0x0 0x2
copyvar 0x8000 LASTRESULT
compare 0x8000 0x0
if 0x1 goto @set_heal_poke
compare 0x8000 0x1
if 0x1 goto @go_away
compare 0x8000 0x7F
if 0x1 goto @go_away
release
end

'---------------
#org @error_release
release
end

'---------------
#org @set_heal_poke
cmdc3 0xF
preparemsg @will_heal '"Okay, I'll take your POKéMON for a..."
waitmsg
call @heal_anime
special 0x169
goto @check_wireless

'---------------
#org @go_away
msgbox @goodbye MSG_KEEPOPEN '"We hope to see you again!"
release
end
 
20
Posts
15
Years
  • Seen Mar 3, 2014
YEA! i agree. expanding the pokedex would basically make you, JPAN, the ONE PERSON to think of everything i could possibly need... besides lu-ho and hackmew
 

masterquestmq

Enthusiastic Rom Hacker
194
Posts
13
Years
  • Seen Nov 19, 2023
Scripts deleting themselves

I have a problem

everytime I compile scripts they work perfectly in the game.
its been great for a week until today

After I compile scripts in the game they work normally
but after a few hours when i reload my rom some scripts just disappear. (some old scripts some new ones life signposts talking scripts and even my mom script :nervous:

Now im so paranoid i check my rom every few hours and some scripts are still disappearing. when i click the open script tab on AM it shows me an empty XSE screen with just the offset.

I use XSE to script and i search from beginning of rom to get my offset


am i doing something wrong
or its a major bug on my rom?
 
190
Posts
14
Years
  • Seen Apr 14, 2016
I have a problem

everytime I compile scripts they work perfectly in the game.
its been great for a week until today

After I compile scripts in the game they work normally
but after a few hours when i reload my rom some scripts just disappear. (some old scripts some new ones life signposts talking scripts and even my mom script :nervous:

Now im so paranoid i check my rom every few hours and some scripts are still disappearing. when i click the open script tab on AM it shows me an empty XSE screen with just the offset.

I use XSE to script and i search from beginning of rom to get my offset


am i doing something wrong
or its a major bug on my rom?

well most people start at 800000 when looking for an offset, only because things that are happening to you do occur. try using offsets from 800000 and up.
 

Sora's Nobody

The Official Roxas
1,112
Posts
14
Years
Does someone know why this happens when i mess around in A-MAP. The rom is patched with the engine. It happens everytime i add a event and then try doing something else (more or less...)
14w3zid.jpg
 

masterquestmq

Enthusiastic Rom Hacker
194
Posts
13
Years
  • Seen Nov 19, 2023
Still a problem (some scripts being deleted)

for the past 2 days my hack has been going well.. I took the advice of a hacker and started using offsets from 80000 and above.

However today when I was running through my hack i notice that one of the signpost script was deleted (this signpost was a 80000 and above offset). any idea why this happened? I notice that whenever I attempt a long apply movement script some small text script will go missing..

its really bugging me
can it be the rom?
a bug?
or its a common problem?
 

metapod23

Hardened Trainer
673
Posts
15
Years
  • Seen Aug 18, 2016
Still a problem (some scripts being deleted)

for the past 2 days my hack has been going well.. I took the advice of a hacker and started using offsets from 80000 and above.

However today when I was running through my hack i notice that one of the signpost script was deleted (this signpost was a 80000 and above offset). any idea why this happened? I notice that whenever I attempt a long apply movement script some small text script will go missing..

its really bugging me
can it be the rom?
a bug?
or its a common problem?

Were you using a dynamic offset for your scripts, or were you selecting the offsets manually?

Also, do you mean you're using offsets from 800000 or do you really mean 80000? If it's the latter, I'm sure the hacker meant to use offsets from 800000 - you could really do some damage to the rom by using offsets at 80000.
 

masterquestmq

Enthusiastic Rom Hacker
194
Posts
13
Years
  • Seen Nov 19, 2023
Were you using a dynamic offset for your scripts, or were you selecting the offsets manually?

Also, do you mean you're using offsets from 800000 or do you really mean 80000? If it's the latter, I'm sure the hacker meant to use offsets from 800000 - you could really do some damage to the rom by using offsets at 80000.

Sorry typo been using 800000 and dynamic in front of it.
so i start a script basically like this:

dynamic 0xoffset

could it be something else that's deleting minor scripts in my hack?
 

DrFuji

[I]Heiki Hecchara‌‌[/I]
1,691
Posts
14
Years
Sorry typo been using 800000 and dynamic in front of it.
so i start a script basically like this:

dynamic 0xoffset

could it be something else that's deleting minor scripts in my hack?

Do you have your ROM open in another program (other than XSE or Advance Map) when you make, insert and save the scripts? If you do, saving that program may be deleting all of your work as the new script pointers did not exist when you opened the program.
 

metapod23

Hardened Trainer
673
Posts
15
Years
  • Seen Aug 18, 2016
Sorry typo been using 800000 and dynamic in front of it.
so i start a script basically like this:

dynamic 0xoffset

could it be something else that's deleting minor scripts in my hack?

So just to make sure, a dialogue script you wrote would look something like this:

Code:
#dynamic 0x800000

#org @start
msgbox @message msg_face
end

#org @message
= Hi!

If you're doing everything about like that, I don't see why any scripts would be deleted. The only problems I've had with scripts being overwritten is when I would put in the offsets manually, instead of letting XSE's dynamic process locate them for me. I've been using the Fire Red Hacked Engine for my hack for some time without having encountered such a problem.
 

shinyabsol1

Pokemon DarkJasper!?
333
Posts
13
Years
  • Seen Nov 23, 2022
So. If I have read everything here correctly, applying this to my hack in progress will not cause any problems unless I have been using earlier offsets in the rom, like where all of nintendo's scripts are? But it will clear all of the events already in game including the Pokemon centers/marts? Have I got this correct?
 

masterquestmq

Enthusiastic Rom Hacker
194
Posts
13
Years
  • Seen Nov 19, 2023
So just to make sure, a dialogue script you wrote would look something like this:

Code:
#dynamic 0x800000

#org @start
msgbox @message msg_face
end

#org @message
= Hi!
If you're doing everything about like that, I don't see why any scripts would be deleted. The only problems I've had with scripts being overwritten is when I would put in the offsets manually, instead of letting XSE's dynamic process locate them for me. I've been using the Fire Red Hacked Engine for my hack for some time without having encountered such a problem.




So to be clear

I do not have to use FSF anymore?

just type dynamic #0x800000 and XSE will find the right offset for it?
 

linkandzelda

Ex-rom hacker turned indie game developer
777
Posts
17
Years
no, you will still need FSF. its just that you need to find offsets after 0x800000 in FSF. that way

I thought that when using #dynamic 0x800000 XSE will find the space for me and put the script there. I've never used FSF in my life for scripting.
 

DrFuji

[I]Heiki Hecchara‌‌[/I]
1,691
Posts
14
Years
no, you will still need FSF. its just that you need to find offsets after 0x800000 in FSF. that way

When scripting you just need to put '#dynamic [Offset]' and XSE will find the closest offset from that point onwards to place the script so it isn't necessary to continuously find space in FSF. While FSF is useful if you want/ need to place things beyond the general 0x800000 area its use in scripting is limited thanks to dynamic offsets.
 

metapod23

Hardened Trainer
673
Posts
15
Years
  • Seen Aug 18, 2016
So to be clear

I do not have to use FSF anymore?

just type dynamic #0x800000 and XSE will find the right offset for it?

Yeah, if you're using XSE, you don't really need FSF for scripting. It's useful for other things, like finding where to insert certain images, or repointing data, though. But XSE does the work of FSF for us when you use the dynamic command. Just make sure "Show Log" is checked in the Batch Compiler, and then copy the offset shown in the log window that pops up after you compile your script, and put that offset in the script in A-Map.
 

masterquestmq

Enthusiastic Rom Hacker
194
Posts
13
Years
  • Seen Nov 19, 2023
HI, Me again. this time my question is about flags.

Is it safe to say that most flags have been deleted from the game?
is it safe that i start a flag from 0x200 and go up by one everytime?
 

metapod23

Hardened Trainer
673
Posts
15
Years
  • Seen Aug 18, 2016
HI, Me again. this time my question is about flags.

Is it safe to say that most flags have been deleted from the game?
is it safe that i start a flag from 0x200 and go up by one everytime?

The flags aren't deleted per se. A flag is only safe to use if you know what it's specific purpose was originally and what it does when you set it. One flag turns on the Pokemon menu, another activates the running shoes, etc. You can't use those kinds of flags at all. There are also eight flags that activate each of the Badges. Other flags, like 2C, keep the sprite hidden when set to its Person ID. If you clear that flag, the sprite will no longer be hidden. The flags aren't gone from the game, they still provide the same functions as before, and you're best off just starting where XSE recommends, because you won't know what sort of in-game functions you might be activating or deactivating by using other flags.
 

miksy91

Dark Energy is back in action! ;)
1,480
Posts
15
Years
Just as metapod said, you shouldn't use certain flags in your hack.
If you know where the game writes the data of flags, you can see which flags are automatically set and which not. However, learning to do it may not be easy as one byte contains the data of eight bits.

Bit no. 1 in the byte = 00/01
Bit no. 2 in the byte = 00/02
Bit no. 3 in the byte = 00/04
Bit no. 4 in the byte = 00/08
Bit no. 5 in the byte = 00/10
Bit no. 6 in the byte = 00/20
Bit no. 7 in the byte = 00/40
Bit no. 8 in the byte = 00/80

So if for example bits number 4 and 7 would be set in certain byte and others wouldn't be set, the byte would be:
00 + 00 + 00 + 08 + 00 + 00 + 40 + 00 = 48


It's safe to use most of the other flags than the ones that are already set when you open the game and play till the point when you appear in your room.
To know which flags are set and which not, use VBA's Memory Viewer and go to the location of the flag bits in RAM.
There is documentation about RAM of 1st & 2nd gen pokemon games so you should be able to find it also for the ones of 3rd.
 
Last edited:

Jambo51

Glory To Arstotzka
736
Posts
14
Years
  • Seen Jan 28, 2018
Just as metapod said, you shouldn't use certain flags in your hack.
If you know where the game writes the data of flags, you can see which flags are automatically set and which not. However, learning to do it may not be easy as one byte contains the data of eight bits.

Bit no. 1 in the byte = 00/01
Bit no. 2 in the byte = 00/02
Bit no. 3 in the byte = 00/04
Bit no. 4 in the byte = 00/08
Bit no. 5 in the byte = 00/10
Bit no. 6 in the byte = 00/20
Bit no. 7 in the byte = 00/40
Bit no. 8 in the byte = 00/80

So if for example bits number 4 and 7 would be set in certain byte and others wouldn't be set, the byte would be:
00 + 00 + 00 + 08 + 00 + 00 + 40 + 00 = 48


It's safe to use most of the other flags than the ones that are already set when you open the game and play till the point when you appear in your room.
To know which flags are set and which not, use VBA's Memory Viewer and go to the location of the flag bits in RAM.
There is documentation about RAM of 1st & 2nd gen pokemon games so you should be able to find it also for the ones of 3rd.

Most of this is right, except the flags are DMA protected on most of the 3rd Generation Roms. Ruby and Sapphire have static ram locations, FRLG and Emerald's constantly change. So you won't be able to find the flags that easily. On Fire Red, there's a routine called by warping and changing to the battle screen, which, based on the result of the RNG, writes a ram location to 0x03005008. This ram location is static, and is how the game actually makes use of DMA protected information.

It loads the ram offset stored at 0x03005008, and then works out where the data is located with respect to that base offset. The flags are located at
[03005008] + 0xEE0. You can check this easily as long as you don't change map, as the routine is being called when warping and changing into the battle screen.

Also, just as importantly, the variables and flags and other processes in the rom SHARE MEMORY SPACE. In other words, Flags higher than 0x8FF will start using space assigned to the variables 0x4000 and onwards. 0x4000 is the lowest available variable, while 0x8FF is the highest available flag. Trainerflags are in fact just normal flags, meaning it is very unsafe to extend the trainerbattle table as things stand. Trainerflag 0x1 = Normal Flag 0x501 and so on.

Basically, where possible, try to recycle flags and variables already used in the standard rom.
 
Last edited:
Back
Top