The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > ROM Hacking > ROM Hacking Hub
Sign Up Rules/FAQ Live Battle Blogs Mark Forums Read

Notices

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.


Advertise here

Closed Thread
Click here to go to the first staff post in this thread.  
Thread Tools
  #6101    
Old September 9th, 2011, 10:14 PM
colcolstyles's Avatar
colcolstyles
Yours truly
 
Join Date: May 2008
Location: The Bay Area
Gender: Male
Nature: Lonely

Advertise here
If you're trying to reset the trainers, shouldn't you be using "cleartrainerflag" instead?
__________________

Brother of Vrai
  #6102    
Old September 9th, 2011, 10:50 PM
1-Up's Avatar
1-Up
Beginning Trainer
 
Join Date: May 2009
Really? The tutorial I read said that settrainerflag was it.. Ok, I'll try that, thanks. I'll edit this post if it works.

EDIT:, ok, still didn't work.. Not sure what to do.. Anyone have an example that they know works?

Also, I noticed that A-Trainer already converts them into hex, and the "cleartrainerflag" and the "settrainerflag" don't work.. Maybe I'm missing stuff?

new compiled script:

'---------------
#org 0x751695
cleartrainerflag 0x66
cleartrainerflag 0x67
cleartrainerflag 0x68
cleartrainerflag 0x213
cleartrainerflag 0x214
end

Last edited by 1-Up; September 9th, 2011 at 11:23 PM.
  #6103    
Old September 9th, 2011, 11:28 PM
colcolstyles's Avatar
colcolstyles
Yours truly
 
Join Date: May 2008
Location: The Bay Area
Gender: Male
Nature: Lonely
Sorry, I got confused. "settrainerflag" will make a trainer battle-able again. I just tested it in Emerald and it worked fine. The problem either lies with the numbers or the configuration of the trigger script itself. For the numbers, just copy over the values in the "trainerbattle" command that you get when you decompile the person events' scripts. As for the trigger script, throw in a "msgbox" command to test if the script is activating properly.
__________________

Brother of Vrai
  #6104    
Old September 9th, 2011, 11:59 PM
1-Up's Avatar
1-Up
Beginning Trainer
 
Join Date: May 2009
Awesome idea, thank you. I tested it with this new code (compiled):

Spoiler:


'---------------
#org 0x7516A8
lock
msgbox 0x87516C3 MSG_NORMAL '"Time has passed.."
settrainerflag 0x66
settrainerflag 0x67
settrainerflag 0x68
settrainerflag 0x213
settrainerflag 0x214
release
end



'---------
' Strings
'---------
#org 0x7516C3
= Time has passed..


I got no message.. So I guess its not reading.. I think it has something to do with the way I'm placin it as a script tile maybe..

