The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > Fan Games > Binary ROM Hacking
Reload this Page Other Beginning Hacking (Gen 1)

Notices
For all updates, view the main page.

Binary ROM Hacking Need a helping hand or just want to talk about binary ROM hacks? Get comments and answers to any ROM Hacking-related problems, questions or thoughts you have here.

Ad Content
Reply
 
Thread Tools
  #26   Link to this post, but load the entire thread.  
Old October 11th, 2015 (2:20 PM).
Crystal_ Crystal_ is offline
 
Join Date: Feb 2013
Location: Spain
Gender: Male
Posts: 170
Quote:
So how do I get it to be recognized as a label?
Remove any identation or spacing of the line where the label is. Labels should be aligned to the left with no spacing or else rgbds will interpret them as instructions or macros.
Reply With Quote
  #27   Link to this post, but load the entire thread.  
Old October 11th, 2015 (6:07 PM).
Imafruitbat Imafruitbat is offline
 
Join Date: Sep 2015
Posts: 56
I see. That wasn't clear from the alignment change when I brought the code to the forum.
Reply With Quote
  #28   Link to this post, but load the entire thread.  
Old October 21st, 2015 (1:31 PM).
Imafruitbat Imafruitbat is offline
 
Join Date: Sep 2015
Posts: 56
Any suggestions for Hex Editors to open the map files (which are .BLKs)? I've tried THINGY and THING32, but they don't seem to recognize the BLK tag. Supposedly I can open my ROM in a program to find the offsets of map edits I've done with PokeMap, but still need a way to get the changes into the actual files so it doesn't overwrite the mapping when I compile other changes (seems tricky).
Reply With Quote
  #29   Link to this post, but load the entire thread.  
Old October 21st, 2015 (2:47 PM).
miksy91's Avatar
miksy91 miksy91 is offline
Dark Energy is back in action! ;)
 
Join Date: Oct 2008
Location: Finland
Gender: Male
Posts: 1,480
Quote:
Originally Posted by Imafruitbat View Post
Any suggestions for Hex Editors to open the map files (which are .BLKs)? I've tried THINGY and THING32, but they don't seem to recognize the BLK tag. Supposedly I can open my ROM in a program to find the offsets of map edits I've done with PokeMap, but still need a way to get the changes into the actual files so it doesn't overwrite the mapping when I compile other changes (seems tricky).
You could always change the extension of the file to some other type that the hex editor you'd like to use is able to open. Or not totally change it at all, but add another extension to the end if needed.

Anyway, I use GoldFinger for hex editing myself and it has been pretty handy in doing everything, so you might like it as well. I have not only used it for rom hacking but checking the data of several other files as well sometimes when I have needed (mostly related to programming really). But it can open a file with any extension.
__________________
Pokémon Dark Energy
Some ROM hacking related stuff
Reply With Quote
  #30   Link to this post, but load the entire thread.  
Old October 22nd, 2015 (2:07 PM). Edited October 24th, 2015 by Imafruitbat.
Imafruitbat Imafruitbat is offline
 
