Skeetendo

’Cause all games were better on the GBC

You are not logged in.

  • Index
  • → Help/Question
  • → Trying to setting up a legendary encounter when game freezes

#1 2012-10-03 21:35:57

Zarator
Member
Registered: 2012-09-30
Post 3/47

Trying to setting up a legendary encounter when game freezes

Hello everyone, after finally fixing my PKSV problems I was trying to introduce an legendary encounter in my hack. Since I had trouble adding events even after reading the tutorial on this site, I limited myself to modifying an existing one. So, I went on the 5th map of Ice Path (the one where you can find Nevermeltice) and, after extending the map a bit towards south with goldmap (this part went nicely, already tested), I changed the Rock Smashable rock into Articuno's event.

The original script looked like this:

#org 0x11A32B
'-----------------------------------
jumpstd 0xF


After changing the sprite of the event from a rock to a bird, I replaced the above script with the following one:

#org 0x123000
'-----------------------------------
faceplayer
loadfont
2writetext 0x7020 ' 0x123020
cry 0x90
writecode 0x3 0xA
loadpokedata 0x90 0x32
startbattle
disappear 0x2
returnafterbattle
loadmovesprites
end


#org 0x123020
= GYAOO!\e

I previously checked with Translhextion if the offsets were free, and they were. I compiled the event and checked with Trans. again. The offsets were correctly written with the right scripts. At this point, I repointed the event to 0x123000 (script F000 on Johtomap) and called it a day. Well, guess what? It crashed, naturally.

I tried to look through some in-game examples but, sadly, there are no simple events in Gold Silver like, say, Mewtwo or Zapdos in RBY. All the existing events I checked (Ho-Oh, Lugia, Lapras, etc) had several other checks and codes I probably didn't need. Or maybe I do? For example, the setbit1 and setbit2 scripts these events have... do I need them for my event as well?
What really bugs me is that, when I tried this thing with a fat guy in New Bark Town like miksy91's scripting guide suggested it totally worked.

Anyone knows what did I do wrong this time? Thanks in advance

Offline

#2 2012-10-03 21:47:38

comet
Member
Registered: 2012-04-09
Post 17/672

Re: Trying to setting up a legendary encounter when game freezes

Your new script is in a different bank. You can either replace the jumpstd 0xf with a 3jump to the right address or use the free space at $11a360 instead. 2-byte pointers can only be between $4000-$7fff because they're really just RAM addresses. The RAM at $F000 isn't addressable in this way.

Otherwise it looks right.

Offline

#3 2012-10-03 23:15:26

Zarator
Member
Registered: 2012-09-30
Post 4/47

Re: Trying to setting up a legendary encounter when game freezes

Ok, so, I followed your advice of moving the code to the same bank. Now it looks like this:

#org 0x11A360
'-----------------------------------
faceplayer
loadfont
2writetext 0x6380
closetext
cry 0x90
writecode 0x3 0xA
loadpokedata 0x90 0x32
startbattle
disappear 0x2
returnafterbattle
loadmovesprites
end


#org 0x11A380
= GYAOO!\e


However it still crashes... or well, it does, but with a different noise. I dunno if it makes sense <.< My guts would say that, while this fix was correct, there could be some other kind of error, perhaps within the script. However, I swear I followed Miksy91's template (the one he uses in his guide) as closely as I could. Here it is, for reference.

http://img23.imageshack.us/img23/8650/73061894.png

The only difference is that I inverted returnafterbattle and disappear. I did so because both Lugia's and Ho-Oh's scripts in-game are like that, so I thought I would end up emulating them look-wise. But I doubt it's this modification that crashes the game. Perhaps something is missing?

EDIT: Just as a note, I did check with Translhextion if everything was clear before moving the script and it seemed so. I also repointed the script accordingly on Johtomap and cleared the previous offset (123000 and 123020) with Translhextion.

Last edited by Zarator (2012-10-03 23:16:41)

Offline

#4 2012-10-03 23:29:49

y0r124
Member
From: Anywhere.
Registered: 2012-09-12
Post 64/331
Website

Re: Trying to setting up a legendary encounter when game freezes

I think you should make script like this with some kind of Hex editor And search the script around in this forum


my FB

Lurking somewhere here...

Offline

#5 2012-10-04 00:11:34

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 1,619/3,465

Re: Trying to setting up a legendary encounter when game freezes

Taken from the Christmas Hack, my articuno script:

#org 0x11A3CB
'-----------------------------------
loadfont
2writetext 0x636E ' 0x11A36E
closetext
loadmovesprites
setbit1 0x68A
writecode 0x3 0x5 ' Normal fight
loadpokedata 0x90 0x28
startbattle
returnafterbattle
loadfont
verbosegiveitem POMEGBERRY 1
disappear 0x2
end


#org 0x11A36E
= ARTICUNO: Shaoo!\e


