Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#1 2011-08-18 08:35:15

zhengwei
Member
Registered: 2011-08-18
Post 1/140

pokemon GSC problem

I want to change the GSC,but there are some problem, how to get the detail time (not get only morning,afternoon,night),and how to get the number of shinny pokemon in the hiro's hand not in the box.
how to write these scripting codes?
Thanks

Last edited by zhengwei (2011-08-18 09:50:11)

Offline

#2 2011-08-19 08:06:35

zhengwei
Member
Registered: 2011-08-18
Post 4/140

Re: pokemon GSC problem

The problem with time has been solved,do anyone know how to solve the shinny problem?

Last edited by zhengwei (2011-08-19 09:08:46)

Offline

#3 2011-08-19 15:49:21

266/700

Re: pokemon GSC problem

I don’t understand your question. Can you rephrase it more clearly?

#4 2011-08-19 16:10:50

zhengwei
Member
Registered: 2011-08-18
Post 5/140

Re: pokemon GSC problem

I'm so sorry. My English is poor..Hiro has n(1<=n<=6) pokemon in the bag.......There is a people event, if Hiro has 5 shinny pokemon, that something will be happened.
The question is that how to get the number of shinny pokemon in the Hiro's bag(not in the box)....

Last edited by zhengwei (2011-08-19 16:26:20)

Offline

#5 2011-08-19 16:14:54

zhengwei
Member
Registered: 2011-08-18
Post 6/140

Re: pokemon GSC problem

The Rom is gold/silver, not containing crystal

Offline

#6 2011-08-19 16:43:25

Cartmic
Member
Registered: 2010-10-16
Post 65/156

Re: pokemon GSC problem

Right so you want an event to be called upon Hiro having 5 shiny Pokemon within his bag?

Your problem is checking how many Shiny Pokemon he has on him?

Offline

#7 2011-08-19 17:02:48

zhengwei
Member
Registered: 2011-08-18
Post 7/140

Re: pokemon GSC problem

Cartmic wrote:

Right so you want an event to be called upon Hiro having 5 shiny Pokemon within his bag?

Your problem is checking how many Shiny Pokemon he has on him?

Yes, there is a person, Hiro talks with him,if Hiro has 5 shinny pokemon in the bag,something will be happened.

Last edited by zhengwei (2011-08-19 17:22:13)

Offline

#8 2011-08-19 17:28:03

269/700

Re: pokemon GSC problem

I guess you would need some ASM for that. I don’t think there is a script command to check shininess.

Given a pointer to DVs in the bc register, you can check shininess by calling 02:5052 and checking the carry. So here’s what I’m thinking:

; count the number of shiny Pokémon in party
    ld bc,$D3AF ; pointer to first Attack/Defense DV in party

    ; number of times to loop = number of Pokémon in party
    ld a,[$DA22]
    ld d,a

    xor a ; number of shiny Pokémon found

.loop\@
    push af
    ; bankswitch
    ld a,2
    ld hl,$5052
    rst $08

    jr c,.inc\@
    jr .noinc\@
.inc\@
    pop af
    inc a
    jr .next\@
.noinc\@
    pop af
.next\@
    ld hl,$0030 ; move to the next Pokémon
    add hl,bc
    ld c,l
    ld b,h
    dec d
    jr nz,.loop\@

    ; store to script-accessible RAM
    ld hl,$CF91
    ld [hl],a
    ret

I have not tested this.

#9 2011-08-19 17:39:36

zhengwei
Member
Registered: 2011-08-18
Post 8/140

Re: pokemon GSC problem

IIMarckus wrote:

I guess you would need some ASM for that. I don’t think there is a script command to check shininess.

Given a pointer to DVs in the bc register, you can check shininess by calling 02:5052 and checking the carry. So here’s what I’m thinking:

; count the number of shiny Pokémon in party
    ld bc,$D3AF ; pointer to first Attack/Defense DV in party

    ; number of times to loop = number of Pokémon in party
    ld a,[$DA22]
    ld d,a

    xor a ; number of shiny Pokémon found