Join Date: Sep 2015
Posts: 56
So I was initially trying to get a person to give an item, but it looked a little too involved when I compared it against scripts that did it. So now I'm just adding an item ball on the ground. So far so good, but the "GotItemText" isn't appearing in the text box when I g to pick the item up, and one of the other sources of text is doing the same (it wasn't before). Additionally, the item isn't being picked up off the ground.

I'll bet it's some kind of script pointing issue, but up to this point I haven't messed too much with adding material, only changing things that were there before. For the sake of learning, I checked the text, script, and mapObject files for the area I'm adding the item against the files for an area that already had an item. I've matched the mapObject files, but can't figure out what's missing between the text and script files.

Unfortunately it doesn't look like I'm going to have time to spend on hex editing for mapping purposes, so I've saved a spare rom with the map changes and will use it as a reference for just doing the mapping again (since that will be faster for me).

EDITED-- Moot point. There was no initial disassembly on my part. DERP.
Reply With Quote
  #31   Link to this post, but load the entire thread.  
Old October 24th, 2015 (9:26 PM).
Imafruitbat Imafruitbat is offline
 
Join Date: Sep 2015
Posts: 56
In hindsight, I realize how naive the thought of simply disassembling my ROM sounds. If it were that easy, it wouldn't have been such huge initial undertaking. I guess I'm back on the manual re-editing page. Although I still haven't quite the hang of those item issues. So close...
Reply With Quote
  #32   Link to this post, but load the entire thread.  
Old October 31st, 2015 (3:05 PM). Edited October 31st, 2015 by Imafruitbat.
Imafruitbat Imafruitbat is offline
 
Join Date: Sep 2015
Posts: 56
So I've found some resources on adding scripts (which is part of the problem with adding obtainable items), but even these haven't solved my issue. After some reading, it seemed much simpler to have an NPC give a FRESH_WATER, but now I can't figure out why the code I'm using isn't working. I don't know if it's because pokered has been updated since the article was written, but it says that only a few lines of code are necessary (when other examples of similar code are much longer).

This is my resource, just for point of reference.

Based on the Warden's Gold Teeth script (FuschiaHouse2.asm), I may need to use the jr nz command, but if I do, how do I know what to call the label? Does it even matter? There are some numerical labels and I don't want to repeat one someplace else and not know it. I'm using the Route 1 potion sample guy as an example as well, and I want to make sure any new text sets I use don't overlap others or otherwise cause problems within my new scripts.

So I figured out some more pieces and can receive the item from the NPC! However, it doesn't display all the text I have set up. I have the script file followed by the text file below. What's it missing?

Spoiler:
VermilionCityScript: ; 197a1 (6:57a1)
call EnableAutoTextBoxDrawing
ld hl, wd126
bit 6, [hl]
res 6, [hl]
push hl
call nz, VermilionCityScript_197cb
pop hl
bit 5, [hl]
res 5, [hl]
call nz, VermilionCityScript_197c0
ld hl, VermilionCityScriptPointers
ld a, [wVermilionCityCurScript]
jp CallFunctionInTable

VermilionCityScript_197c0: ; 197c0 (6:57c0)
call Random
ld a, [$ffd4]
and $e
ld [wFirstLockTrashCanIndex], a
ret

VermilionCityScript_197cb: ; 197cb (6:57cb)
CheckEventHL EVENT_SS_ANNE_LEFT
ret z
CheckEventReuseHL EVENT_WALKED_PAST_GUARD_AFTER_SS_ANNE_LEFT
SetEventReuseHL EVENT_WALKED_PAST_GUARD_AFTER_SS_ANNE_LEFT
ret nz
ld a, $2
ld [wVermilionCityCurScript], a
ret

VermilionCityScriptPointers: ; 197dc (6:57dc)
dw VermilionCityScript0
dw VermilionCityScript1
dw VermilionCityScript2
dw VermilionCityScript3
dw VermilionCityScript4

VermilionCityScript0: ; 197e6 (6:57e6)
ld a, [wSpriteStateData1 + 9]
and a ; cp SPRITE_FACING_DOWN
ret nz
ld hl, CoordsData_19823
call ArePlayerCoordsInArray
ret nc
xor a
ld [hJoyHeld], a
ld [wcf0d], a
ld a, $3
ld [hSpriteIndexOrTextID], a
call DisplayTextID
CheckEvent EVENT_SS_ANNE_LEFT
jr nz, .asm_19810
ld b, S_S__TICKET
predef GetQuantityOfItemInBag
ld a, b
and a
ret nz
.asm_19810
ld a, D_UP
ld [wSimulatedJoypadStatesEnd], a
ld a, $1
ld [wSimulatedJoypadStatesIndex], a
call StartSimulatingJoypadStates
ld a, $1
ld [wVermilionCityCurScript], a
ret

CoordsData_19823: ; 19823 (6:5823)
db $1e,$12
db $ff

VermilionCityScript4: ; 19826 (6:5826)
ld hl, CoordsData_19823
call ArePlayerCoordsInArray
ret c
ld a, $0
ld [wVermilionCityCurScript], a
ret

VermilionCityScript2: ; 19833 (6:5833)
ld a, $ff
ld [wJoyIgnore], a
ld a, D_UP
ld [wSimulatedJoypadStatesEnd], a
ld [wSimulatedJoypadStatesEnd + 1], a
ld a, 2
ld [wSimulatedJoypadStatesIndex], a
call StartSimulatingJoypadStates
ld a, $3
ld [wVermilionCityCurScript], a
ret

VermilionCityScript3: ; 1984e (6:584e)
ld a, [wSimulatedJoypadStatesIndex]
and a
ret nz
xor a
ld [wJoyIgnore], a
ld [hJoyHeld], a
ld a, $0
ld [wVermilionCityCurScript], a
ret

VermilionCityScript1: ; 1985f (6:585f)
ld a, [wSimulatedJoypadStatesIndex]
and a
ret nz
ld c, 10
call DelayFrames
ld a, $0
ld [wVermilionCityCurScript], a
ret

VermilionCityTextPointers: ; 1986f (6:586f)
dw VermilionCityText1
dw VermilionCityText2
dw VermilionCityText3
dw VermilionCityText4
dw VermilionCityText5
dw VermilionCityText6
dw VermilionCityText7
dw VermilionCityText8
dw MartSignText
dw PokeCenterSignText
dw VermilionCityText11
dw VermilionCityText12
dw VermilionCityText13
dw VermilionCityTextDrink
dw VermilionCityGotDrink
dw VermilionCityFull

VermilionCityText1: ; 19889 (6:5889)
TX_FAR _VermilionCityText1
db "@"

VermilionCityText2: ; 1988e (6:588e)
TX_ASM
CheckEvent EVENT_SS_ANNE_LEFT
jr nz, .asm_1989e
ld hl, VermilionCityText_198a7
call PrintText
jr .asm_198a4
.asm_1989e
ld hl, VermilionCityText_198ac
call PrintText
.asm_198a4
jp TextScriptEnd

VermilionCityText_198a7: ; 198a7 (6:58a7)
TX_FAR _VermilionCityText_198a7
db "@"

VermilionCityText_198ac: ; 198ac (6:58ac)
TX_FAR _VermilionCityText_198ac
db "@"

VermilionCityText3: ; 198b1 (6:58b1)
TX_ASM
CheckEvent EVENT_SS_ANNE_LEFT
jr nz, .asm_198f6
ld a, [wSpriteStateData1 + 9]
cp SPRITE_FACING_RIGHT
jr z, .asm_198c8
ld hl, VermilionCityCoords1
call ArePlayerCoordsInArray
jr nc, .asm_198d0
.asm_198c8
ld hl, SSAnneWelcomeText4
call PrintText
jr .asm_198fc
.asm_198d0
ld hl, SSAnneWelcomeText9
call PrintText
ld b, S_S__TICKET
predef GetQuantityOfItemInBag
ld a, b
and a
jr nz, .asm_198e9
ld hl, SSAnneNoTicketText
call PrintText
jr .asm_198fc
.asm_198e9
ld hl, SSAnneFlashedTicketText
call PrintText
ld a, $4
ld [wVermilionCityCurScript], a
jr .asm_198fc
.asm_198f6
ld hl, SSAnneNotHereText
call PrintText
.asm_198fc
jp TextScriptEnd

VermilionCityCoords1: ; 198ff (6:58ff)
db $1d,$13
db $1f,$13
db $ff

SSAnneWelcomeText4: ; 19904 (6:5904)
TX_FAR _SSAnneWelcomeText4
db "@"

SSAnneWelcomeText9: ; 19909 (6:5909)
TX_FAR _SSAnneWelcomeText9
db "@"

SSAnneFlashedTicketText: ; 1990e (6:590e)
TX_FAR _SSAnneFlashedTicketText
db "@"

SSAnneNoTicketText: ; 19913 (6:5913)
TX_FAR _SSAnneNoTicketText
db "@"

SSAnneNotHereText: ; 19918 (6:5918)
TX_FAR _SSAnneNotHereText
db "@"

VermilionCityText4: ; 1991d (6:591d)
TX_ASM
CheckAndSetEvent EVENT_GOT_DRINK
jr nz, .received
ld hl, VermilionCityText4
call PrintText
lb bc, FRESH_WATER, 1
call GiveItem
jr nc, .BagFull
ld hl, VermilionCityGotDrink
jr .done
.BagFull
ld hl, VermilionCityFull
jr .done
.received
ld hl, VermilionCityFull
.done
call PrintText
jp TextScriptEnd

VermilionCityText5: ; 19922 (6:5922)
TX_FAR _VermilionCityText5
TX_ASM
ld a, MACHOP
call PlayCry
call WaitForSoundToFinish
ld hl, VermilionCityText14
ret

VermilionCityText14: ; 19933 (6:5933)
TX_FAR _VermilionCityText14
db "@"

VermilionCityText6: ; 19938 (6:5938)
TX_FAR _VermilionCityText6
db "@"

VermilionCityText7: ; 1993d (6:593d)
TX_FAR _VermilionCityText7
db "@"

VermilionCityText8: ; 19942 (6:5942)
TX_FAR _VermilionCityText8
db "@"

VermilionCityText11: ; 19947 (6:5947)
TX_FAR _VermilionCityText11
db "@"

VermilionCityText12: ; 1994c (6:594c)
TX_FAR _VermilionCityText12
db "@"

VermilionCityText13: ; 19951 (6:5951)
TX_FAR _VermilionCityText13
db "@"

VermilionCityTextDrink:
TX_FAR _VermilionCityTextDrink
db "@"

VermilionCityGotDrink:
TX_FAR _VermilionCityGotDrink
db "@"

VermilionCityFull:
TX_FAR _VermilionCityFull
db "@"


Spoiler:
_VermilionCityText1:: ; a5668 (29:5668)
text "We're careful"
line "about pollution!"

para "We've heard GRIMER"
line "multiplies in"
cont "toxic sludge!"
done

_VermilionCityText_198a7:: ; a56b5 (29:56b5)
text "VERMILION CITY"
line "is named"
cont "especially for"
cont "sunsets like"
cont "these."

para "If only we could"
line "be so grossly"
cont "incandescent..."
done

_VermilionCityText_198ac:: ; a56e2 (29:56e2)
text "So, the S.S.ANNE"
line "departed!"

para "I wish I had"
line "a ticket..."
done

_SSAnneWelcomeText4:: ; a571d (29:571d)
text "Welcome to S.S."
line "ANNE!"
done

_SSAnneWelcomeText9:: ; a5734 (29:5734)
text "Welcome to S.S."
line "ANNE!"

para "Excuse me, do you"
line "have a ticket?"
prompt

_SSAnneFlashedTicketText:: ; a576c (29:576c)
text $52, " flashed"
line "the S.S.TICKET!"

para "Climb aboard!"
done

_SSAnneNoTicketText:: ; a57a3 (29:57a3)
text $52, " doesn't"
line "have an"
cont "S.S.TICKET."

para "Sorry!"

para "You need a ticket"
line "to get aboard."
done

_SSAnneNotHereText:: ; a57f1 (29:57f1)
text "The ship set sail."
done

_VermilionCityText4:: ; a5805 (29:5805)
text "Boy it's hot out!"
line "My #MON is"
cont "working hard!"

para "You look like"
line "you could use a"
cont "drink!"

done

_VermilionCityTextDrink::
text "Still thirsty?"
done

_VermilionCityGotDrink::
text $52, " got"
line "FRESH WATER!"
done

_VermilionCityFull::
text "Not thirsty?"
done

_VermilionCityText5:: ; a5852 (29:5852)
text "MACHOP: Guoh!"
line "[email protected]@"

_VermilionCityText14:: ; a586b (29:586b)
db $0
para "A MACHOP is"
line "stomping the land"
cont "flat."
done

_VermilionCityText6:: ; a5891 (29:5891)
text "It's bright"
line "today. The sun"
cont "is like a"
cont "beaming father.."

para "I can feel"
line "it's pride!"
done

_VermilionCityText7:: ; a58db (29:58db)
text "VERMILION CITY"
line "The Port of"
cont "Exquisite Sunsets"
done

_VermilionCityText8:: ; a5909 (29:5909)
text "NOTICE!"

para "ROUTE 12 may be"
line "blocked off by a"
cont "sleeping #MON."

para "Detour through"
line "ROCK TUNNEL to"
cont "LAVENDER TOWN."

para "VERMILION POLICE"
done

_VermilionCityText11:: ; a5980 (29:5980)
text "#MON FAN CLUB"
line "All #MON fans"
cont "welcome!"
done

_VermilionCityText12:: ; a59a6 (29:59a6)
text "VERMILION CITY"
line "#MON GYM"
cont "LEADER: LT.SURGE"

para "The Lightning "
line "American!"
done

_VermilionCityText13:: ; a59e9 (29:59e9)
text "VERMILION HARBOR"
done



Can anybody point me in the right direction?
Reply With Quote
  #33   Link to this post, but load the entire thread.  
Old November 1st, 2015 (4:51 PM).
Crystal_ Crystal_ is offline
 
Join Date: Feb 2013
Location: Spain
Gender: Male
Posts: 170
Could you be more specific about which is the script that doesn't work? I'm not sure what I should be looking at since you listed the whole viridian city script and text files.

Quote:
Based on the Warden's Gold Teeth script (FuschiaHouse2.asm), I may need to use the jr nz command, but if I do, how do I know what to call the label? Does it even matter? There are some numerical labels and I don't want to repeat one someplace else and not know it. I'm using the Route 1 potion sample guy as an example as well, and I want to make sure any new text sets I use don't overlap others or otherwise cause problems within my new scripts.
Local labels are only relevant within the scope of the function they are at, so you can repeat them anywhere else. If you accidentally create a duplicate label inside the same function the build will fail so you'll notice it.
Reply With Quote
  #34   Link to this post, but load the entire thread.  
Old November 1st, 2015 (6:10 PM).
Imafruitbat Imafruitbat is offline
 
Join Date: Sep 2015
Posts: 56
Quote:
Originally Posted by Imafruitbat View Post
Spoiler:
VermilionCityText4: ; 1991d (6:591d)
TX_ASM
CheckAndSetEvent EVENT_GOT_DRINK
jr nz, .received
ld hl, VermilionCityText4
call PrintText
lb bc, FRESH_WATER, 1
call GiveItem
jr nc, .BagFull
ld hl, VermilionCityGotDrink
jr .done
.BagFull
ld hl, VermilionCityFull
jr .done
.received
ld hl, VermilionCityFull
.done
call PrintText
jp TextScriptEnd

VermilionCityTextDrink:
TX_FAR _VermilionCityTextDrink
db "@"

VermilionCityGotDrink:
TX_FAR _VermilionCityGotDrink
db "@"

VermilionCityFull:
TX_FAR _VermilionCityFull
db "@"


Spoiler:
_VermilionCityText4:: ; a5805 (29:5805)
text "Boy it's hot out!"
line "My #MON is"
cont "working hard!"

para "You look like"
line "you could use a"
cont "drink!"

done

_VermilionCityTextDrink::
text "Still thirsty?"
done

_VermilionCityGotDrink::
text $52, " got"
line "FRESH WATER!"
done

_VermilionCityFull::
text "Not thirsty?"
done
That should be all the stuff I added. I also added sections of something "dw", which I figured was like "write" or something, since all the other scripts had them.
Reply With Quote
  #35   Link to this post, but load the entire thread.  
Old November 2nd, 2015 (4:21 AM).
Crystal_ Crystal_ is offline
 
Join Date: Feb 2013
Location: Spain
Gender: Male
Posts: 170
dw defines a 2-byte word or a list of 2-byte words if you separe them with commas. A two-byte word could be a pointer, a 2-byte number or whatever. For example dw VermilionCityText1 defines a 2-byte pointer to VermilionCityText1. Some function will read that word in order to execute the VermilionCityText1 function from the right location.

Anyway, the script looks good. Which is the text you had trouble displaying?
Reply With Quote
  #36   Link to this post, but load the entire thread.  
Old November 2nd, 2015 (2:00 PM).
Imafruitbat Imafruitbat is offline
 
Join Date: Sep 2015
Posts: 56
Well, it skips "VermilionText4" entirely, although that should be the first text written.

I think my problem is somewhere with setting and checking the event, as it seems to run the text
like I've engaged the event already, hence skipping down to "VermilionTextFull" or "VermilionTextDrink" (since I've been playing with it). Even though it still awards me an item.
Reply With Quote
  #37   Link to this post, but load the entire thread.  
