Hello Rom Hacking Community!
So I've only recently gotten into rom hacking so there's still a lot I don't know. I wanted to ask for help with making an event's sprite be dependent on the player's gender. To explain, my FireRed rom hack will be including Red/Leaf as a secondary rival. How do I go about making Leaf's overworld sprite appear when the player is playing as Red, and vice versa? To follow that up, how can I make their in-battle sprites appear accordingly as well? Thanks for the help in advance! :)
Since its just the rival and I assume all text would be the same, what you do is this, you use a special to check for the gender of the player. (pretty sure there is one, but i just don't know what it is, I'll add a link after.)
Every script that involves the rival must include a a variable value check.
If you use an unused permanent variable, you can use the same one for the entire game.
The first time at the start with the first rival appearance you need to define what variable you're going to use, and which values you will set it to.
Like this
if (special that checks gender) is (value for male player)
set var (chosen variable number) 0x(some number)
if (special that checks gender) is (value for female player)
set var (same chosen variable number) 0x(some different number, like +1 the other number)
from there use a goto, to the normal script but include this part in all rival scripts.
if var (chosen variable number same as before) is (value for male)
set flag 0x(some unused flag number)
show sprite 0x(advancemap sprite id number for male rival on that map)
if var (same chosen variable number) is (value for female rival)
set flag 0x(different unused flag number)
show sprite 0x(advancemap sprite id number for female rival on that map)
Now in every case you have a rival doing any movement, you're going to need 2 different
apply movement commands; one for each rival's ID number.
Because of how the apply movement command works, we can use the same movement for any npc, as long
as we chose the right person ID number.
Now since we're trying to chose a variable that we can keep using you're going to include that part in quotes above in every rival script, to make it but we're not going to need the part where we set variable's value because we don't need to change it, since the player's gender isn't going to change at any time in the game.
A few more details for setup, What you're going to want to do in advance map, is wherever you want the secondary rival to appear, overlap the npc sprites in advance map, and use the advance map toggle to switch between them.
As long as you assign event scripts to either level scripts, or tiles on the map, instead of the npc themselves you can just use 1 event script instead of 2 every time they appear.
The rival npc's must be sharing the exact same tile space, so you don't need multiple movement scripts.
If they are starting from the same tile, they can use the same movement script and end up right where you want them to.
Hide Sprite/Show Sprite
Apply Movement
Specials (check bottom of link page for the rest)
Level Scripting Tutorial - Youtube
Ok I believe that should be everything you need, for this, but I'll also share the main page those resources came from below.
https://www.pokecommunity.com/threads/397107
Now the basic theory of what I'm saying is sound, but there may be some things I didn't explain correctly as far as specific syntax etc.
So follow the guides well to understand the full of what you need to do.
Especially those youtube tutorials.
You're going to need to know how to find all scripts on a map, how to change sprite picture id in advance map, and find the person number for each npc on a map, and how to reference them.
How to set event scripts on a map to stop a player then activate, and how to use level scripts.
I use advance map 1.9.5 and with that some event script stuff is easier than A-map 1.9.2 but the 1.9.5 version is somewhat buggy at times, so there's a little more potential risk for the benefit, but with frequent backups I think its somewhat avoidable.
So look at everything and consider what tool you'll use, because the processes are a little different depending on that.
Specifically A-map 1.9.5 has the "talking level" feature which lets you easily set event scripts to activate on walk over.
Good luck.