View Single Post
  #11    
Old June 15th, 2009 (08:55 PM).
0m3GA ARS3NAL's Avatar
0m3GA ARS3NAL
Im comin' home...
Community Supporter Tier 1
 
Join Date: Jan 2008
Location: Superjail Penitentiary
Age: 22
Gender: Male
Nature: Gentle
Quote:
Originally Posted by ckret2 View Post
Oh, wow!! Thank you SO much! I was just about to post a question in the Script Help Thread about special2, and found you explained it here! I've spent a couple hours or so today decoding the special2 used in the legendary bird scripts, 0xB4.

I've also got a question about that special2, but, before I get on to that, here's what I know; maybe this is something you'd be interested in for the tutorial, I dunno. Here's, for example, the Zapdos script in full:

Spoiler:
#org 0x1637B8
special 0x187
compare 0x800D 0x2
if 0x1 goto 0x81A7AE0
special 0x188
lock
faceplayer
setwildbattle 0x91 0x32 0x0
checksound
cry 0x91 0x2
preparemsg 0x81A6448
waitmsg
waitcry
pause 0xA
playsong 0x156 0x0
waitkeypress
setflag 0x807
special 0x138
waitstate
clearflag 0x807
special2 0x800D 0xB4
compare 0x800D 0x1
if 0x1 goto 0x816381B
compare 0x800D 0x4
if 0x1 goto 0x8163824
compare 0x800D 0x5
if 0x1 goto 0x8163824
setflag 0x2BF
release
end

#org 0x1A7AE0
release
end

#org 0x16381B
setflag 0x2BF
goto 0x81A922D

#org 0x163824
setvar 0x8004 0x91
goto 0x81A9236

#org 0x1A922D
fadescreen 0x1
hidesprite 0x800F
fadescreen 0x0
release
end

#org 0x1A9236
fadescreen 0x1
hidesprite 0x800F
fadescreen 0x0
bufferpokemon 0x0 0x8004
msgbox 0x81A63C4 0x4
release
end

#org 0x1A6448
= Gyaoo!

#org 0x1A63C4
= The [buffer1] flew away!


To make things easier on myself, I took out the offsets and added normal text explanations where appropriate, so here's the "dumbed down" script:

Spoiler:
#org 0x1637B8
special 0x187
compare 0x800D 0x2
if 0x1 goto @[RELEASE-END]
special 0x188
lock
faceplayer
setwildbattle 0x91[Zapdos] 0x32[level 50] 0x0
checksound
cry 0x91[Zapdos] 0x2[???]
preparemsg @[ZAPDOScry]
waitmsg
waitcry
pause 0xA
playsong 0x156[???] 0x0
waitkeypress
setflag 0x807
special 0x138[starts wild battle]
waitstate
clearflag 0x807
special2 0x800D 0xB4
compare 0x800D 0x1
if 0x1 goto @[SETFLAG-2BF]
compare 0x800D 0x4
if 0x1 goto @[SETVAR]
compare 0x800D 0x5
if 0x1 goto @[SETVAR]
setflag 0x2BF
release
end

#org @[RELEASE-END]
release
end

#org @[SETFLAG-2BF]
setflag 0x2BF
goto @[HIDESPRITE-END]

#org @[SETVAR]
setvar 0x8004 0x91
goto @[HIDE-FLY]

#org @[HIDESPRITE-END]
fadescreen 0x1
hidesprite 0x800F
fadescreen 0x0
release
end

#org @[HIDE-FLY]
fadescreen 0x1
hidesprite 0x800F
fadescreen 0x0
bufferpokemon 0x0 0x8004
msgbox @[FLEW] 0x4
release
end

#org @[ZAPDOScry]
= Gyaoo!

#org @[FLEW]
= The [buffer1] flew away!


And even further abbreviated, condensed, randomly swuished together, and messed with until it's turned into what I think is relevant to the special2 used here:

Spoiler:
setflag 0x807
special 0x138[starts wild battle]
waitstate
clearflag 0x807
special2 0x800D 0xB4
compare 0x800D 0x1
if 0x1 goto @[SETFLAG-2BF]
compare 0x800D 0x4
if 0x1 goto @[SETVAR]
compare 0x800D 0x5
if 0x1 goto @[SETVAR]
setflag 0x2BF
release
end

#org @[SETFLAG-2BF]
setflag 0x2BF
goto @[HIDESPRITE-END]
#org @[HIDESPRITE-END]
fadescreen 0x1
hidesprite 0x800F
fadescreen 0x0
release
end

#org @[SETVAR]
setvar 0x8004 0x91
goto @[HIDE-FLY]
#org @[HIDE-FLY]
fadescreen 0x1
hidesprite 0x800F
fadescreen 0x0
bufferpokemon 0x0 0x8004
msgbox @[FLEW] 0x4
release
end
#org @[FLEW]
= The [buffer1] flew away!