Old November 3rd, 2015 (3:54 AM).
Crystal_ Crystal_ is offline
 
Join Date: Feb 2013
Location: Spain
Gender: Male
Posts: 170
The problem is that VermilionText4 isn't a text, but a script. So you're essentially trying to print a script's code as text.

Replace ld hl, VermilionCityText4 with ld hl, WhateverYouLikeText and add below:

WhateverYouLikeText:
TX_FAR _VermilionCityText4
db "@"
Reply With Quote
  #38   Link to this post, but load the entire thread.  
Old November 3rd, 2015 (9:39 AM).
Imafruitbat Imafruitbat is offline
 
Join Date: Sep 2015
Posts: 56
I see! That fixed all the text, but now i have 2 other issues one big, one not so big:

BIG: I must be missing part of the script that keeps the event from resetting when you leave the area. If I leave Vermilion City and come back I can obtain unlimited Fresh Waters.

Not so big: The text automatically skips to the GotDrink message, instead of waiting for a button press. I tried adding "Prompt" to the end of "VermilionCityText4" in the actual text file, but didn't get any results. Small, but I want it to be as perfect as I can. By a stroke of luck, I also figured out how to get the item music to play. So that's solved.
Reply With Quote
  #39   Link to this post, but load the entire thread.  
Old November 3rd, 2015 (11:15 AM).
Crystal_ Crystal_ is offline
 