Looking back, I see that I forgot to add in the loadmovesprites at the end, which is another bug I need to fix. But I know that this code works, and it looks very similar to yours. It looks like you used "writecode 0x3 0xA" where I used "writecode 0x3 0x5", but if the event is crashing before it ever gets that far, I would double check your pointer. When you tell Johtomap to decompile the script, does it do it properly, or are you manually loading the script? If the event is crashing as soon as you talk to it without running anything, this makes me think that either:
1) Your pointer is backwards (ie 40 00 instead of 00 40), or
2) You have the wrong value set for the "Type" of event. In mine, they are set to 00 for a normal event, while 01 and 02 would make it look for an itemball or trainer script, which are of course formatted differently.

If it is not either of these things, I'm not quite sure what it would be.

Also, on the disappear 0x2, that will make the event that Goldmap calls "Person 1" disappear. Is that the person number of your rock as well, or is that just copied from the Lugia event? If it is not person 1, you will need to update this accordingly to make it hide the right person. You also need to give the person a bitno. so it will stay hidden. I have mine manually set the bit, although according to Miksy91, just hiding an event with the disappear command will automatically set its bitno. if it has one in its event data. (Goldmap does not properly support viewing or editing bitno. values).

EDIT: Just to help you check the pointer-

Using Pointerberechner on your offset gives me a pointer of 40 6063.
In Johtomap, this would be written as 6360 instead of 6063.
In Goldmap, these would be entered as 96 99, because Goldmap is stupid and uses decimal.

Last edited by Mateo (2012-10-04 00:19:32)

Offline

#6 2012-10-04 04:50:42

Miksy91
Member
Registered: 2010-10-16
Post 1,134/2,306

Re: Trying to setting up a legendary encounter when game freezes

For reference:

Load type of fight: [1E][03][Type of fight*]

* 09 for "A wild PKMNNAME appears."; Withdraw possible
* 08 for "PKMNNAME falls from tree."
* 07 for a shiny PKMN
* 06 for win without actual fight
* 05 for fight with possible withdraw
* 04 for "The caught PKMNNAME attacks." (Rod)
* 03 for fight with DUDE’s back pic
* 02 for fight with HIRO’s back pic
* 01 for fight with possible withdraw 
* 00 for fight with possible withdraw

No such battle type as 0xA does even exist. I was using 0x7 in that tutorial to get the encountered pokemon to be shiny but if you don't want the battle to involve anything special, you should remove the whole command "writecode 0x3 0xA" from the script.

Last edited by Miksy91 (2012-10-04 04:50:58)

Offline

#7 2012-10-04 09:09:05

Zarator
Member
Registered: 2012-09-30
Post 5/47

Re: Trying to setting up a legendary encounter when game freezes

First of all, thanks you all for the posts you've helped me a lot! Anyway, it appears the cause of the crash was the type of battle - which is strange, since I took 0xA from Ho-Oh's script, I wonder what it actually meant... Anyway. Now the event works, including the disappear (which I set to 0x3 to make it work). However, Articuno flees sometimes, which is very unpleasant. How can I fix this? I had similar problems with using the wild editor as well - among other mons, I put Grimer in Route 34 but it tends to flee (none of the other mons I added does this), and I dunno why.

EDIT: For the record, my script looks like this now:

#org 0x11A360
'-----------------------------------
faceplayer
loadfont
2writetext 0x6380 ' 0x11A380
cry 0x90
closetext
loadmovesprites
writecode 0x3 0x5 ' Normal fight
loadpokedata 0x90 0x32
startbattle
disappear 0x3
returnafterbattle
end


#org 0x11A380
= GYAOO!\e

EDIT2: As a side note, is it possible to change the music of this encounter? It's not important but I may need this info sooner or later^^

Last edited by Zarator (2012-10-04 09:18:26)

Offline

#8 2012-10-04 09:29:48

comet
Member
Registered: 2012-04-09
Post 18/672

Re: Trying to setting up a legendary encounter when game freezes

IIMarckus wrote:

So there are three lists. Probably they are in order of increasing likelihood to flee, with anything in the third list fleeing instantly.

0x3C551 (Gold), 0x3C59A (Crystal):

  • Magnemite

  • Grimer

  • Tangela

  • Mr. Mime

  • Eevee

  • Porygon

  • Dratini

  • Dragonair

  • Togetic

  • Umbreon

  • Unown

  • Snubbull

  • Heracross

0x3C55F (Gold), 0x3C5A8 (Crystal):

  • Cubone

  • Articuno

  • Zapdos

  • Moltres

  • Quagsire

  • Delibird

  • Phanpy

  • Teddiursa

0x3C568 (Gold), 0x3C5B1 (Crystal):

  • Raikou

  • Entei

  • Suicune (not in Crystal)

op

Offline

#9 2012-10-04 10:12:02

Zarator
Member
Registered: 2012-09-30
Post 6/47

Re: Trying to setting up a legendary encounter when game freezes

Thanks, now it works properly!!

Offline

#10 2012-10-04 14:04:16

525/700

Re: Trying to setting up a legendary encounter when game freezes

Miksy91 wrote:

No such battle type as 0xA does even exist.

Battle type 0xA does exist. It’s used in the Ho‐oh, Lugia, and Snorlax battles. I don’t know how its behavior differs from other battle types.

  • Index
  • → Help/Question
  • → Trying to setting up a legendary encounter when game freezes

Board footer

Powered by FluxBB