.loop\@
    push af
    ; bankswitch
    ld a,2
    ld hl,$5052
    rst $08

    jr c,.inc\@
    jr .noinc\@
.inc\@
    pop af
    inc a
    jr .next\@
.noinc\@
    pop af
.next\@
    ld hl,$0030 ; move to the next Pokémon
    add hl,bc
    ld c,l
    ld b,h
    dec d
    jr nz,.loop\@

    ; store to script-accessible RAM
    ld hl,$CF91
    ld [hl],a
    ret

I have not tested this.

I get lost about that, sorry to boring you, could you explain how does code work?how can I embed them in script code?

Offline

#10 2011-08-19 19:57:07

Sawakita
Administrator
Registered: 2010-10-16
Post 185/364

Re: pokemon GSC problem

Tauwasser's Scripting Compendium is your friend:

Scripting Compendium wrote:

0E ASM code1:
-------------

Calls a predefined routine by interpreting the ASM the pointer points to.

Structure:

[0E][3byte pointer]

10 ASM code2:
-------------

Call an ASM script via a 2byte pointer pointing to a 3byte pointer.

Structure:

[10][2byte pointer pointing to 3byte pointer pointing to ASM script]

IIMarckus's code is probably the best solution, since you can re-use it in many scripts and optimize space used. Anyway, in case you wanted to work with scripts only, you might give a try to these commands here (although the resulting script would probably be a lot more space-wasting and inefficient):

Scripting Compendium wrote:

0A = RAM check [<byte]
0B = RAM check [>byte]

I strongly suggest the ASM routine you've been given (honestly, there's not much to add comments on, since it's pretty clear and linear, and opcodes often speak for themselves).

Offline

#11 2011-08-20 05:13:44

zhengwei
Member
Registered: 2011-08-18
Post 9/140

Re: pokemon GSC problem

Sawakita wrote:

Tauwasser's Scripting Compendium is your friend:

Scripting Compendium wrote:

0E ASM code1:
-------------

Calls a predefined routine by interpreting the ASM the pointer points to.

Structure:

[0E][3byte pointer]

10 ASM code2:
-------------

Call an ASM script via a 2byte pointer pointing to a 3byte pointer.

Structure:

[10][2byte pointer pointing to 3byte pointer pointing to ASM script]

IIMarckus's code is probably the best solution, since you can re-use it in many scripts and optimize space used. Anyway, in case you wanted to work with scripts only, you might give a try to these commands here (although the resulting script would probably be a lot more space-wasting and inefficient):

Scripting Compendium wrote:

0A = RAM check [<byte]
0B = RAM check [>byte]

I strongly suggest the ASM routine you've been given (honestly, there's not much to add comments on, since it's pretty clear and linear, and opcodes often speak for themselves).

could you introduce me a good ASM editor?

Last edited by zhengwei (2011-08-20 05:18:52)

Offline

#12 2011-08-20 07:46:00

~Red
Member
Registered: 2010-10-16
Post 133/276

Re: pokemon GSC problem

zhengwei wrote:

could you introduce me a good ASM editor?

Yeah, a hex editor.

Offline

#13 2011-08-20 08:07:36

zhengwei
Member
Registered: 2011-08-18
Post 10/140

Re: pokemon GSC problem

~Red wrote:
zhengwei wrote:

could you introduce me a good ASM editor?

Yeah, a hex editor.

; count the number of shiny Pokémon in party
    ld bc,$D3AF ; pointer to first Attack/Defense DV in party;01 AF D3

    ; number of times to loop = number of Pokémon in party
    ld a,[$DA22];FA 22 DA
    ld d,a;57

    xor a ; number of shiny Pokémon found;AF

.loop\@
    push af;F5
    ; bankswitch
    ld a,2;3E 2
    ld hl,$5052;21 52 50
    rst $08;CF

    jr c,.inc\@;38 02
    jr .noinc\@;18 04
.inc\@
    pop af;F1
    inc a;3C
    jr .next\@;18 01
.noinc\@
    pop af;F1
