Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#1 2013-11-24 17:57:29

Laugh
New member
From: Canada
Registered: 2013-11-24
Post 1/9

Adding Stationary Encounters in Crystal

How would I go about adding stationary Pokemon encounters (legendary bird trio, Mewtwo, and Mew) in Crystal? I'm relatively new to ROM hacking, though I'm somewhat familiar with G2Map and hex editing, which I believe would be useful in this case. I don't know much about scripting, but I'm willing to learn.

Also, how can I enable the Celebi event?

Offline

#2 2013-11-24 18:46:52

RaltVus
Member
From: Twinleaf Town (Sinnoh)
Registered: 2013-06-28
Post 403/548
Website

Re: Adding Stationary Encounters in Crystal

Hello, and Welcome to Skeetendo, i'm too an young hacker, do you already try lookin' the script of the Ho-oh and Lugia?
Hope it can help you.


RaltVus is back.

I'm not hacking in the moment, but i always had ideas to give. Just ask me if you want.

MY FACEBOOK

Offline

#3 2013-11-24 19:09:11

Miksy91
Member
Registered: 2010-10-16
Post 1,982/2,317

Re: Adding Stationary Encounters in Crystal

Like RaltVus said, take a look at how Lugia and Ho-Oh events are scripted. It's pretty easy and you can do the stuff by writing a few bytes of data. Beside that, you should also know the basics behind repointing data (look for a pointer tutorial).

If you feel like you want to know more about this in general, check these tutorials by Mateo:
http://hax.iimarck.us/topic/9/
http://hax.iimarck.us/topic/18/

If you are okay with replacing an existing people event with this stationary pokemon event, you won't need to add new ones though.

Offline

#4 2013-11-24 19:15:30

comet
Member
Registered: 2012-04-09
Post 320/679

Re: Adding Stationary Encounters in Crystal

ho-oh: https://github.com/kanzure/pokecrystal/ … erRoof.asm
lugia: https://github.com/kanzure/pokecrystal/ … hamber.asm


to start the celebi event you need to give the gs ball to kurt. to be able to do that you need to set the relevant event flag:

https://github.com/kanzure/pokecrystal/ … se.asm#L94

UnknownScript_0x18e1cc: ; 0x18e1cc
        ...
        checkevent EVENT_CAN_GIVE_GS_BALL_TO_KURT
        iftrue UnknownScript_0x18e34e
        ...
UnknownScript_0x18e34e: ; 0x18e34e
        checkevent $00bf
        iftrue UnknownScript_0x18e368
        checkitem GS_BALL
        iffalse UnknownScript_0x18e202
        2writetext UnknownText_0x18e8ab
        closetext
        loadmovesprites
        setevent $00bf
        takeitem GS_BALL, 1
        setflag $0050
        end
; 0x18e368

Offline

#5 2013-11-24 20:05:53

Laugh
New member
From: Canada
Registered: 2013-11-24
Post 2/9

Re: Adding Stationary Encounters in Crystal

Thanks for the quick replies, guys - I'll read those scripting tutorials. What are the differences between scripting/map editing programs for GS and Crystal? Also, can anyone link me to a good pointer tutorial for Crystal?

Offline

#6 2013-11-24 22:17:42

Miksy91
Member
Registered: 2010-10-16
Post 1,983/2,317

Re: Adding Stationary Encounters in Crystal

I haven't used G2Map so I'm not sure how much Johtomap is more developed than it is. But you ought to get everything done nicely with it.
Pointers are programming related things, not something that is related to a specific game. To put it simply, pointer tells the game where to look for certain data as it points to it.

Gameboy pointers are 16 bits, or 2 bytes long, both of them mean the exactly same thing. Search for a tutorial in this forum or through Google - there are plenty of Gameboy pointer tutorials around.

Offline

#7 2013-11-24 22:53:55

Laugh
New member
From: Canada
Registered: 2013-11-24
Post 3/9

Re: Adding Stationary Encounters in Crystal

I'm using CrystalMap now, actually (finally found an English version of it). And okay, I will.

Offline

#8 2013-11-24 23:21:29

RaltVus
Member
From: Twinleaf Town (Sinnoh)
Registered: 2013-06-28
Post 405/548
Website

Re: Adding Stationary Encounters in Crystal

I'm happy that i could give you an idea of what make.


RaltVus is back.

I'm not hacking in the moment, but i always had ideas to give. Just ask me if you want.

MY FACEBOOK

Offline

#9 2013-11-30 03:48:42

Laugh
New member
From: Canada
Registered: 2013-11-24
Post 6/9

Re: Adding Stationary Encounters in Crystal

Okay, after looking around for a while, I've been having a lot of trouble finding the information I need about scripting and repointing. So, I have a request: could someone please tell me, step by step, how I would add (for example) a Moltres encounter in Victory Road? Even if terms are used that I'm not familiar with, I'm sure I'd easily be able to find out what they mean as long as I'm told what program to use (if it isn't obvious). My map editor of choice would be CrystalMap, by the way.

But yeah, with instructions on how to add one stationary encounter, adding the rest should be simple.

Last edited by Laugh (2013-11-30 20:20:25)

Offline

#10 2013-11-30 11:36:10

Crystal_
Member
From: Spain
Registered: 2012-09-16
Post 142/435
Website

Re: Adding Stationary Encounters in Crystal

1. Look at the second map headers in the disassembly of Pokemon Crystal and find the entry for Victory Road.

2. Open your Pokemon Crystal ROM in a hex editor and head to the address where the Victory Road second map header is located

