Go Back   The PokéCommunity Forums > ROM Hacking > ROM Hacking Hub
Reload this Page Script Help Thread (DO NOT REQUEST SCRIPTS)

Notices
For all updates, view the main page.

ROM Hacking Hub General discussions about ROM Hacking and Emulation. Not sure where to start? This is the place for you.
Posting links to ROMs is illegal and is not tolerated anywhere on the forum.
New threads in this forum are to be approved by a moderator before they are displayed.



Closed Thread
 
Thread Tools
  #6126    
Old September 15th, 2011 (05:24 AM).
metapod23's Avatar
metapod23 metapod23 is offline
Hardened Trainer
 
Join Date: Mar 2009
Gender: Male
Nature: Timid
Posts: 673
Quote originally posted by shinyabsol1:
Ok, thanks. But if I understand you correctly, special 0x188 stores the number of steps taken to variable 0x4025, and no other. So I wouldn't be able to have multiple honey trees with honey on them each counting their own steps. Every time I would activate the special, it would overwrite 0x4025 with the new value.

Or wait, does 0x188 work with the special2 command where I can specify the variable that the steps are stored in? Either way, though, I think I will still look into using the timer special.

Thanks again.
You could possibly do it counting steps by using a different variable for each tree, similar to what DavidJCobb said, and by never deacitivating the counter once it's started. The only problem with that is I don't know if it would loop back around to 0 when it reached the end.

Anyway, to try it, you would need to copy the variable in 0x4025 to your own variable (copyvar). Then add the number of steps you want the honey tree to work at (addvar) to your variable. Then use comparevar to see if 0x4025 is equal to or greater than the number in your var.

I guess you would also need a second variable though, if it does loop, to check if the step count is less than the number of steps needed (meaning that the step count has looped back around and started over at 0).

The only issues with this would be that anything within that range would not yield a positive result, so say between 0 and 500 steps there would be no Pokemon, then between 65535 and 66035 steps there would be no Pokemon, and so on. Still, being that 65,000 steps is quite a lot, it could almost do what you wanted, except that it doesn't count it in real time.

I think your only choice for that is JPAN's hacked engine. Maybe you'll have better luck than I did. You would have to do something similar with that as well, though, since there's only one timer.
__________________
  #6127    
Old September 15th, 2011 (09:18 AM).
shinyabsol1's Avatar
shinyabsol1 shinyabsol1 is offline
Pokemon DarkJasper!?
 
Join Date: Aug 2010
Gender: Male
Nature: Calm
Posts: 330
Quote originally posted by DavidJCobb:
Values are saved for variables 0x4000 and up, but not for variables 0x8000 and up. Some (such as 0x4020 or 0x4037) are used by the game engine and aren't safe, but those that the default game scripts use are safe (if you removed those scripts).

