Pokered Overworld Encounter Help

I am attempting to add an overworld encounter to a map in Pokered (similar to the legendary birds' encounters), and have one issue I can't seem to figure out. The object and its scripts seem to work fine, the encouter is appearing like it should, and interacting with it triggers the battle properly. The one problem is that, after the encounter, the object remains on the map. The event seems to be working properly, as when I interact with the object again, it does not trigger a second battle, it just displays the text and plays the cry as if it were an NPC. I have added a constant in the hide_show_constants and added it to hide_show_data as well. I was told to add lines to the script to set wMissableObjectIndex to my constant and call HideSprite, but that didn't seem to have any effect. I have copied the code for the object and script mainly from the Zapdos data in the power plant scripts and map objects files, so I have been trying to match this encounter the same way. As far as I can tell, none of the legendary encounters use the wMissableObjectIndex in their scripts, so I am guessing there is somewhere that is flagging them to hide the object somewhere else. I'd like to keep my additions as close as possible to the preexisting code if I can. Does anyone have any pointers for these types of encounters? Thanks.

Re: Pokered Overworld Encounter Help

An update to this question. I started researching the source code of Mateo's Red++ hack, as I know that hack has additional encounters in it, and I found he's edited the "level" parameter of all the overworld encounter object so that the level is OR'd by 0x80. I'm guessing this bit is acting as a flag for whatever function processes the data, but I don't know enough about the core functionality to know what exactly is receiving this argument and how the flag is being used. If someone could point me to the code that reads these arguments for the encouter objects, it would help a lot.

Re: Pokered Overworld Encounter Help

That argument would not work in vanilla pokered. That's part of the changes made to split Pokemon IDs and trainer IDs. Since Overworld Pokemon are just Trainer events, they needed to somehow have the ID flagged as being a Pokemon ID instead of a Trainer ID, and that bit of the level was never used originally anyway, making it a good place to store it.

Really, what you need to do is add an appropriate entry into data/hide_show_data.asm for your map and for the event that corresponds to your Pokemon. If you look at mine for example, you'll see that I've added entries for Faraway Island, Southern Island, and Navel Rock by finding the correct entry in the pointer table for my map, replacing the "dw MapHSXX" label with a new one for whichever map ID that was, for example "dw MapHS6E" since it was map 6E, then went to the corresponding location in the data and added my entries there. In this case, that was at the end of the table. I also added a corresponding constant in constants/hide_show_constants.asm

That should be all you have to do. If I remember correctly, the routines that run after a battle will already check to see if the event that you talked to has a hide/show flag and will mark it as hidden after the battle. If you ignore the " | OW_POKEMON" part, you should be able to look at what Mew does on Faraway Island for an example. I would link to the actual commits, but adding Mew was lumped in with other stuff for adding the map, and was based on pretty outdated code from before up-to-date pokered was merged back in, so it would probably be more confusing than helpful.

Re: Pokered Overworld Encounter Help

Awesome, thanks for the help! I got it running, so here is what I did. The encounter was added to route 2, and I'd set the object to index 0x05 (the 2 items are 1 and 2, and the 2 signs are 3 and 4). I'd set the addition I made in hide_show_data to be for index number 5, but it didn't work until I changed the encounter to index number 3, bumping the signs up to 4 and 5. I guess the hide_show routines want the objects to all be listed together.