Side note: Oddly enough, even though flag 0x2BF is set, that's not Zapdos's number in AdvanceMap; Zapdos's number is 5D. However, it seems that 5D is a preset flag in FireRed (like the flag that make all the non-Rocket NPCs of Saffron City hidden until you beat Giovanni, at which point the flag is cleared). There's a command in the map script to check and see if flag 0x2BF has been set; if it has, then it won't clear 5D. As long as 2BF has not been set, the map script will do clearflag 0x5D, which lets Zapdos be visible.

These are the conclusions I can draw from the above:

special2 0x800D 0xB4
compare 0x800D...
• 0x1; if true then set the flag to make the Pokémon vanish and hide the sprite
• 0x4; if true then the sprite is hidden and the Pokémon flies away, but the flag isn't set
• 0x5; if true then the same as 0x4
• if none are true, then the flag is set and that's the end.

The reason I included some of the above stuff ("setflag 0x807" through "clearflag 0x807") is because, I assume, those flags are used to check and see if you fainted while battling the Zapdos, because it's set immediately before the battle starts and yet is cleared immediately after the battle ends. This is pretty much confirmed in the map script of the Power Plant:

Spoiler:
#org 0x163764
#raw 0x5
#raw pointer 0x816376F
#raw 0x3
#raw pointer 0x816378D
#raw 0x0

#org 0x16376F
checkflag 0x807
if 0x1 call 0x8163779
end

#org 0x16378D
setworldmapflag 0x8B4
checkflag 0x2BF
if 0x0 call 0x81637AC
checkflag 0x2D0
if 0x0 call 0x81637B0
checkflag 0x2D1
if 0x0 call 0x81637B4
end

#org 0x163779
special2 0x800D 0xB4
compare 0x800D 0x7
if 0x5 goto 0x81A77A9
hidesprite 0x800F
return

#org 0x1637AC
clearflag 0x5D
return

#org 0x1637B0
clearflag 0x85
return

#org 0x1637B4
clearflag 0x86
return

#org 0x1A77A9
return


And with the relevant info extracted:

Spoiler:
checkflag 0x807
if 0x1 call @[SPECIAL2]
end

#org @[SPECIAL2]
special2 0x800D 0xB4
compare 0x800D 0x7
if 0x5 goto 0x81A77A9
hidesprite 0x800F
return


So, along with the conclusions I already had above, we can add one more:

special2 0x800D 0xB4
compare 0x800D...
• 0x1; if true then set the flag to make the Pokémon vanish and hide the sprite
• 0x4; if true then the sprite is hidden and the Pokémon flies away, but the flag isn't set (so you can rebattle the Pokémon?)
• 0x5; if true then the same as 0x4
• if none are true, then the flag is set to hide the Pokémon and that's apparently the end.
if you faint, so that flag 0x807 isn't cleared...
• 0x7; if it's 0x5 (in other words, "not exactly equal to" 0x7), then the Pokémon is apparently hidden.


Sorry for the tl;dr it took to reach that conclusion. But it never hurts to show your work.

The reason I'm throwing all this at you is because, for one thing, you're the first person so far to actually start to address what a special2 is, rather than just throw one into a tutorial in the middle of something else without talking about what it is and how it works. I'm trying to decode the script above to create another script that makes it impossible to progress unless you beat--don't catch, but beat--a Pokémon.

I've decoded as much as I can of special2 0xB4, so I thought I'd present my research to someone who probably knows more about the command than I do. :D This same special2 is used with the legendary trio, Mewtwo, Lugia, Ho-Oh, Deoxys, and Snorlax, at the very least. (And those scripts use the "setflag/clearflag 0x807" trick too, which confuses me; if 0x807 is set and that means you can't go back to battle the Pokémon you were fighting when it was set, wouldn't that mean you can't ever battle any of the other legendaries, too...?)

Any insight into how this command behaves would be useful and appreciated, and I hope I've presented some useful information and not just wasted you time with all this.
WOW, quite a lengthy post you got there, but yeah, special 2 does not really make anything in the game happen, but make a variable set to a number depending on what happens in the game... or what has already happened.
__________________
>Boot Jailbot
>Pass *****
.
.
Jailbot OS Ver 1.1.2
Greetings Warden
of Superjail Penitentiary
Awaiting user input...

>Display User_Info
╠══User Info══╣
Username:
0m3GA ARS3NAL
Age: 18
Sex: Male ♂
Race: Caucasian
Quote:
"What is this
I don't even..."

M/O: Often acts out to get attention, but recently has changed that. Has been studying up on hacking information and hopes to participate in more advanced hacking discussion.
╠══End of File══╣
Awaiting user input...

>
Reply With Quote