My post with the list of all flags also has a list of all vars. You can check that to see which variables were originally used for what, and decide which ones are safe based on their original uses. (Any that aren't written to directly by the game engine, and that were used in original game scripts (i.e. Daisy, Selphy, etc.), should be safe.
Thanks. This clears some things up. I'll take a look at your post.

Quote originally posted by metapod23:
You could possibly do it counting steps by using a different variable for each tree, similar to what DavidJCobb said, and by never deacitivating the counter once it's started. The only problem with that is I don't know if it would loop back around to 0 when it reached the end.

Anyway, to try it, you would need to copy the variable in 0x4025 to your own variable (copyvar). Then add the number of steps you want the honey tree to work at (addvar) to your variable. Then use comparevar to see if 0x4025 is equal to or greater than the number in your var.

I guess you would also need a second variable though, if it does loop, to check if the step count is less than the number of steps needed (meaning that the step count has looped back around and started over at 0).

The only issues with this would be that anything within that range would not yield a positive result, so say between 0 and 500 steps there would be no Pokemon, then between 65535 and 66035 steps there would be no Pokemon, and so on. Still, being that 65,000 steps is quite a lot, it could almost do what you wanted, except that it doesn't count it in real time.

I think your only choice for that is JPAN's hacked engine. Maybe you'll have better luck than I did. You would have to do something similar with that as well, though, since there's only one timer.
Hmmm...I was thinking about something along the lines of this yesterday. I'm gonna fool around with that special using the commands you mentioned to see what I get. I also have another idea (using the rtc) that might work somewhat, but it will certainly be limited in its similarity to D/P/Pt's system. Oh well, I guess something that is close is better than nothing...

As for the whole timer thing, I've pretty much given up on that. All that possible looping and pkmn center stuff has really dented my interest in it...

Thanks for all your help, both metapod23 and DavidJCobb
  #6128    
Old September 15th, 2011 (11:29 AM).
romancandle romancandle is offline
 
Join Date: Oct 2009
Gender: Male
Nature: Adamant
Posts: 72
Okay, I've encountered another problem with the Hacked Special 0xD Happiness Check:

Code:
#org 0x81C2E0
lock
faceplayer
bufferfirstpokemon 0x00
special2 0x8004 0xd
compare 0x8004 0xFF
if 0x4 goto @love
compare 0x8004 0x96
if 0x4 goto @adore
compare 0x8004 0x4B
if 0x4 goto @like
compare 0x8004 0x28
if 0x3 goto @meh
msgbox @dislike 0x6
callstd 0x6
release
end

#org @love
msgbox @love2 0x6
callstd 0x6
release
end

#org @love2
= Your \v\h02 loves you!

#org @adore
msgbox @adore2 0x6
callstd 0x6
release
end

#org @adore2
= Your \v\h02 adores you!

#org @like
msgbox @like2 0x6
callstd 0x6
release
end

#org @like2
= Your \v\h02 likes you!

#org @meh
msgbox @meh2 0x6
callstd 0x6
release
end

#org @meh2
= Your \v\h02 is indifferent to you.

#org @dislike
= Your \v\h02 doesn't like you.
I put this into the game and when I check it (I set Charmander's base Happiness to 0 and lost the rival match, run from the rest) it automatically goes to the "Adore" level, which is suppose to be 150 Happiness or better only. Do I need to call the special before EVERY check? Or is there another problem?
  #6129    
Old September 15th, 2011 (03:22 PM).
DavidJCobb DavidJCobb is offline
RESIDENT RAAAAAAAAAAAAGEMASTER
 
Join Date: Jul 2010
Gender: Male
Nature: Lonely
Posts: 275
Quote originally posted by romancandle:
Do I need to call the special before EVERY check? Or is there another problem?
Before you can check any of the Pokemon's stats, you need to decrypt the Pokemon using special 0x6.

Basically, Pokemon data is stored in a semi-encrypted form. You use special 0x6 to decrypt a given Pokemon in the party, and then use the other specials to check or modify its attributes as necessary. When you're done making changes, you run special 0x6 again to re-encrypt the Pokemon (because the changes are made to the decrypted data).
__________________
  #6130    
Old September 15th, 2011 (05:28 PM).
shinyabsol1's Avatar
shinyabsol1 shinyabsol1 is offline
Pokemon DarkJasper!?
 
Join Date: Aug 2010
Gender: Male
Nature: Calm
Posts: 330
sheesh...ever since I started all that honey tree stuff, I've had more questions than ever before...

Using the copybyte command, I want to copy a byte at a location into a variable. But the copybyte command doesn't allow for copying from pointer to variable. So:

How do I find the address of a variable (any variable that I should want)?

Thanks.
  #6131    
Old September 15th, 2011 (05:48 PM).
DavidJCobb DavidJCobb is offline
RESIDENT RAAAAAAAAAAAAGEMASTER
 
Join Date: Jul 2010
Gender: Male
Nature: Lonely
Posts: 275
Quote originally posted by shinyabsol1:
sheesh...ever since I started all that honey tree stuff, I've had more questions than ever before...

Using the copybyte command, I want to copy a byte at a location into a variable. But the copybyte command doesn't allow for copying from pointer to variable. So:

How do I find the address of a variable (any variable that I should want)?
That's a tricky task, since most variables are DMA-protected (their offsets always change).

The easiest solution would be to use one of the game's temporary variables (whose locations don't change, ever) for copybyte, and then use copyvar to transfer the value(s) to the persistent-but-protected vars.

Example:

Code:
copybyte 0x020370D0 [lower byte]
copybyte 0x020370D1 [higher byte]
copyvar 0x4000 0x800D
That copies some value into LASTRESULT (0x800D), a temporary variable whose location never changes. Copyvar then transfers that value into one of the normal variables.

Oh, and one thing to remember when copying bytes like that: for multi-byte values, the bytes are stored backwards. A value of 0x1234 is stored as "34 12".
__________________
  #6132    
Old September 15th, 2011 (05:56 PM).
romancandle romancandle is offline
 
Join Date: Oct 2009
Gender: Male
Nature: Adamant
Posts: 72
Quote originally posted by DavidJCobb:
Before you can check any of the Pokemon's stats, you need to decrypt the Pokemon using special 0x6.

Basically, Pokemon data is stored in a semi-encrypted form. You use special 0x6 to decrypt a given Pokemon in the party, and then use the other specials to check or modify its attributes as necessary. When you're done making changes, you run special 0x6 again to re-encrypt the Pokemon (because the changes are made to the decrypted data).

So, to make sure I'm a) understanding you correctly, and b) understanding how it works, I should use enter this in the beginning and before every end command:

Code:
special 0x6
Or am I wrong?
  #6133    
Old September 15th, 2011 (07:17 PM).
shinyabsol1's Avatar
shinyabsol1 shinyabsol1 is offline
Pokemon DarkJasper!?
 
Join Date: Aug 2010
Gender: Male
Nature: Calm
Posts: 330
Quote originally posted by DavidJCobb:
That's a tricky task, since most variables are DMA-protected (their offsets always change).

The easiest solution would be to use one of the game's temporary variables (whose locations don't change, ever) for copybyte, and then use copyvar to transfer the value(s) to the persistent-but-protected vars.