Here are the settings for the script tile on A-map:
x/y pos (thats fine..)
Talking level: always. (maybe "height 2,normal?)
unknown: $03 (only 2 digits available, if it makes a difference.. saw it listed as $0003 in the tutorial I read, but I think the version of A-map I have is up to date.)
Var Number: $4050
Var value: $0000
unkown: $0000
Offset: (its correct..)

Also, JPANs Fire Red Hacked tools have been applied, but I didn't wipe the rom to start from scratch, just added some extra specials and such. (if that makes a difference.. probably not tho.)
  #6105    
Old September 10th, 2011, 12:21 AM
Truality
Left for good
 
Join Date: Aug 2011
Gender: Male
Send a message via Windows Live Messenger to Truality Send a message via Skype™ to Truality
Quote:
Originally Posted by 1-Up View Post
Awesome idea, thank you. I tested it with this new code (compiled):

Spoiler:


'---------------
#org 0x7516A8
lock
msgbox 0x87516C3 MSG_NORMAL '"Time has passed.."
settrainerflag 0x66
settrainerflag 0x67
settrainerflag 0x68
settrainerflag 0x213
settrainerflag 0x214
release
end



'---------
' Strings
'---------
#org 0x7516C3
= Time has passed..


I got no message.. So I guess its not reading.. I think it has something to do with the way I'm placin it as a script tile maybe..

Here are the settings for the script tile on A-map:
x/y pos (thats fine..)
Talking level: always. (maybe "height 2,normal?)
unknown: $03 (only 2 digits available, if it makes a difference.. saw it listed as $0003 in the tutorial I read, but I think the version of A-map I have is up to date.)
Var Number: $4050
Var value: $0000
unkown: $0000
Offset: (its correct..)

Also, JPANs Fire Red Hacked tools have been applied, but I didn't wipe the rom to start from scratch, just added some extra specials and such. (if that makes a difference.. probably not tho.)
Iirc you've put in the wrong 'unknown'. You see, there's another value as 'unknown' next to the 'var value'. That's the one you need to change. Also, a reminder: variables in tile scripts exist in a similar way to flags: you set the variables to 0x1 to activate them, and to 0x1 to deactivate them. (So either way if you don't want this script to repeat itself every time you step on it, add 'setvar 0x4050 0x1' before the 'release' in your script)
__________________
This is my December . . .
  #6106    
Old September 10th, 2011, 12:32 AM
1-Up's Avatar
1-Up
Beginning Trainer
 
Join Date: May 2009
Ok, so that "unkown 0003" needs to be in the second unkown, not the first?

Well, I tried that and didn't work either..

its A-map version 1.95, if that helps.. Hmmm....

PS: I want it to repeat, thats fine.
  #6107    
Old September 10th, 2011, 12:36 AM
DavidJCobb
RESIDENT RAAAAAAAAAAAAGEMASTER
 
Join Date: Jul 2010
Gender: Male
Nature: Lonely
Quote:
Originally Posted by 1-Up View Post
Ok, so that "unkown 0003" needs to be in the second unkown, not the first?

Well, I tried that and didn't work either..

its A-map version 1.95, if that helps.. Hmmm....

PS: I want it to repeat, thats fine.
I think I may know what your problem is.

Do you see the "var value" field? The variable you chose has to be equal to that value for the script to run. So if you use variable 0x4050, value 0x0000, then the script tile will only activate if you step on it while variable 0x4050 has the value 0x0000.

So if something -- anything at all -- has assigned a different value to that variable, your script won't run.
__________________
  #6108    
Old September 10th, 2011, 03:55 AM
1-Up's Avatar
1-Up
Beginning Trainer
 
Join Date: May 2009
Quote:
Originally Posted by DavidJCobb View Post
I think I may know what your problem is.

Do you see the "var value" field? The variable you chose has to be equal to that value for the script to run. So if you use variable 0x4050, value 0x0000, then the script tile will only activate if you step on it while variable 0x4050 has the value 0x0000.

So if something -- anything at all -- has assigned a different value to that variable, your script won't run.
Ok, I think I get ya.. But what might I want to do to change it? I'm still in tutorial mode right now, lol, so according to what I've looked up, the var number I use for script tiles is 4050 I guess, or does that even matter, I pick a new one like, say, a new flag or offset?

Hmm.. I've been getting by for a while now by myself, kinda sucks I got stuck on this as it seemed to be an easy script to write. (compared to a "shiny rock", that generates random selected shiny pokemon. this rock is hidden and meant to be seeked out for "new, special" pokemon not normally available..) Maybe a new approach? I bet if I assigned the script to a sign or a person it would work, but I was hoping for a way to reset them on entrance instead.

EDIT: Oh wait, you mean like, make the Var value 0x0001 maybe so it continues? (like, "yes", do something?) or is it checking for a value that doesn't exist? I think I get that with a value of 0 nothing would happen.. Maybe with 0x0001 it will trigger only once, then end? I'm not sure what could be in that variable if its used, I haven't used it myself so I suppose its been used already? I'm not sure, I'm still kinda noob.. At least with variables.

Last edited by 1-Up; September 10th, 2011 at 04:04 AM.
  #6109    
Old September 10th, 2011, 04:14 AM
Truality
Left for good
 
Join Date: Aug 2011
Gender: Male
Send a message via Windows Live Messenger to Truality Send a message via Skype™ to Truality
Quote:
Originally Posted by 1-Up View Post
Ok, I think I get ya.. But what might I want to do to change it? I'm still in tutorial mode right now, lol, so according to what I've looked up, the var number I use for script tiles is 4050 I guess, or does that even matter, I pick a new one like, say, a new flag or offset?

Hmm.. I've been getting by for a while now by myself, kinda sucks I got stuck on this as it seemed to be an easy script to write. (compared to a "shiny rock", that generates random selected shiny pokemon. this rock is hidden and meant to be seeked out for "new, special" pokemon not normally available..) Maybe a new approach? I bet if I assigned the script to a sign or a person it would work, but I was hoping for a way to reset them on entrance instead.

EDIT: Oh wait, you mean like, make the Var value 0x0001 maybe so it continues? (like, "yes", do something?) or is it checking for a value that doesn't exist? I think I get that with a value of 0 nothing would happen.. Maybe with 0x0001 it will trigger only once, then end? I'm not sure what could be in that variable if its used, I haven't used it myself so I suppose its been used already? I'm not sure, I'm still kinda noob.. At least with variables.
No, he's saying that as long as the value that you set in the box matches the one the variable currently has, the script will work. If you have 0001 in the box and the value is set to be 0000 from somewhere else, it won't work. It has to be 0001. It doesn't affect how many times the script will repeat.
__________________
This is my December . . .
  #6110    
Old September 10th, 2011, 05:22 PM
1-Up's Avatar
1-Up
Beginning Trainer
 
Join Date: May 2009
Cool, got it to work, thanks guys. Added that 0x0001 to the var value :D So I take it that variable number for the next route needs to be 0x0002 to reset the next group or trainers?

EDIT: well, works mostly, I decided to remove the msgbox and now it won't work.. I get stuck on the tile it is set to, but everyone else moves still. Theres no "lock", so.. wth?.. I'd prefer if it didn't have a msgbox, but I guess I can deals with it if I don't have a choice.. I don't get why it wouldn't tho.

Also tested if 0x0002 would work for the new offset without the msgbox, that didn't seem to work either, so that probably won't work for the next route.. I don't get the Var value..

Last edited by 1-Up; September 10th, 2011 at 06:20 PM.
  #6111    
Old September 10th, 2011, 07:46 PM
metapod23's Avatar
metapod23
Hardened Trainer
 
Join Date: Mar 2009
Gender: Male
Nature: Timid
Quote:
Originally Posted by 1-Up View Post
Cool, got it to work, thanks guys. Added that 0x0001 to the var value :D So I take it that variable number for the next route needs to be 0x0002 to reset the next group or trainers?

EDIT: well, works mostly, I decided to remove the msgbox and now it won't work.. I get stuck on the tile it is set to, but everyone else moves still. Theres no "lock", so.. wth?.. I'd prefer if it didn't have a msgbox, but I guess I can deals with it if I don't have a choice.. I don't get why it wouldn't tho.

Also tested if 0x0002 would work for the new offset without the msgbox, that didn't seem to work either, so that probably won't work for the next route.. I don't get the Var value..
The script will only activate when it's set to the variable value you put in A-Map. However, you also have to change the var value at the end of the script, or else it will freeze.

So if the initial script has a var # of 4050 and the var value is 0000 in A-Map, then at the end of that script you would need to put:

Code:
setvar 0x4050 0x1
^ Now the that the variable value is set to 0001 instead of 0000 the script will no longer activate.

For the next script you could then use var # 4050 and var value 0001, but keep in mind that means that that script is now dependent on the previous script being completed and de-activated. If you didn't want it to be dependent on the previous script, you would use a different variable #, like 4051.

Just remember any variable in the game is initially set to 0000 - that's why any variable set to the value of 0000 in A-Map will activate a script initially.

Also remember in order to deactivate a script, you must change the value of the variable with setvar to something other than the var value the script is set to activate with in A-Map. It can be any number, but it makes sense to use the next one in sequence (if the script is set up to activate when the variable value is 0, it makes more sense to set the variable value to 1 than it does to 5, for instance - but either way would deactivate the script).
__________________
  #6112    
Old September 11th, 2011, 03:25 AM
Bilaterus's Avatar
Bilaterus
ToBe Best Spriter ;)
 
