You are not logged in.
So basically I'm looking for some help in writing an ASM script for Viridian Forest map in Red. I've had a look over the Cerulean City and Pewter City scripts. Basically I want a certain NPC to disappear when spoken to and to activate the flag that means the Pewter City guy has disappeared also. Right now the Pewter City guy has been moved to in front of the GYM, he says a message about the gym leader not being there, you find the gym leader in the forest, he walks off screen and then the guy in front of pewter gym is no longer there (the leader has returned).
This is all I have so far but I think setting up the flags and hiding the NPCs is what im struggling with.
ViridianForestText8: db $08 ; asm ld hl, HackScript1 call PrintText predef EmotionBubble ld hl, HackScript2 call PrintText jp TextScriptEnd HackScript1: TX_FAR _ViridianForestText8 db "@" HackScript2: TX_FAR _ViridianForestText9 db "@"
There is a list of global ids that correspond to objects in the game that can be hidden. It's a bit painful to add new objects to this list, at least in my experience. You can see this list by looking at the MapHS data structure. I would recommend borrowing an item from viridian forest, and turning it into an NPC. Then just use that item's global HS (hide/show) Id. There is a predef function that hides an object. You can look at other map scripts for an example on how to use it.
Hope that helps some.
It is no longer difficult to edit the currently existing hide/show objects.
Simply add a new Hide/Show object after the three items in Viridian Forest:
MapHS33: ; cc16 (3:4c16) db VIRIDIAN_FOREST,$05,Show db VIRIDIAN_FOREST,$06,Show db VIRIDIAN_FOREST,$07,Show
So add a forth line, where VIRIDIAN_FOREST is the map, followed by the object id for that map (from data/mapObjects/viridianforest.asm), followed by the default state (Show).
Then add a constant for that hide/show npc in constants/hide_show_constants.asm
You have to add this constant immediately after the three existing Viridian Forest constants.
Notice how the Pewter City Gym script removes an object from a different map (Pewter City):
ld a, HS_GYM_GUY ld [wcc4d], a predef HideObject
So you could easily hide the Pewter City gym guy from inside the Viridian Forest map script.
Awesome! One thing to note is that you won't be able to add many more brand new HS objects. Since their ID is one byte, there are a max of 256, and i believe there are already roughly 240 in the game. I would do some txt checking, but I'm doing this on my phone and might be wrong again.
Last edited by ShantyTown (2015-02-26 21:40:34)
Wanted to bump this thread with a relevant question.
I notice that in wram.asm
W_MISSABLEOBJECTFLAGS:: ; d5a6 ; bit array of missable objects. set = removed ds 39
There seem to be 39 bytes assigned for storing flags, which works out to 312 individual flags assuming it is a normal bit array. So that would indicate we can add new hide/show entries to the end of the list (for a new area, for example) without having to allocate more space in wram.asm, correct?
EDIT: Just to clarify, in my experimenting, it does seem like this is the case, since Articuno is the last entry in the list, and there is more room afterwards that isn't used, so it looks to be safe, but I just wanted to make sure there wasn't something else I'm missing that would make it unsafe.
Last edited by Mateo (2015-08-23 20:36:46)