3. Write down the map event two-byte pointer as well the bank.

4. Head to the bank you wrote down in a hex editor and scroll down until you find blank space (all 00's until the end of the bank).

5. Choose what would be the starting offset where you'd repoint the map event header. Ideally it'd be the first byte where there is space, but if you are not too familiar with pointers and repointing a 'round' number (e.g finished in 00 like 0x77600) makes things easier.

6. Edit the map event pointer in the second map header of victory road to point to the offset you chose.

7. Open VictoryRoad.asm in the disassembly of Pokemon Crystal (in folder maps) and copy all the data that belongs to the map event header with your hex editor (warps, signposts, and person events)

8. Paste it in the offset you repointed the map event header to. If you are using CrystalMap, I recommend that you open the INI editor, and edit the event data of Victory Road and edit the offsets referring to, at least, person events. Also, increase the amount of person events by one in the INI editor, since you are going to add another person event.

9. In the hex editor, increase the byte that determines the amount of person events by 1, so that you let the game know you are going to add one more person event.

10. After the last existing person event, you'll have to add the person event definition for the static pokemon in question.
Structure is:
[Picture][Y from top+4][X from left+4][0-4 for regular, 6-9 for static facing][Movement][Clock-/Time setting (2byte)][Color|Function][Range of sight for trainers][2byte pointer to script][Bit no. of BitTable1 (Hidden if set)(FFFF for none)(2byte)]

I suggest you use the Lugia/Ho-oh event as a reference, search it, and copy and paste it. If you do so, what you would need to modify is:

[Picture]
[X coor.][Y coor.] (You can use crystalmap to do this)
[Facing would most likely be 6, depending on where you want Moltres to look to)]
[Color|Function] Just the color of the sprite. It's the first nibble.
[Scriptpointer] Make it point to Moltres' script
[Flag] (Should be a flag that you set after returning from battle against Moltres)

The script pointer should point to the script itself. You can make the script right after the end of the moltres event definition, unless you want to keep a few more space for possible future additional events. For the script as Comet and Miksy said, I suggest you use another legendary static event as a reference.

Good luck!

Last edited by Crystal_ (2013-11-30 11:37:49)

Offline

#11 2013-11-30 21:10:43

Laugh
New member
From: Canada
Registered: 2013-11-24
Post 8/9

Re: Adding Stationary Encounters in Crystal

Thanks. An early question, though...in step 3, where do I find the bank?

Offline

#12 2013-11-30 21:29:37

Crystal_
Member
From: Spain
Registered: 2012-09-16
Post 144/435
Website

Re: Adding Stationary Encounters in Crystal

VictoryRoad_SecondMapHeader: ; 0x95ca8
    ; border block
    db $1d

    ; height, width
    db VICTORY_ROAD_HEIGHT, VICTORY_ROAD_WIDTH

    ; blockdata (bank-then-pointer)
    dbw BANK(VictoryRoad_BlockData), VictoryRoad_BlockData

    ; script header (bank-then-pointer)
    dbw [b]BANK(VictoryRoad_MapScriptHeader)[/b], VictoryRoad_MapScriptHeader

    ; map event header (bank-then-pointer)
    dw VictoryRoad_MapEventHeader

    ; connections
    db 0
; 0x95cb4

In bold above. The same bank is used for the script header and the event header. If I'm not mistaken it should be at offset 0x95cae

Offline

#13 2013-11-30 22:45:27

Laugh
New member
From: Canada
Registered: 2013-11-24
Post 9/9

Re: Adding Stationary Encounters in Crystal

Oh, lol. That's what I originally figured, actually. I thought I was mistaken, because I didn't see a ton of 00s. In this case, is the only blank space at the end of the bank the 00s at 0x95cb3 and 0x95cb4?

Offline

#14 2013-11-30 23:01:46

Crystal_
Member
From: Spain
Registered: 2012-09-16
Post 145/435
Website

Re: Adding Stationary Encounters in Crystal

It looks like you don't know very well what a bank is :)

A bank is a group of 0x4000 bytes. What you have there in the second map headers is just the bank number where the scripts and the events of Victory Road are located. Since the byte at 0x95cae is the bank number, and it is a 0x1D, the scripts and events of Victory Road are located somewhere between 0x4000 * 0x1D and 0x4000 * 0x1D + 0x3FFF. That is, between 0x74000 and 0x77FFF, or in other words, somewhere in the bank starting at 0x74000.

If you follow the script pointer it will head you to the script header of the Victory Road, and if you follow the event pointer, it will head to to the event header of Victory Road. Since the script pointer is 0x86 0x44 and the bank is 0x74000-0x77FFF, then the script header is at 0x74486. Similarly, the event pointer is 0x02 0x48, so the event data of Victory Road starts at 0x74802.

So you'd have to find blank space between 0x74000 and 0x77FFF. Head to around 0x77000 with a hex editor and scroll down until you find all 00's. 0x77282 should be what you get, but if you are starting out, using 0x77300 could make things easier for repointing and stuff. Unless you somehow feel you'd have space problems in the future, but there's a whole lot of space in that bank anyway. I did have space issues myself in bank 0x27 but otherwise nothing else despite adding additional text, events and scripts.

Anyway the thing is, when you've decided which is the offset you'd repoint the events to, change the event pointer in the second map header (e.g for 0x77300, pointer is 0x00 0x73, then copy all the event data of the map and paste it in the address you repointed the header to. Then you'll have space to add your new person event and its script.

Offline

Board footer

Powered by FluxBB