Join Date: Feb 2013
Location: Spain
Gender: Male
Posts: 170
Quote:
BIG: I must be missing part of the script that keeps the event from resetting when you leave the area. If I leave Vermilion City and come back I can obtain unlimited Fresh Waters.
Where and how did you define EVENT_GOT_DRINK?

Quote:
Not so big: The text automatically skips to the GotDrink message, instead of waiting for a button press.
I'm not sure but it's probably supposed to work that way between PrintText's.
Reply With Quote
  #40   Link to this post, but load the entire thread.  
Old November 3rd, 2015 (12:11 PM).
Imafruitbat Imafruitbat is offline
 
Join Date: Sep 2015
Posts: 56
Quote:
Originally Posted by Crystal_ View Post
Where and how did you define EVENT_GOT_DRINK?

I'm not sure but it's probably supposed to work that way between PrintText's.
I added a bit for it in Event Constants, because pretty much every event had one. I simply put it at the end as "const EVENT_GOT_DRINK", and then added the next digit in hex on the list.

That section turned green, and it's "; A00, (D887, bit 0)". Did I do it wrong or am missing something?

It wouldn't bug me so much if I hadn't directly compared this new script with the Route 1 potion dude's script. I can confirm that it waits for a button press before giving the item.
Reply With Quote
  #41   Link to this post, but load the entire thread.  