.next\@
    ld hl,$0030 ; move to the next Pokémon;21 30 00
    add hl,bc;09
    ld c,l;4D
    ld b,h;44
    dec d;15
    jr nz,.loop\@;20 E7

    ; store to script-accessible RAM
    ld hl,$D173;21 73 D1
    ld [hl],a;77
    ret;C9
I tests it,it can't work....

Offline

#14 2011-08-20 08:11:45

zhengwei
Member
Registered: 2011-08-18
Post 11/140

Re: pokemon GSC problem

#org 0x123100
'-----------------------------------
3callasm 0x123530
if != 0x5 0x71BC ' 0x1231BC
faceplayer
loadfont
2writetext 0x7288 ' 0x123288
closetext
loadpokedata 0x97 0x1
startbattle
returnafterbattle
disappear 0x3
end

#org 0x1231BC
'-----------------------------------
jumptextfaceplayer 0x7220 ' 0x123220

#org 0x123288
= u\e


#org 0x123220
= fuck!!!\e



ASM location is offset 0x123530

Last edited by zhengwei (2011-08-20 08:13:42)

Offline

#15 2011-08-20 11:02:08

Sawakita
Administrator
Registered: 2010-10-16
Post 187/364

Re: pokemon GSC problem

zhengwei wrote:

could you introduce me a good ASM editor?