That copies some value into LASTRESULT (0x800D), a temporary variable whose location never changes. Copyvar then transfers that value into one of the normal variables.

Oh, and one thing to remember when copying bytes like that: for multi-byte values, the bytes are stored backwards. A value of 0x1234 is stored as "34 12".
Ok, I understand what I need to do now, but:

In the script I am working on, LASTRESULT is being used in such a way that prevents me from using it for this situation. So is there another temporary variable that is free for me to use (and if so, what is its address)?

On another subject, I just remembered another question that I have:

Is there a way to make it so that a script is constantly active? What I mean is that it is always checking (and updating) itself based on something else (for example, the rtc hour byte)?

Thanks.
  #6134    
Old September 15th, 2011 (11:19 PM).
DavidJCobb DavidJCobb is offline
RESIDENT RAAAAAAAAAAAAGEMASTER
 
Join Date: Jul 2010
Gender: Male
Nature: Lonely
Posts: 275
Quote originally posted by shinyabsol1:
Ok, I understand what I need to do now, but:

In the script I am working on, LASTRESULT is being used in such a way that prevents me from using it for this situation. So is there another temporary variable that is free for me to use (and if so, what is its address)?
For vars 0x8000 to 0x800D, this formula works (thank HackMew, not me, for it):

0x020270B6 + ([var number in hex] * 2)

Quote originally posted by shinyabsol1:
Is there a way to make it so that a script is constantly active? What I mean is that it is always checking (and updating) itself based on something else (for example, the rtc hour byte)?
Nope. Even if you could, the script would cause performance issues because scripts cannot run asynchronously (that is, in the background without interrupting other functions).

The best way to do it would be to have an efficient script run very frequently, i.e. every five or so steps.
__________________
  #6135    
Old September 16th, 2011 (05:58 AM).
metapod23's Avatar
metapod23 metapod23 is offline
Hardened Trainer
 
Join Date: Mar 2009
Gender: Male
Nature: Timid
Posts: 673
Quote originally posted by romancandle:
So, to make sure I'm a) understanding you correctly, and b) understanding how it works, I should use enter this in the beginning and before every end command:

Code:
special 0x6
Or am I wrong?
You would start with this:

Code:
setvar 0x8004 0x0
special 0x6
^ This would set the first Pokemon in your party to be decrypted. Then run the check happiness script, and make sure you end with:

Code:
special 0x6
again at the end, or your Pokemon could get turned into an egg.


Quote originally posted by shinyabsol1:
Ok, I understand what I need to do now, but:

In the script I am working on, LASTRESULT is being used in such a way that prevents me from using it for this situation. So is there another temporary variable that is free for me to use (and if so, what is its address)?

On another subject, I just remembered another question that I have:

Is there a way to make it so that a script is constantly active? What I mean is that it is always checking (and updating) itself based on something else (for example, the rtc hour byte)?

Thanks.
There is a walking script in JPAN's hacked engine that basically runs a script every time you take a step. For instance, I used it to make this event:



It's how Dodrio takes a step every time you do. It's special 0x81.
__________________
  #6136    
Old September 16th, 2011 (09:57 AM).
romancandle romancandle is offline
 
Join Date: Oct 2009
Gender: Male
Nature: Adamant
Posts: 72
Code:
#org 0x81C2E0
lock
faceplayer
bufferfirstpokemon 0x00
setvar 0x8004 0x0
special 0x6
special2 0x8004 0xd
compare 0x8004 0xFF
if 0x4 goto @love
compare 0x8004 0x96
if 0x4 goto @adore
compare 0x8004 0x4B
if 0x4 goto @like
compare 0x8004 0x28
if 0x4 goto @meh
msgbox @dislike 0x6
callstd 0x6
special 0x6
release
end

#org @love
msgbox @love2 0x6
callstd 0x6
special 0x6
release
end

#org @love2
= Your \v\h02 loves you!

#org @adore
msgbox @adore2 0x6
callstd 0x6
special 0x6
release
end

#org @adore2
= Your \v\h02 adores you!

#org @like
msgbox @like2 0x6
callstd 0x6
special 0x6
release
end

#org @like2
= Your \v\h02 likes you!

#org @meh
msgbox @meh2 0x6
callstd 0x6
special 0x6
release
end

#org @meh2
= Your \v\h02 is indifferent to you.

#org @dislike
= Your \v\h02 doesn't like you.
Okay, I ran into a huge problem with this: When the script runs, it copies the pokemon in the first slot into the second slot. I can't figure out why it's doing that and how to stop it. I assume it has something to do with the goto sections.
  #6137    
Old September 16th, 2011 (01:01 PM).
DavidJCobb DavidJCobb is offline
RESIDENT RAAAAAAAAAAAAGEMASTER
 
Join Date: Jul 2010
Gender: Male
Nature: Lonely
Posts: 275
Quote originally posted by romancandle:
Okay, I ran into a huge problem with this: When the script runs, it copies the pokemon in the first slot into the second slot. I can't figure out why it's doing that and how to stop it. I assume it has something to do with the goto sections.
Reread the documentation that came along with JPAN's engine.

Basically, special 0x6 will do the following:
  • If a Pokemon has not already been decrypted, then the Pokemon in slot 0x8004 of the party will be decrypted.
  • If a Pokemon has already been decrypted, then it will be re-encrypted and it will overwrite slot 0x8004 of the party. The decrypted copy of the data is then deleted.
You need to reset 0x8004 to point to the proper party slot before you call special 0x6 at the end of the script.
__________________
  #6138    
Old September 16th, 2011 (01:37 PM).
shinyabsol1's Avatar
shinyabsol1 shinyabsol1 is offline
Pokemon DarkJasper!?
 
Join Date: Aug 2010
Gender: Male
Nature: Calm
Posts: 330
Quote originally posted by DavidJCobb:
For vars 0x8000 to 0x800D, this formula works (thank HackMew, not me, for it):

0x020270B6 + ([var number in hex] * 2)
Thanks! I'm surprised I didn't find this formula when I searched...

