- 250
- Posts
- 7
- Years
- Seen Apr 23, 2025
I've been trying to find a way where, when the player starts up a new game in Pokemon Emerald, the type-effectiveness table is randomized. Fire might be super-effective against Dragon, Dark might not affect Grass, etc. I know that the effectiveness table is in src/battle_util.c, but the issue I have is that the table is a constant array. This, obviously, makes it impossible for the values within said array to be changed at any point within the code without just changing the values directly within the array before compiling the ROM. However, I want the game to randomize the type-effectiveness table when the player clicks "New Game", so that isn't a solution for me. I've tried removing the "const" keyword, as well as placing it at different points within src/battle_util.c, but whenever I compile, I get this error:
I know this error comes up when you remove the "const" keyword from rom const data, but I have to somehow remove that keyword so that I can have the code edit those values. Is there anyway to go about this?
Code:
`.data' referenced in section `.text' of src/battle_util.o: defined in discarded
section `.data' of src/battle_util.o
`.data' referenced in section `.text' of src/battle_util.o: defined in discarded
section `.data' of src/battle_util.o