PDA

View Full Version : Different pokemon at night


mindfreak
January 6th, 2010, 01:45 PM
Sorry for my horrible English.I'll try to explain everything as good as I can.

You probably know that in the pokémon games with a D/N system the pokemon at night are different from the one at day.
And now that ZodiacDaGreat and Interdpth have created a clock and a D/N system for firered I wondered if something like that would be possible to make.

So I tied to make something like that.

This is what I got so far:
(I used a Fire red rom with the D/N system from Zodiac and Interdpth)

I started to try to make a ASM script that stored the hours to 0x800D
(Unfortunally I can't give you the script because Interdepth asked in his treat to not post it)
(but I don't understand asm either so i can give you a hint ''Hackmew's knowledge secret ID tut'')
After that i searched for the pointer to ''the data of the pokemon in route 1 ''(search for 608E3C08).
and changed it to 4C550003 since I figured that you cant write to ROM ingame.
And at 0x00750000 I made new 'Night pokemon data'
Each pokemon has 4 bytes like this 03 03 13 00
03 Min Lv
03 Max LV
1300 Pokemon hex number(Keep in mind that you need at least 48 bytes free space 4bytes*12 pokemon)

After that I made (edited the pallete change script from foofatron) two asm scripts.
One to store the 'original day pokemon' from ROM to the RAM at 0300554C
And an other to store 'The night pokemon' from ROM to RAM at 0300554C

Day pokemons
.thumb
push {r0-r2, lr}
ldr r0, .Daypokes
ldr r1, .pokés
mov r2, #0x18
swi 11
pop {r0-r2, pc}
.align 2
.Daypokes:
.word 0x083C8E60
.pokés:
.word 0x0300554C
Night pokemons ''same script other offset'' (750000 is the place where I stored the night pokemon data)
.thumb
push {r0-r2, lr}
ldr r0, .Nightpokes
ldr r1, .pokés
mov r2, #0x18
swi 11
pop {r0-r2, pc}
.align 2
.Nightpokes:
.word 0x08750000
.pokés:
.word 0x0300554C
Once these were inserted I used this XSE script as a levelscript....

#Dynamic 0x810000

#define B_< 0x0
#define B_<< 0x0
#define B_= 0x1
#define B_== 0x1
#define B_> 0x2
#define B_>> 0x2
#define B_<= 0x3
#define B_>= 0x4
#define B_!= 0x5
#define B_<> 0x5


'------------------------------------------------------
'Script
'------------------------------------------------------

#org @START
setvar 0x4033 0x1
callasm 0x800001
compare 0x800D 0x4
if B_>= goto @CHECK
goto @night
end

#org @CHECK
compare 0x800D 0x13
if B_>= goto @night
goto @day

#org @night
callasm 0x750031
end

#org @day
callasm 0x750045
endProblems I have found:
Advance map gives an error when you open route 1 cause 4C550003 isn't a pointer
you got to leave the map before the effect takes place.
I think there must be another way of making something like this

I hope you understanded everything .

Sora's Nobody
January 7th, 2010, 09:50 AM
Sad nobody answerd to this thread so ill just do even tought i have no scripting or asm experience, this is a good idea and would open alot of possiblitiys

interdpth
January 7th, 2010, 09:56 AM
Sad nobody answerd to this thread so ill just do even tought i have no scripting or asm experience, this is a good idea and would open alot of possiblitiys

Hush you.

Anyway, Mindfreak, I was talking about this with a friend a few days ago.

My idea was to make a wild list for night time.

Store it somewhere.

Then make a level script to check the time and replace the pointer list in memory, seems like a two hour job at most, and should be easy.

Good luck.

hashtag
January 7th, 2010, 10:29 AM
Andrea (HackMew) told me that with his D/N the even and odd pokémon in A-Map were based on which session they would appear in. But they might've been just in his D/N system, I'll have to ask him about it again.

ZodiacDaGreat
January 7th, 2010, 12:21 PM
Uh, there's no need for the use of scripts to perform this. If you would only be patient and let us work XD But then again it is your way. My idea is to edit the loader, so it'll load different sets of Pokémon depending on the period. This also means you need to have more then 1 set of Pokemon.

Deokishisu
January 7th, 2010, 04:52 PM
Honestly, this would be solved if the knowledge of how to check for the time in a script were released to the general public, if we're all talking interdepth's system. I'm about as useful as a tree stump when it comes to ASM, and though I've tried, I can't seem to make heads or tails of the code.

With that information, those using JPAN's engine could simply set a level script that checks the time and have it load a new set of wildpokemon data depending on the time. Not to mention the other flavor things we could do with the knowledge of how to check for the time.

"Good Evening, welcome to our Pokemon Center!"
"I'm waiting here for Pokemon that only come out in the morning."
"Sorry, we're closed on Mondays."

colcolstyles
January 7th, 2010, 04:56 PM
I once thought about how this might be possible and the idea I eventually came up with is to alter both the way Wild Pokémon data is stored along with the routine that access the data. I don't know much about how Wild Pokémon data is accessed but my understanding is that each map has a pointer to its Wild Pokémon data. My proposal would be to use that pointer to point to, instead of the data itself, a table consisting of two pointers, one pointing to the daytime pokémon data and the other to the nighttime pokémon data (more pointers could be used in the table if you wanted morning, day, and night). The routine(s) that access the Wild Pokémon data would then be altered so that instead of simply loading the data pointed to by the map, it would follow one of the pointers where the old Wild Pokémon data was and, depending on the time, then access the correct time's data. The data would still be stored in the same format, but there would just be twice as much data. As I see it, the routine would remain practically the same except for a conditional branch depending on the time but the way that the data is accessed and used should remain the same. All that would be changed would be the act of locating the data.

Eh, it's just a thought. I haven't strongly considering trying it because I wouldn't know where to start.

interdpth
January 7th, 2010, 05:06 PM
bleh


okay because it's this forum.

I'll do it. XD

with my RTC
copybyte 0x20370BA 0x3005542

Should put the hour byte into LASTResult

Then

cmp lastresult yournighthour
insertcraphere


or use the d&n value


We've presented people with two ways to do it.

You can either make a level script or some script that gets called in the loadmap thing etc, my mind is rambling, sorry XD

ZodiacDaGreat
January 7th, 2010, 05:07 PM
@ colcolstyles - That's exactly what I meant ^^

colcolstyles
January 7th, 2010, 05:17 PM
Honestly, this would be solved if the knowledge of how to check for the time in a script were released to the general public, if we're all talking interdepth's system. I'm about as useful as a tree stump when it comes to ASM, and though I've tried, I can't seem to make heads or tails of the code.

I tried using ZodiacDaGreat's code and it conveniently places it somewhere in the WRAM. I forget where but I think he mentioned it somewhere.

With that information, those using JPAN's engine could simply set a level script that checks the time and have it load a new set of wildpokemon data depending on the time. Not to mention the other flavor things we could do with the knowledge of how to check for the time.

I think having a level script for every single map seems a little cumbersome.

"Good Evening, welcome to our Pokemon Center!"
"I'm waiting here for Pokemon that only come out in the morning."
"Sorry, we're closed on Mondays."

We could have a whole thread on ideas for how to use the RTC ^^

@ colcolstyles - That's exactly what I meant ^^

Nice to see I'm not alone. :)

Deokishisu
January 7th, 2010, 05:34 PM
I tried using ZodiacDaGreat's code and it conveniently places it somewhere in the WRAM. I forget where but I think he mentioned it somewhere.
Honestly, I've read tutorials, tried doing ASM, and failed miserably everytime. I just can't seem to grasp it. I wouldn't even know how to check the WRAM. :P

I think having a level script for every single map seems a little cumbersome.

Really? Just to be difficult here, but you'd only have to do it with maps that have wildpokemon on it. And how many maps could that feasibly be on? 45-50? Including routes and caves? I guess I may just be a sucker for levelscripts. I just love how much can be done and how many ideas could be realized with them. It just seems easier to go with levelscripts than ASMing everything, from my perspective of course.

Actually, now that I think about it, someone might want to ask JPAN or take a look at his engine to determine how his ASM worked out. It may give everyone a jumping off point.

colcolstyles
January 7th, 2010, 05:40 PM
Honestly, I've read tutorials, tried doing ASM, and failed miserably everytime. I just can't seem to grasp it. I wouldn't even know how to check the WRAM. :P

Well I just checked and it's located at 0x03004038. You can access using the 'copybyte' command in XSE.

Really? Just to be difficult here, but you'd only have to do it with maps that have wildpokemon on it. And how many maps could that feasibly be on? 45-50? Including routes and caves? I guess I may just be a sucker for levelscripts. I just love how much can be done and how many ideas could be realized with them. It just seems easier to go with levelscripts than ASMing everything, from my perspective of course.

Actually, now that I think about it, someone might want to ask JPAN or take a look at his engine to determine how his ASM worked out. It may give everyone a jumping off point.

Well, you could if you really wanted. It just seems, to me at least, more efficient to edit one routine that will then apply to every map.

Juan
January 8th, 2010, 07:34 AM
In a few months ago I did a routine to Emerald, but it was not complete.

Now I updated it to work with the interdpth rtc.

It works perfectly, the only problem is that it is incompatible with the A-MAP, so to edit wild Pokemon have to do manually, or create a program that does that.

Soon I edit with the routine that I did, it is simple, but it works. :D


==========================================================

Edit:

Open A-MAP and go to a map that has wild Pokemon.
Click to expand the number of Pokémon.
You will see the header offset.
http://i50.tinypic.com/fm6nuu.jpg


the header is:


u32 Ratio
u32 Pointer to Pokemon Data


the Pokemon Data is:


u8 LV MIN [1]
u8 LV MAX [1]
u16 Pokemon[1]
u8 LV MIN [2]
u8 LV MAX [2]
u16 Pokemon[2]
u8 LV MIN [3]
u8 LV MAX [3]
u16 Pokemon[3]
u8 LV MIN [4]
u8 LV MAX [4]
u16 Pokemon[4]
u8 LV MIN [5]
u8 LV MAX [5]
u16 Pokemon[5]
u8 LV MIN [6]
u8 LV MAX [6]
u16 Pokemon[6]
u8 LV MIN [7]
u8 LV MAX [7]
u16 Pokemon[7]
u8 LV MIN [8]
u8 LV MAX [8]
u16 Pokemon[8]
u8 LV MIN [9]
u8 LV MAX [9]
u16 Pokemon[9]
u8 LV MIN [10]
u8 LV MAX [10]
u16 Pokemon[10]
u8 LV MIN [11]
u8 LV MAX [11]
u16 Pokemon[11]
u8 LV MIN [12]
u8 LV MAX [12]
u16 Pokemon[12]



The modified routine uses the following header:


u32 Ration
u32 Table Pointer


The table then is this:

u32 Morning Pokemon Pointer
u32 Night Pokémon Pointer


And the data of the Pokémon are kept the same as the original.

Routine:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@Different wild Pokemon based on time. @
@Version 0.1 @
@Uses the interdpth RTC. @
@For Pokémon Fire Red BPEE @
@ @
@ @
@OBS:New wild Pokémon incompatible with the A-MAP. @
@ @
@Made by Juan @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.thumb

@
@Insert the following routine in 0x8083060.
@
loc_8083060:
LDR R1, sub1a
BX R1
.align
sub1a: .long 0x00000000




@
@Insert the following routine in 0x8082B48.
@
loc_8082B48:
LDR r0, sub2a
BX r0
.align
sub2a: .long 0x00000000




@
@Insert the following routine in 0x08082B26.
@
loc_08082B26:
LSL R0, R0, #0
LDR R0, sub3a
BX R0
.align
sub3a: .long 0x00000000



@called by 0x8083060
sub1:
BL sub_808274C
LSL R0, R0, #0x18
LDR R1, [R5,#4]
PUSH {r0}
mov r0, r1
BL TimeWildPoke
mov r1, r0
POP {r0}
LDR r6, return1
BX r6
.align
return1: .long 0x08083069



@called by 0x8082B48
sub2:
LDR R0, [R7,#4]
BL TimeWildPoke
ADD R0, R4, R0
LDRH R0, [R0,#2]
ADD R1, R5, #0
ADD R2, R6, #0
LDR R6, return2
BX R6
.align
return2: .long 0x08082B53



@called by 0x08082B26
sub3: LDR R0, [R7,#4]
BL TimeWildPoke
ADD R0, R0, R4
PUSH {R4}
BL sub_80828F8
POP {R4}
LSL R0, R0, #0x18
LDR R5, return3
BX R5
.align
return3: .long 0x08082B31



@Routine that checks the time and reads the pointer indicated.
TimeWildPoke:
PUSH {LR}
PUSH {R4}
LDR R4, Hour
LDRB R4, [R4]
CMP R4, #0x6 @6AM
BGE Morning
B Night
.align
Hour: .long 0x03005542


Morning:
CMP R4, #0x12 @6PM
BGE Night
LDR R0, [R0]
B End

Night:
LDR R0, [R0, #4]


End:
POP {R4}
POP {R1}
BX R1



@
@Part of the original routine.
@
sub_808274C:
LDR r1,= 0x808274D
BX r1

sub_80828F8:
LDR r4,= 0x80828F9
BX r4


.end

Omega Zero
January 15th, 2010, 12:24 PM
i was thinking.. would there be a way with jpans hacked enging and the Rtc patch to check the palettes and then in a level script checks if it is day time and then goes to a pointer and has special 0x97 to generate a wild battle or something and if the palettes are dark it goes to a pointer that jumps to a headbutt tree pokemon but that wouldn't be very useful :\

HackMew
January 24th, 2010, 02:39 AM
I did it differently, ages ago. Here's a short video (http://www.youtube.com/watch?v=ks5YO7EbzWQ). Basically, in my RTC + D/N system, there are 4 times of day.


0 = Morning
1 = Afternoon
2 = Evening
3 = Night

Determing wheteher it's day or night it's pretty easy. I just look at the MSB, which is always 0 during day time, and 1 during night time. Then, right after the random wild Pokémon index has been choosen, I check if that number is odd or even. If the wild Pokémon index is even while day time, nothing happens. If the the index is odd while day time, instead, the value is XORed with 0x1, making it odd. Analog thing for night time. This means on AM, the first Pokémon in the list is for day time, the second one is night time, and so on.