Quote originally posted by DavidJCobb:
Nope. Even if you could, the script would cause performance issues because scripts cannot run asynchronously (that is, in the background without interrupting other functions).

The best way to do it would be to have an efficient script run very frequently, i.e. every five or so steps.

Oh well, I knew it would be a long shot for something like this to work, but I wanted to make sure anyways.

Quote originally posted by metapod23:
There is a walking script in JPAN's hacked engine that basically runs a script every time you take a step.
Right. This is the closest thing to a script that runs all the time. What I was hoping for was a way to make it run even when the game is turned off, which I have now been confirmed is not possible.

Quote originally posted by metapod23:
For instance, I used it to make this event:

It's how Dodrio takes a step every time you do. It's special 0x81.
Oh that's how it was done? I was just playing AshGray the other day and I completed that part. Good luck on your hack, metapod23!
  #6139    
Old September 17th, 2011 (03:38 PM).
AerisZeal's Avatar
AerisZeal AerisZeal is offline
 
Join Date: Aug 2011
Gender: Male
Posts: 1
Working on a Fire Red rom (BPRE) with a RTC and using XSE. (probably old, 1.1.1)

I've been trying to make a berry tree (as a signpost) which renews once everyday ala G/S/C style. My problem is that instead of giving one berry a day the tree gives one berry and then stops giving berries completely. Unless checked at 12am, where it gives berries nonstop until 2am, then goes back to giving no berries at all. However if it's not checked between 12am and 2am it goes on not giving berries at all.

I feel like I'm missing something very simple here but i haven't been able to spot it yet. Maybe I'm even going about it the wrong way, this is the first script I've ever written and I've been trying to wrap my head around it for a couple days now to no avail. Hopefully you guys can help with this.

Spoiler:

#dynamic 0x800000

#org @start
lock
copybyte 0x020370D0 0x03005542
compare lastresult 0x1
if B_<= call @time
msgbox @check 0x5
compare lastresult 0x1
if 0x1 goto @berry
goto @noberry
release
end

#org @time
copybyte 0x020370D0 0x03005542
compare lastresult 0x18
if B_>= goto @noberry
clearflag 0x1000
return

#org @berry
checkflag 0x1000
if 0x1 goto @noberry
random 0x11
setflag 0x1000
compare lastresult 0x0
if 0x1 goto @cheri
compare lastresult 0x1
if 0x1 goto @chesto
compare lastresult 0x2
if 0x1 goto @pecha
compare lastresult 0x3
if 0x1 goto @rawst
compare lastresult 0x4
if 0x1 goto @aspear
compare lastresult 0x5
if 0x1 goto @leppa
compare lastresult 0x6
if 0x1 goto @oran
compare lastresult 0x7
if 0x1 goto @persim
compare lastresult 0x8
if 0x1 goto @lum
compare lastresult 0x9
if 0x1 goto @sitrus
compare lastresult 0xA
if 0x1 goto @liechi
compare lastresult 0xB
if 0x1 goto @ganlon
compare lastresult 0xC
if 0x1 goto @salac
compare lastresult 0xD
if 0x1 goto @petaya
compare lastresult 0xF
if 0x1 goto @apicot
compare lastresult 0x10
if 0x1 goto @lansat
compare lastresult 0x11
if 0x1 goto @starf
end

#org @cheri
giveitem 0x85 0x3 0x0
release
end

#org @chesto
giveitem 0x86 0x3 0x0
release
end

#org @pecha
giveitem 0x87 0x3 0x0
release
end

#org @rawst
giveitem 0x88 0x3 0x0
release
end

#org @aspear
giveitem 0x89 0x3 0x0
release
end

#org @leppa
giveitem 0x8A 0x4 0x0
release
end

#org @oran
giveitem 0x8B 0x4 0x0
release
end

#org @persim
giveitem 0x8C 0x3 0x0
release
end

#org @lum
giveitem 0x8D 0x4 0x0
release
end

#org @sitrus
giveitem 0x8E 0x4 0x0
release
end

#org @liechi
giveitem 0xA8 0x2 0x0
release
end