Join Date: Jul 2011
Gender: Male
Nature: Naive
Hey I've got this problem and it's delaying the making of my hack and stuff so... ;( Well I'll show you and maybe it's a script problem but anyway here we go
Game: FireRed
Type: Var script/Script box script
Editor: Erm, Pokescript and PKSVUI?
Script:
Spoiler:

Ok this is what my script looks like on notepad...

#org $cooop
applymovement 3 $look
$look 1 ; #binary 0x4 0xFE
message $wait
$wait 1 = \c\h01\h08Hey, wait up!
boxset 6
applymovement 3 $ketch
$ketch 1 ; #binary 0x1D 0x1D 0x1D 0x1D 0x02 0xFE
applymovement 0xFF $plop
$plop ; #binary 0x3 0xFE
message $dida
$dida 1 = \c\h01\h08There was some important\nstuff in that message.\pCan you remember it?
boxset 5
compare 0x800D 0x0001
if 0x01 goto $hup
message $good
$good 1 = \c\h01\h08Good! Now you're almost ready\nbut first you need some...\pPOKeMON!
boxset 6
applymovement 3 $geth
$geth 1 ; #binary 0x11 0x11 0x11 0x12 0x12 0x12 0x12 0x04 0xFE
applymovement 0xFF $fol
$fol 1 ; #binary 0x12 0x12 0x12 0x01 0xFE
pausemove 0x0
message $pika
$pika 1 = \c\h01\h08Now, these POKeMON are quite rare,\nI doubt you'll find them\panywhere else!\pI'll let you have one now,\nand if you treat it well...\pWell I might let you have another!
boxset 6
setflag 0x1221
setvar 0x6002 0x0001
release
end

#org $hup
message $nope
$nope 1 = \c\h01\h08He said go to SEACRET TOWN\nfind SLOWPOKE\pand tell him LEMONADE?\pI'm sure it'll make more\nsense to you.
boxset 6
message $now
$now 1 = \c\h01\h08Do you want me to say it again?
boxset 5
compare 0x800D 0x0001
if 0x01 goto $hup2
return

#org $hup2
message $nope
boxset 6
message $now
boxset 5
compare 0x800D 0x01
if 0x01 goto $hup
return

But what happens in game and what is shown on PKSVUI is thiiis...
#org 0x880B9FB
'-----------------------------------
applymovement 0x3 0x880BA90 ' look_down end
msgbox 0x880BA92 ' \c\h01\h08Hey, wait ...
callstd MSG_LOCK ' Built-in lock command
applymovement 0x3 0x880BAA3 ' run_down run_down ru...
applymovement PLAYER 0x880BA18 ' look_right end
return


#org 0x880BA92
= \c\h01\h08Hey, wait up!

#org 0x880BA90
M look_down end

#org 0x880BAA3
M run_down run_down run_down run_down look_left end

#org 0x880BA18
M look_right end

Screenshots and/or videos: If you reeeally need one I'll make one

So recap: I make a full script (not the first time this has happened to me, it also happened while making a level script, but thats a different story) but when compiled most of the script just dissappears! Is it the script? Is it the ROM? Any ideas?

EDIT: Oh wait, I found out why -.- after "applymovement 0xFF $plop" the next line uses the offset "$plop" when it is supposed to be "$plop 1" so what do we learn? Check it super carefully, and don't use silly names for offsets

Last edited by Bilaterus; September 14th, 2011 at 06:22 AM. Reason: Found out the answer now
  #6113    
Old September 11th, 2011, 04:04 PM
Truality
Left for good
 
Join Date: Aug 2011
Gender: Male
Send a message via Windows Live Messenger to Truality Send a message via Skype™ to Truality
Okay, I've hit this snag that has been holding my hack back for days. And it's pretty relevant to the one from the guy above. (1-up)

There is a script tile that just doesn't play any script it's assigned to. Not only that, but any variable I seem to put on it doesn't work.

Here's a picture of the script tile's values, though I doubt anything's wrong with it:

So, before anything else, let me tell you what else I've tried and didn't work:
  • changing variables
  • changing the variable's value
  • changing the position of the script tile
  • dumping the script tile somewhere on the map where no one would step on it and add a new one, still nothing
  • assign different scripts to it
  • checked multiple times with different ways if the variable's value is THE SAME as the one I put on A-MAP (namely, 0x0000)
If I put the script and/or variable in another script tile in ANY other previous script tile in this map (or any other map), it works. So what could be happening? (the map I'm talking about is 3.0 - Pallet Town, and the script tile doesn't work from the 6th script tile and above)
__________________
This is my December . . .
  #6114    
Old September 11th, 2011, 04:21 PM
DavidJCobb
RESIDENT RAAAAAAAAAAAAGEMASTER
 
Join Date: Jul 2010
Gender: Male
Nature: Lonely
Quote:
Originally Posted by Truality View Post
-snip-
Looking at some in-game scripts, I have a few more things you can try:
  • Reset the "Unknown" field back to $0000.
  • Make sure that the "talking level" matches the height of the movement permission beneath the Script event.
  • How many total events (of all types -- Warp, Signpost, etc.) are on your map? I wonder if there's a maximum.
__________________
  #6115    
Old September 11th, 2011, 04:31 PM
Truality
Left for good
 
Join Date: Aug 2011
Gender: Male
Send a message via Windows Live Messenger to Truality Send a message via Skype™ to Truality
Quote:
Originally Posted by DavidJCobb View Post
Looking at some in-game scripts, I have a few more things you can try:
  • Reset the "Unknown" field back to $0000.
  • How many total events (of all types -- Warp, Signpost, etc.) are on your map? I wonder if there's a maximum.
  • Make sure that the "talking level" matches the height of the movement permission beneath the Script event.
And...
  • Yeah, still nothing.
  • It's shown in the picture above, I guess there's no problem here.
  • I checked and...OH MY GOD I am so silly! I completely let this unconsidered!
So yeah, I changed the talking level and it works perfectly now! Thanks a lot! This actually made so happy that I'm going to put you in the credits. I owe you one!
__________________
This is my December . . .
  #6116    
Old September 13th, 2011, 04:26 PM
shinyabsol1's Avatar
shinyabsol1
Pokemon DarkJasper!?
 
Join Date: Aug 2010
Gender: Male
Nature: Calm
Quote:
Originally Posted by shinyabsol1
Is it possible to make a script keep track of how much time has passed since a certain event occurred (using RTC)?

Like for a honey tree script...where you put honey on a tree, then have to wait a certain amount of time for a pokemon to appear...

Thanks.
I'm gonna bump this up a page, as no one has responded to it.

Does anyone know anything about this?
  #6117    
Old September 13th, 2011, 04:38 PM
metapod23's Avatar
metapod23
Hardened Trainer
 
Join Date: Mar 2009
Gender: Male
Nature: Timid
Quote:
Originally Posted by shinyabsol1 View Post
I'm gonna bump this up a page, as no one has responded to it.

Does anyone know anything about this?
One way is possible with JPAN's Fire Red Hacked Engine, but I ran into some trouble with it as the clock seems to reset whenever I enter a Pokemon Center. But I'm not sure if it's a glitch with the system or just me or my rom.

There's another possibility, and it has to do with Daisy's script in FireRed when she massages your Pokemon. She only does it once a day, so there's a special (and I don't remember which it is right now, and I don't have my Windows opened at the moment to look at it) that seems to track this. After she gives you a massage, the "timer" is reset to 0, and I think it uses the compare command to see how much time has passed. You might be able to get something out of that.

Sorry I don't have more info on that for you right now, but I would look at the script when you get the chance.
__________________
  #6118    
Old September 13th, 2011, 06:10 PM
DavidJCobb
RESIDENT RAAAAAAAAAAAAGEMASTER
 
Join Date: Jul 2010
Gender: Male
Nature: Lonely
Quote:
Originally Posted by metapod23 View Post
There's another possibility, and it has to do with Daisy's script in FireRed when she massages your Pokemon. She only does it once a day, so there's a special (and I don't remember which it is right now, and I don't have my Windows opened at the moment to look at it) that seems to track this. After she gives you a massage, the "timer" is reset to 0, and I think it uses the compare command to see how much time has passed. You might be able to get something out of that.

Sorry I don't have more info on that for you right now, but I would look at the script when you get the chance.
I suspect that Selphy (the woman at Resort Gorgeous) is also a daily event, but her script doesn't use a special, it compares a scripting variable to 0xFFFF. I couldn't find that var's setter, so I don't know if it's a pedometer or if the game engine explicitly sets it to 0xFFFF after the passing of a day.
__________________
  #6119    
Old September 13th, 2011, 07:36 PM
shinyabsol1's Avatar
shinyabsol1
Pokemon DarkJasper!?
 
Join Date: Aug 2010
Gender: Male
Nature: Calm
Quote:
Originally Posted by metapod23
One way is possible with JPAN's Fire Red Hacked Engine, but I ran into some trouble with it as the clock seems to reset whenever I enter a Pokemon Center. But I'm not sure if it's a glitch with the system or just me or my rom.
I already ruled out this method because there are a very limited amount of timers that the player gets access to. And since each honey tree would need its own timer, there would not be enough timers for it to work.

btw, my goal with all this honey tree stuff is to have a system in my hack that works similarly to that of D/P/Pt (lots of trees that can all keep track of when honey was slathered on them).

Quote:
Originally Posted by metapod23
There's another possibility, and it has to do with Daisy's script in FireRed when she massages your Pokemon. She only does it once a day, so there's a special (and I don't remember which it is right now, and I don't have my Windows opened at the moment to look at it) that seems to track this. After she gives you a massage, the "timer" is reset to 0, and I think it uses the compare command to see how much time has passed. You might be able to get something out of that.

Sorry I don't have more info on that for you right now, but I would look at the script when you get the chance.
Thanks for the suggestion. I decompiled Daisy's script and found the part of the script with the special(s) that seem to have something to do with the "timer".

Code:
#org 0x168DB9
special 0x187
compare 0x800D 0x2
if 0x1 goto 0x81A7AE0
special 0x188
compare 0x4025 0x1F4
if 0x0 goto 0x8168E46
...
Then I used JPAN's thread on the special and special2 commands in the R&D section to figure out what the specials are for. And...they didn't really make any sense to me...

Quote:
Originally Posted by JPAN
187 places value on given variable. Seems to be a error checker of some kind, for every time it returns 0x2, a script is called to end.

188 usualy clears the values at 0203ae04 and ae08, but also may, if the values are right, change the value of 0203ae8c, which is a pointer to the RAM. is used before every legendary battle.
metapod23, do you have any idea what these mean?

Quote:
Originally Posted by DavidJCobb
I suspect that Selphy (the woman at Resort Gorgeous) is also a daily event, but her script doesn't use a special, it compares a scripting variable to 0xFFFF. I couldn't find that var's setter, so I don't know if it's a pedometer or if the game engine explicitly sets it to 0xFFFF after the passing of a day.
I might look into this later if the Daisy stuff doesn't work...but perhaps you can help to decipher what the specials in the script mean?
  #6120    
Old September 13th, 2011, 07:55 PM
DavidJCobb
RESIDENT RAAAAAAAAAAAAGEMASTER
 
Join Date: Jul 2010
Gender: Male
Nature: Lonely
Quote:
Originally Posted by shinyabsol1 View Post
I already ruled out this method because there are a very limited amount of timers that the player gets access to. And since each honey tree would need its own timer, there would not be enough timers for it to work.

btw, my goal with all this honey tree stuff is to have a system in my hack that works similarly to that of D/P/Pt (lots of trees that can all keep track of when honey was slathered on them).
There may be something you can do even with a limited number of timers.

Don't start the timer when the tree is checked. Instead, always have the timer counting, and simply record the time at which the tree is checked.

So let's say I check the tree when the timer is, I don't know... Say 0x0123. And I want the honey to wear off in 0x1000. So when I check the tree, I'll store the current time (0x0123) in some variable. When I check it again later, I compare that variable's stored time to the new current time, and if more than 0x1000 has passed, the honey wears off.

The only way this could break is if the timer loops around more than once between checking the trees. You'd need some kind of extra code (maybe a walking script?) to handle that emergency case.

But essentially,

Pseudocode for tree script
Code:
if tree flag is set:
   // honey already applied
   if (current time - tree var) > honey expiration time:
      unset tree flag
   else:
      "There's already honey on this tree."
if tree flag is unset:
   "Want to apply some honey?"
   if yes:
      set tree flag
      tree var = current time
And you'd just use one flag and one scripting variable for each tree. (Also, running checks every ten or twenty steps via the walking script could prevent timer overflow from breaking the count. You'd just want to reserve tree flags and vars in advance, so you don't have to modify the walking script every single time you add a tree.)

Remember, though, that even in a cleared and script-free ROM, script vars are in short supply!

Quote:
Originally Posted by shinyabsol1 View Post
Thanks for the suggestion. I decompiled Daisy's script and found the part of the script with the special(s) that seem to have something to do with the "timer".

Code:
#org 0x168DB9
special 0x187
compare 0x800D 0x2
if 0x1 goto 0x81A7AE0
special 0x188
compare 0x4025 0x1F4
if 0x0 goto 0x8168E46
...
Wait... Compare 0x4025 to 0x1F4?

That's odd... There's a "secret" script that the game engine calls directly, when a save file is first created. It sets several flags and it sets 0x4025 to 0x1F4.

And now we see that used in Daisy's script (how the hell did I miss that when making my list?). Weird.

Quote:
Originally Posted by shinyabsol1 View Post
Then I used JPAN's thread on the special and special2 commands in the R&D section to figure out what the specials are for. And...they didn't really make any sense to me...
Special 187 can be ignored. It's called by everything from legendary battles to PokeCenter nurses to, as you've discovered, Daisy. No idea what 188 does.
__________________
  #6121    
Old September 14th, 2011, 11:29 AM
shinyabsol1's Avatar
shinyabsol1
Pokemon DarkJasper!?
 
Join Date: Aug 2010
Gender: Male
Nature: Calm
Quote:
Originally Posted by DavidJCobb
There may be something you can do even with a limited number of timers.

Don't start the timer when the tree is checked. Instead, always have the timer counting, and simply record the time at which the tree is checked.

So let's say I check the tree when the timer is, I don't know... Say 0x0123. And I want the honey to wear off in 0x1000. So when I check the tree, I'll store the current time (0x0123) in some variable. When I check it again later, I compare that variable's stored time to the new current time, and if more than 0x1000 has passed, the honey wears off.

The only way this could break is if the timer loops around more than once between checking the trees. You'd need some kind of extra code (maybe a walking script?) to handle that emergency case.

But essentially,

Pseudocode for tree script

Code:
if tree flag is set:
   // honey already applied
   if (current time - tree var) > honey expiration time:
      unset tree flag
   else:
      "There's already honey on this tree."
if tree flag is unset:
   "Want to apply some honey?"
   if yes:
      set tree flag
      tree var = current time
Thanks for helping, DavidJCobb

I understand what you mean about using one timer, but:

1). metapod23 says the timer resets upon entering a Pokemon Center, which is a major problem...