Old November 3rd, 2015 (12:39 PM).
Crystal_ Crystal_ is offline
 
Join Date: Feb 2013
Location: Spain
Gender: Male
Posts: 170
You cannot use wram space wildly for script flags. There's a reserved area for that. The script flags buffer is a 320-byte area that ends at address D886. Address D887 isn't unused and it's in fact the byte used to store the wild encounter rate of the current map, a value that is updated everytime you enter a new map. You have to either make use of some unused flag (I bet there are a few, but I personally don't know which ones could be unused), remove an existing one from an existing script that you'll no longer want in your hack, or expand the event flags area in memory. This is one of the many advantages that hacking over the pokered dissasembly offers compared to using conventional tools. You can do it by simply replacing line 3056 with ds 321 in wram.asm so that a space of 321 bytes (an extra byte) is reserved. That will give you room for eight more flags (D887 bits 0-7). It will shift everything following that address by one byte, so for example the grass rate that occupied D887 before will now move to D888 and so on. This means that it will break your save, but it shouldn't break anything else unless there's some fixed address in pokered that slipped under the radar, but at this point I don't think so.
Reply With Quote
  #42   Link to this post, but load the entire thread.  
Old November 3rd, 2015 (12:48 PM).
Imafruitbat Imafruitbat is offline
 