#org @ganlon
giveitem 0xA9 0x2 0x0
release
end

#org @salac
giveitem 0xAA 0x2 0x0
release
end

#org @petaya
giveitem 0xAB 0x2 0x0
release
end

#org @apicot
giveitem 0xAC 0x2 0x0
release
end

#org @lansat
giveitem 0xAD 0x2 0x0
release
end

#org @starf
giveitem 0xAE 0x1 0x0
release
end

#org @noberry
msgbox @nothing 0x2
release
end

#org @check
= It's a fruit bearing tree! would\nyou like to check for berries?

#org @nothing
= There's nothing here[.]
  #6140    
Old September 17th, 2011 (08:18 PM).
ZxC Mirai's Avatar
ZxC Mirai ZxC Mirai is offline
Huh?
 
Join Date: Jun 2011
Location: Pampanga Philippines
Gender: Male
Nature: Timid
Posts: 267
HEY GUyzzzzzzzz! does XSE have a Command that make a EVENT looks likes a FLASHBACK?? (Eg.: Every Persons,Grass,Trees,Flowers,House & etc. are Color Gray)
__________________





POKEMON SkyWhite COMING SOON....
  #6141    
Old September 18th, 2011 (09:48 AM).
hackernoah hackernoah is offline
 
Join Date: Feb 2011
Gender: Male
Posts: 2
So I'm having trouble with this script. Whenever I step on the box, nothing happens.
Code:
#org $script
jingle
message $hey
$hey 1 = Hey ginchoob!
boxset 6
clearflag 0x1220
showsprite 1
applymovement 0xFF $walkup
$walkup 1 ; #binary 0x62 0xFE
pausemove 0
applymovement 1 $walkdown
$walkdown 1 ; #binary 0x10 0x10 0x10 0x10 0x10 0x10 0x03 0xFE
pausemove 0
message $t1
$t1 1 = Kickback gave you a Pokemon?\n HA! That was a mistake.
boxset 6
trainerbattle 0x145 0x01 $win $lose
$win 1 = How could I lose?'
$lose 1 = Told you I'd win.
message $t2
$t2 1 = Hmph! I'll beat you next time.
boxset 6
applymovement 1 $walk
$walk 1 ; #binary 0x11 0x11 0x11 0x11 0x11 0x11 0x01 0xFE
pausemove 0
removesprite 1
setflag 0x1220
setvar 0x6002 0x0001 
release
end
  #6142    
Old September 18th, 2011 (02:55 PM).
DavidJCobb DavidJCobb is offline
RESIDENT RAAAAAAAAAAAAGEMASTER
 
Join Date: Jul 2010
Gender: Male
Nature: Lonely
Posts: 275
Quote originally posted by AerisZeal:
Working on a Fire Red rom (BPRE) with a RTC and using XSE. (probably old, 1.1.1)

I've been trying to make a berry tree (as a signpost) which renews once everyday ala G/S/C style. My problem is that instead of giving one berry a day the tree gives one berry and then stops giving berries completely. Unless checked at 12am, where it gives berries nonstop until 2am, then goes back to giving no berries at all. However if it's not checked between 12am and 2am it goes on not giving berries at all.

I feel like I'm missing something very simple here but i haven't been able to spot it yet. Maybe I'm even going about it the wrong way, this is the first script I've ever written and I've been trying to wrap my head around it for a couple days now to no avail. Hopefully you guys can help with this.
I'm just guessing here, but a quick glance at your script does reveal one problem.

LASTRESULT, like all other script variables, is a two-byte number... But you're only modifying one byte. So if LASTRESULT was set to 0x1234 and the byte you are copying is 0xAA, LASTRESULT will be set to 0x12AA.

The simple solution is either to copy two bytes, or to set LASTRESULT to 0x0000 before copying the single byte.
__________________
  #6143    
Old September 19th, 2011 (01:17 AM).
Satoshi Ookami's Avatar
Satoshi Ookami Satoshi Ookami is offline
Memento Mori
Gold Tier
 