This one is not bad: Gameboy Assembly Editor. Note that it doesn't support labeling so you'll have to calculate all addresses (including relative jumps' addresses) on your own.
It's better than a hex editor for ASM editing, I believe.

Offline

#16 2011-08-20 13:56:42

zhengwei
Member
Registered: 2011-08-18
Post 12/140

Re: pokemon GSC problem

Sawakita wrote:
zhengwei wrote:

could you introduce me a good ASM editor?

This one is not bad: Gameboy Assembly Editor. Note that it doesn't support labeling so you'll have to calculate all addresses (including relative jumps' addresses) on your own.
It's better than a hex editor for ASM editing, I believe.

Thank you very much.Do you know the problem? I tests it, however I do, the number of shinny pokemon always are 1.

Last edited by zhengwei (2011-08-20 13:58:06)

Offline

#17 2011-08-20 13:57:59

272/700

Re: pokemon GSC problem

IIMarckus wrote:
; store to script-accessible RAM
    ld hl,$CF91

I made a mistake here. This needs to be $D173, not $CF91.

I still have not tested it.

#18 2011-08-20 14:17:38

zhengwei
Member
Registered: 2011-08-18
Post 13/140

Re: pokemon GSC problem

IIMarckus wrote:
IIMarckus wrote:
; store to script-accessible RAM
    ld hl,$CF91

I made a mistake here. This needs to be $D173, not $CF91.

I still have not tested it.

The address either is $D173 ,or $CF91...However I do,the number of shinny pokemon are 1..What's the problem?

Offline

#19 2011-08-20 19:36:00

Sawakita
Administrator
Registered: 2010-10-16
Post 190/364

Re: pokemon GSC problem

This is just a supposition, but maybe the error is in this line:

zhengwei wrote:

if != 0x5 0x71BC ' 0x1231BC

Shouldn't you specify the RAM location that you read from? Something like this:
if 0xD173 != 0x5 0x71BC ' 0x1231BC

Or maybe you mean that the value at 0xD173 is always 1 (meaning that you checked personally the RAM through debugging)?

Offline

#20 2011-08-20 19:46:20

Miksy91
Member
Registered: 2010-10-16
Post 494/2,308

Re: pokemon GSC problem

Scripting commands for RAM checks automatically work with (and only with) ram address D173.


Glossary:

RAM = D173
RAM2 = D174
PokéRAM = D117
LevelRAM = D040
TrRAM1 = D118
TrRAM2 = D11B
BattleRAM = D180
TEMPMEMORY1 = CF6B
TEMPMEMORY2 = CF7E
MEMORY1 = CF91
MEMORY2 = CFA4
MEMORY3 = CFB7
MapRAM = C700+

Last edited by Miksy91 (2011-08-20 19:46:38)

Offline

#21 2011-08-20 23:55:00

Tauwasser
Member
Registered: 2010-10-16
Post 166/447

Re: pokemon GSC problem

What's at D3AF? I just looked in Gold and Crystal and both use other addresses for their data.

IMHO, you should go to DA2A and start looking there.

; count the number of shiny Pokémon in party

xor a,a
ld e, a  ; number of shiny Pokémon found
ld [$D005], a ; party pokemon index
ld a,$15
call $3B3A ; This will load DA2A + a (offset to DVs/EVs) to hl. So if you ever repoint the data, your code still works.

; number of times to loop = number of Pokémon in party
ld a,[$DA22]
ld d,a

or a,a ; make sure there is at least one PKMN in there, else results will be wrong.
jr z, .done

.loop\@
    push hl
    pop bc  ; pointer to Attack/Defense DV in party
    ; bankswitch
    ld a,2
    ld hl,$5052
    rst $08
    ld a, e
    adc a, $00
    ld e, a
    ld hl,$0030 ; move to the next Pokémon
    add hl,bc
    dec d
    jr nz,.loop\@

. done
    ; store to script-accessible RAM
    ld hl,$D173
    ld [hl],e
    ret

Tested it, works.

cYa,

Tauwasser

Offline

#22 2011-08-21 00:44:50

274/700

Re: pokemon GSC problem

Tauwasser wrote:

What's at D3AF? I just looked in Gold and Crystal and both use other addresses for their data.

Oops, I meant DA3F.

#23 2011-08-21 01:30:52

zhengwei
Member
Registered: 2011-08-18
Post 14/140

Re: pokemon GSC problem

Tauwasser wrote:

What's at D3AF? I just looked in Gold and Crystal and both use other addresses for their data.

IMHO, you should go to DA2A and start looking there.

; count the number of shiny Pokémon in party

xor a,a
ld e, a  ; number of shiny Pokémon found
ld [$D005], a ; party pokemon index
ld a,$15
call $3B3A ; This will load DA2A + a (offset to DVs/EVs) to hl. So if you ever repoint the data, your code still works.

; number of times to loop = number of Pokémon in party
ld a,[$DA22]
ld d,a

or a,a ; make sure there is at least one PKMN in there, else results will be wrong.
jr z, .done

.loop\@
    push hl
    pop bc  ; pointer to Attack/Defense DV in party
    ; bankswitch
    ld a,2
    ld hl,$5052
    rst $08
    ld a, e
    adc a, $00
    ld e, a
    ld hl,$0030 ; move to the next Pokémon
    add hl,bc
    dec d
    jr nz,.loop\@

. done
    ; store to script-accessible RAM
    ld hl,$D173
    ld [hl],e
    ret

Tested it, works.

cYa,

Tauwasser



Thanks a lot....But your code is difficult to understand.....What's party pokemon index?
    call $3B3A
Why should I call this function?

Last edited by zhengwei (2011-08-21 01:32:37)

Offline

#24 2011-08-21 02:01:32

zhengwei
Member
Registered: 2011-08-18
Post 15/140

Re: pokemon GSC problem

IIMarckus wrote:
Tauwasser wrote:

What's at D3AF? I just looked in Gold and Crystal and both use other addresses for their data.

Oops, I meant DA3F.


I may make mistake;

Why I call this simply ASM code such as:
  ld hl,$D173
  ld [hl],$xx(any value)
In scripting code ,I use (if == 0x1 0x71BC ' 0x1231BC), this statment always is true......

Last edited by zhengwei (2011-08-21 02:06:28)

Offline

#25 2011-08-21 02:59:29

Tauwasser
Member
Registered: 2010-10-16
Post 167/447

Re: pokemon GSC problem

If you execute "==0x01", the scripting tool (which one?) will actually translate into "!=0x00", I think. So basically, it should be false at least for "ld [hl],$00". Try that first, and make sure. If it is still true, your mistake is somewhere else.
So this code should still work for no shiny Pokemon in your party. However, you would always execute the jump for any shiny Pokemon right now. You should make a comparison for [D173]==0x06.

cYa,

Tauwasser

Offline

Board footer

Powered by FluxBB