Join Date: Sep 2015
Posts: 56
So the trick will be figuring out which flags are which so I know which ones I can swap out... Any advice on how to check for that?
Reply With Quote
  #43   Link to this post, but load the entire thread.  
Old November 3rd, 2015 (1:04 PM).
Crystal_ Crystal_ is offline
 
Join Date: Feb 2013
Location: Spain
Gender: Male
Posts: 170
There's no easy way to quicly figure out which are used and which aren't. I'd just expand the area, probably by 10+ bytes at once. It's going to be better in the long run if you are planning on adding more scripts, more trainers, more items, or whatever thing that requires a flag.
Reply With Quote
  #44   Link to this post, but load the entire thread.  
Old November 3rd, 2015 (1:25 PM).
Imafruitbat Imafruitbat is offline
 
Join Date: Sep 2015
Posts: 56
Quote:
Originally Posted by Crystal_ View Post
You can do it by simply replacing line 3056 with ds 321 in wram.asm so that a space of 321 bytes (an extra byte) is reserved. That will give you room for eight more flags (D887 bits 0-7). It will shift everything following that address by one byte, so for example the grass rate that occupied D887 before will now move to D888 and so on. This means that it will break your save, but it shouldn't break anything else unless there's some fixed address in pokered that slipped under the radar, but at this point I don't think so.
So I could add more than just one byte to this area by changing line 3056 to some number higher than 321? For example something like "ds 323", and should add 24 flags??