Join Date: Jul 2008
Location: Abyss of Time, Great Seal
Age: 22
Gender: Male
Nature: Calm
Posts: 13,051
Quote originally posted by UnForgiven*:
HEY GUyzzzzzzzz! does XSE have a Command that make a EVENT looks likes a FLASHBACK?? (Eg.: Every Persons,Grass,Trees,Flowers,House & etc. are Color Gray)
Well it's not a command... =)
Most of hackers do flashbacks by teleporting invisible player character into "flashback map" so just do that kind of map and "send" player there.
__________________
ROM hacking FAQ - Read before asking how to play a hack. | Previous Sign 2 | Previous Sign

Anime List | PSN Trophy List
  #6144    
Old September 19th, 2011 (04:16 PM).
Derriken Derriken is offline
 
Join Date: Jun 2011
Gender: Male
Posts: 4
Ive been searching around for a way to force an egg to hatch through an XSE script, and i came across Special 0x0C2. Now, special 0x0C2 is supposed to hatch an egg, nickname code an animation sequence all included. But whenever i go to test it (egg in hand), the script hatches an egg from my egg. Am i using the special wrong? any pointers?
  #6145    
Old September 19th, 2011 (04:34 PM).
DavidJCobb DavidJCobb is offline
RESIDENT RAAAAAAAAAAAAGEMASTER
 
Join Date: Jul 2010
Gender: Male
Nature: Lonely
Posts: 275
Quote originally posted by Derriken:
Ive been searching around for a way to force an egg to hatch through an XSE script, and i came across Special 0x0C2. Now, special 0x0C2 is supposed to hatch an egg, nickname code an animation sequence all included. But whenever i go to test it (egg in hand), the script hatches an egg from my egg. Am i using the special wrong? any pointers?
How did you receive the egg? "Giveegg", your own script using special B8, or the daycare script?

If you wrote your own script, I think you have to call special B9 after you call special B8.

Have you tried placing a waitstate command after special 0xC2? The game's own egg-hatching script (at 0x1BF546) does this.
__________________
  #6146    
Old September 21st, 2011 (12:39 PM).
metapod23's Avatar
metapod23 metapod23 is offline
Hardened Trainer
 
Join Date: Mar 2009
Gender: Male
Nature: Timid
Posts: 673
Quote originally posted by Derriken:
Ive been searching around for a way to force an egg to hatch through an XSE script, and i came across Special 0x0C2. Now, special 0x0C2 is supposed to hatch an egg, nickname code an animation sequence all included. But whenever i go to test it (egg in hand), the script hatches an egg from my egg. Am i using the special wrong? any pointers?
I have done this in my hack. First, you need to set variable 0x8004 to the slot # of the egg. The only problem with this is that the player may have moved the egg to any slot in his party, unless the give egg event and the hatch egg event are all part of the same script (unlikely, though).

So here's how I did it, assuming you're using Fire Red. You will need to use JPAN's hacked engine. You will need to use the decrypt special 0x6 and then special 0x18. Special 0x18 will get the species # of the egg. Then you can have the script continue if the species # matches the Pokemon you gave as an egg to the player.

Next use special 0x147. This will check to see if the Pokemon is an egg. It will store 0x19c in lastresult if it is, so you then compare lastresult 0x19c and if it's equal, you then proceed to use special 0xc2.

Here's a sample of the script I used, in spoilers:

Spoiler:
#org @start
setvar 0x8004 0x0
special 0x6
special2 LASTRESULT 0x18
compare LASTRESULT 0xAF
if 0x1 goto @checkegg
special 0x6
setvar 0x8004 0x1
special 0x6
special2 LASTRESULT 0x18
compare LASTRESULT 0xAF
if 0x1 goto @checkegg
special 0x6
setvar 0x8004 0x2
special 0x6
special2 LASTRESULT 0x18
compare LASTRESULT 0xAF
if 0x1 goto @checkegg
special 0x6
setvar 0x8004 0x3
special 0x6
special2 LASTRESULT 0x18
compare LASTRESULT 0xAF
if 0x1 goto @checkegg
special 0x6
setvar 0x8004 0x4
special 0x6
special2 LASTRESULT 0x18
compare LASTRESULT 0xAF
if 0x1 goto @checkegg
special 0x6
setvar 0x8004 0x5
special 0x6
special2 LASTRESULT 0x18
compare LASTRESULT 0xAF
if 0x1 goto @checkegg
special 0x6
release
end