2). The timer runs for 18 hours, but idk if it resets and keeps going after this or if it keeps going while the game is turned off (JPAN's guide doesn't say...)?

3). I read in JPAN's guide about the walking scripts, and I don't understand how they work at all (maybe you can clear that up for me).

Quote:
Originally Posted by DavidJCobb
And you'd just use one flag and one scripting variable for each tree. (Also, running checks every ten or twenty steps via the walking script could prevent timer overflow from breaking the count. You'd just want to reserve tree flags and vars in advance, so you don't have to modify the walking script every single time you add a tree.)

Remember, though, that even in a cleared and script-free ROM, script vars are in short supply!
Ok, two things about variables (I don't understand them fully):

1). Once set to a certain value, will it stay at that value (even if the game is turned off) until it is either reset to 0 or set to another value? If so, then I might have just thought of another possible way I could make honey trees work...

2). What variables are free for player use (for whatever) in game?


As for the specials used in the Daisy script, there were more of them, so maybe I picked the wrong ones? I'm gonna have another look at that script today...
  #6122    
Old September 14th, 2011, 12:28 PM
romancandle
 
Join Date: Oct 2009
Gender: Male
Nature: Adamant
I'm trying to make a script that checks a pokemon's happiness (with the happiness special from the Hacked Fire Red Engine. I've tried this in-game (by editting the base happiness of Charmander), and it always defaults to the last msgbox. Can someone help me fix this?

Code:
#org 0x81C2E0
lock
faceplayer
bufferfirstpokemon 0x00
special 0xd
compare 0x8004 0xFF
if 0x1 goto @love
compare 0x8004 0x96
if 0x1 goto @adore
compare 0x8004 0x4B
if 0x1 goto @like
compare 0x8004 0x28
if 0x1 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.
  #6123    
Old September 14th, 2011, 01:29 PM
metapod23's Avatar
metapod23
Hardened Trainer
 
Join Date: Mar 2009
Gender: Male
Nature: Timid
Quote:
Originally Posted by shinyabsol1 View Post
I already ruled out this method because there are a very limited amount of timers that the player gets access to. And since each honey tree would need its own timer, there would not be enough timers for it to work.

btw, my goal with all this honey tree stuff is to have a system in my hack that works similarly to that of D/P/Pt (lots of trees that can all keep track of when honey was slathered on them).



Thanks for the suggestion. I decompiled Daisy's script and found the part of the script with the special(s) that seem to have something to do with the "timer".

Code:
#org 0x168DB9
special 0x187
compare 0x800D 0x2
if 0x1 goto 0x81A7AE0
special 0x188
compare 0x4025 0x1F4
if 0x0 goto 0x8168E46
...
Then I used JPAN's thread on the special and special2 commands in the R&D section to figure out what the specials are for. And...they didn't really make any sense to me...



metapod23, do you have any idea what these mean?



I might look into this later if the Daisy stuff doesn't work...but perhaps you can help to decipher what the specials in the script mean?
special 0x188 and the compare 0x4025 0x1F4 are what you're looking for.

I tested them, and it turns out that it is a step counter, like in the Safari Zone. special 0x188 seems to start the step counter and I believe special 0x197 resets it to zero.

For grooming, you would have to take 500 steps before she will groom your Pokemon again, which is why it compares 0x4025 to 0x1f4.

This could be a way to do the honey trees, but it would not be using a real-time clock, so you couldn't time it for a certain number of hours, but only a certain number of steps.

Quote:
Originally Posted by romancandle View Post
I'm trying to make a script that checks a pokemon's happiness (with the happiness special from the Hacked Fire Red Engine. I've tried this in-game (by editting the base happiness of Charmander), and it always defaults to the last msgbox. Can someone help me fix this
To use the special in the hacked engine, you would probably need to put:

Code:
special2 0x8004 0xd
instead of special 0xd in your script.

Also, you should probably use if 0x4 instead of if 0x1 - 0x4 is greater than and equal to, while 0x1 is just equal to.
__________________

Last edited by metapod23; September 14th, 2011 at 01:42 PM.
  #6124    
Old September 14th, 2011, 03:05 PM
shinyabsol1's Avatar
shinyabsol1
Pokemon DarkJasper!?
 
Join Date: Aug 2010
Gender: Male
Nature: Calm
Quote:
Originally Posted by metapod23
special 0x188 and the compare 0x4025 0x1F4 are what you're looking for.

I tested them, and it turns out that it is a step counter, like in the Safari Zone. special 0x188 seems to start the step counter and I believe special 0x197 resets it to zero.

For grooming, you would have to take 500 steps before she will groom your Pokemon again, which is why it compares 0x4025 to 0x1f4.

This could be a way to do the honey trees, but it would not be using a real-time clock, so you couldn't time it for a certain number of hours, but only a certain number of steps.
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.
  #6125    
Old September 14th, 2011, 08:56 PM
DavidJCobb
RESIDENT RAAAAAAAAAAAAGEMASTER
 
Join Date: Jul 2010
Gender: Male
Nature: Lonely
Quote:
Originally Posted by shinyabsol1 View Post
1). Once set to a certain value, will it stay at that value (even if the game is turned off) until it is either reset to 0 or set to another value? If so, then I might have just thought of another possible way I could make honey trees work...
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).

Quote:
Originally Posted by shinyabsol1 View Post
2). What variables are free for player use (for whatever) in game?
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.
__________________
Closed Thread
Quick Reply

Sponsored Links


Advertise here
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
Minimum Characters Per Post: 25



All times are UTC -8. The time now is 06:34 PM.


Style by Nymphadora, artwork by Sa-Dui.
Like our Facebook Page Follow us on Twitter © 2002 - 2014 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2014 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.