If it's not too complicated..could you explain how that works? Everything located after that byte simply gets moved down (or up or whatever), and leaves me some more useable space for flags. But if there's a limited amount of memory for everything after to move to, when do I need to stop expanding at?
Reply With Quote
  #45   Link to this post, but load the entire thread.  
Old November 3rd, 2015 (2:16 PM).
Crystal_ Crystal_ is offline
 
Join Date: Feb 2013
Location: Spain
Gender: Male
Posts: 170
Flags are bits, so every byte you add, you get 8 more flags. So yes, you get 24 additional flags in that case.

Yes, everything located after the bytes you add simply gets moved down, and all the references do as well. So, for example, if D8A4 got moved down, say, to D8A9, then any reference in the code to address D8A4 would start referring to D8A9. That's possible because stuff is labeled in the disassembly instead of being hardcoded addresses. D8A4 ins't actually "D8A4", but "wEnemyMons".

WRAM goes from C000 to DFFF. DF00-DFFF is reserved for stack so these cannot be used for anything else. But addresses from DEE2 to DEFF are currently unused in Pokemon/Red blue so you have the possibility of easily expanding the event flags buffer up to 29 bytes (DEFF-DEE2).
Reply With Quote
  #46   Link to this post, but load the entire thread.  
Old November 3rd, 2015 (2:52 PM).
Imafruitbat Imafruitbat is offline
 
Join Date: Sep 2015
Posts: 56
Alright then, looks like my work is cut out for me!