#org @checkegg
special 0x6
special2 LASTRESULT 0x147
compare LASTRESULT 0x19C
if 0x5 goto @notegg
special 0xC2
end


I'm not sure it's the most efficient way to use the special, but it's the best way I could figure out.
__________________
  #6147    
Old September 21st, 2011 (05:33 PM).
romancandle romancandle is offline
 
Join Date: Oct 2009
Gender: Male
Nature: Adamant
Posts: 72
Okay, so I'm having (yet another) problem with the fantastic IV Checker hacked engine special.

Code:
#org @start
lock
faceplayer
bufferfirstpokemon 0x00
setvar 0x8004 0x0
special 0x6
setvar 0x8004 0x2
special2 0x8004 0x8
compare 0x8004 0x1E
if 0x4 goto @best
compare 0x8004 0x18
if 0x4 goto @above
compare 0x8004 0x5
if 0x4 goto @average
compare 0x8004 0x8
if 0x4 goto @below
msgbox @pathetic 0x6
callstd 0x6
setvar 0x8004 0x0
special 0x6
release
end
If the pokemon bypasses all the checks (Aka, has a 0-7 defense IV), the text box pops up, has a bunch of random symbols after the text, then ends itself. My Beta Tester said no noticable changes occurred: His Mankey is still a Mankey, not an egg, and none of his other people got replaced by a copy of the mankey (which was a problem I had earlier). Since this defense script is the base of all the other IV check scripts for myself, I'm trying to figure out what went wrong. I assume it's after "msgbox @pathetic 0x6".

Before I gave out the Beta, I tested this specific script and found two things:
1) I had put 0x5 instead of 0xF
2) The branches worked perfectly. I tried maybe 25 times and could never get a pokemon with such a crap defense IV, but the other offshoots (30+, 25+, 15+--I think. I'm too lazy to decode the hex) never had that problem. It's only the all-checks failed branch. I'm thinking it's because I used the same variable for special 6 and special 8, but I'm not confident to rely on occum's razor.
  #6148    
Old September 23rd, 2011 (04:24 PM).
treeckopa treeckopa is offline
 
Join Date: Dec 2008
Location: Hong Kong
Gender:
Posts: 18
1. In XSE, what is the differences among pokemart, pokemart2 and pokemart3?
2. I want to make a shop which sells the decoration for secret bas only, but I can only find the list of items in the XSE script tutorial, not the decoration list. Where can I find the list of decoration?
  #6149    
Old September 23rd, 2011 (05:19 PM).
DavidJCobb DavidJCobb is offline
RESIDENT RAAAAAAAAAAAAGEMASTER
 
Join Date: Jul 2010
Gender: Male
Nature: Lonely
Posts: 275
Quote originally posted by treeckopa:
In XSE, what is the differences among pokemart, pokemart2 and pokemart3?
No one seems to know. I may take a look at it in FireRed later.


Quote originally posted by treeckopa:
I want to make a shop which sells the decoration for secret bas only, but I can only find the list of items in the XSE script tutorial, not the decoration list. Where can I find the list of decoration?
To the best of my understanding, the standard "pokemart" commands are not compatible with Secret Base decorations. I think you'd have to script up something else, like a multichoice. I'm really not sure, though.
__________________
  #6150    
Old September 24th, 2011 (03:11 AM).
treeckopa treeckopa is offline
 
Join Date: Dec 2008
Location: Hong Kong
Gender:
Posts: 18
I notice that pokemart3 is used for decoration, but I can't find the list of decoration and so can't work on them.
Still I can't figure out what pokemart2 does...
Closed Thread
Quick Reply

Sponsored Links
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 UTC -8. The time now is 11:51 AM.