Did my earlier defining the event where I shouldn't have the effect of resetting the event every time, or were those things probably separate?
Reply With Quote
  #47   Link to this post, but load the entire thread.  
Old November 3rd, 2015 (3:36 PM).
Crystal_ Crystal_ is offline
 
Join Date: Feb 2013
Location: Spain
Gender: Male
Posts: 170
Quote:
Did my earlier defining the event where I shouldn't have the effect of resetting the event every time, or were those things probably separate?
You event flag resetted because it overlapped with the grass encounter rate address, which is overwritten every time you enter a new map.
Reply With Quote
  #48   Link to this post, but load the entire thread.  
Old November 4th, 2015 (12:35 AM).
Fotomac's Avatar
Fotomac Fotomac is offline
Genwunner and proud of it
 
Join Date: Aug 2015
Gender: Male
Nature: Hardy
Posts: 909
I'm trying to write a script that has an Oak Aide give the player character the Starter that didn't get chosen inside of the Cerulean Pokémon Center. Basically, what I'm aiming to do is the following:
  • Upon entering Cerulean City, insert a phone call requesting a meeting with the Oak Aide in the Pokémon Center (that much I've already mastered);
  • Keep the guard standing in front of the door of the burglarized house in Cerulean City until the unchosen Starter is picked up or the player character meets with Bill on Cerulean Cape, whichever comes last;
  • Have the Oak Aide tell the player character about the situation that caused the unchosen Starter to fall into his hands;
  • Have him give the unchosen Starter to the player character promptly if there are five or less Pokémon in the player's party, then give some parting words, walk away, and disappear; and
  • Keep him around with an instruction to the player character to make some room for the unchosen Starter if there are six Pokémon in the player's party.

As I experiment with hacking Pokémon Red/Green/Blue, I've already mastered several things, including the insertion of the female player character and the aforementioned phone calls, but I still have a lot to learn; I'm also thinking of giving the player the opportunity to acquire all three of the Starters in-game without trading, among other things.
__________________
I may be more of a Genwunner, but I still host a Gen VI fansite dedicated to Gen VI walkthroughs and game scripts among other things Gen VI:
http://pokemongen6.shoutwiki.com
Work-in-progress, but feel free to contribute!
Reply With Quote
  #49   Link to this post, but load the entire thread.  
Old November 4th, 2015 (7:41 AM).
Imafruitbat Imafruitbat is offline
 
Join Date: Sep 2015
Posts: 56
Since I am far from the foremost authority on hacking the disassembly, I can't really give much in the way of detailed instructions. However, based on what I've gathered over the course of this thread I can make some suggestions:

Definitely make it a point to expand your WRAM if you plan to add a lot of scripts and flags. Screwed up the first test save, but as stated above, is very much worth it.

Consider other scripts that already exist in game that are similar in some aspect to what you're aiming to do. It will give you a "template" of sorts to start from. Once you've experimented with those "templates", you can bring more specific questions here.

Here's some I would look at specifically:
The Lapras guy in Silph
Squirtle girl from Yellow
The Rival choosing a starter
Reply With Quote
  #50   Link to this post, but load the entire thread.  
Old November 4th, 2015 (4:09 PM).
Fotomac's Avatar
Fotomac Fotomac is offline
Genwunner and proud of it
 
Join Date: Aug 2015
Gender: Male
Nature: Hardy
Posts: 909
OK, I couldn't find the script with the Squirtle girl from Yellow (and by the way, she's not just any girl, she's Officer Jenny), but I was suggested a similar script from Celadon involving the Eevee Poke Ball.
__________________
I may be more of a Genwunner, but I still host a Gen VI fansite dedicated to Gen VI walkthroughs and game scripts among other things Gen VI:
http://pokemongen6.shoutwiki.com
Work-in-progress, but feel free to contribute!
Reply With Quote
Reply

Quick Reply

Join the conversation!

Create an account to post a reply in this thread, participate in other discussions, and more!

Create a PokéCommunity Account
Ad Content
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 9:24 AM.