You are not logged in.
Pages: 1
Based on the disassembly of Pokémon Crystal (link), I have made changes in the effects of attacks on pokemon Gold , obtaining diversity of them like as Dragon Dance, Leaf Storm, Arm Hammer, etc, but now I have a problem.
Based on "Roar" , I made a new effect in a unused index. The move hurt the oponent (like a Dragon Tail) but not force the switch if I go first, however, if I go to the last effect works as it should. This are the commands used:
Dragon Tail:
checkobedience
usedmovetext
doturn
critical
damagestats
damagecalc
stab
damagevariation
checkhit
effectchance
hittarget
resulttext
checkfaint
criticaltext
supereffectivetext
checkdestinybond
buildopponentrage
effectchance
forceswitch
endmove
Think I need is to put priority -1 movement to work forever.
Looking a solution I try changing the priority like as Quick Attack and Speed Extreme , but there is nothing that gives priority in its effect because it shares the same commands like a Pound or Slam.
Try to find a table with the index number from the attacks that have altered priority sorted according to priority or some other indication and nothing.
Someone can help me to give solution to this problem?
Last edited by Chamber_ (2014-01-03 23:23:13)
Offline
in battle/core.asm:
GetMovePriority: ; 3c5c5
; Return the priority (0-3) of move a.
ld b, a
; Vital throw goes last.
cp VITAL_THROW
ld a, 0
ret z
call GetMoveEffect
ld hl, MoveEffectPriorities
.loop
ld a, [hli]
cp b
jr z, .done
inc hl
cp -1
jr nz, .loop
ld a, 1
ret
.done
ld a, [hl]
ret
; 3c5df
MoveEffectPriorities: ; 3c5df
db EFFECT_PROTECT, 3
db EFFECT_ENDURE, 3
db EFFECT_PRIORITY_HIT, 2
db EFFECT_WHIRLWIND, 0
db EFFECT_COUNTER, 0
db EFFECT_MIRROR_COAT, 0
db -1
; 3c5ec
You can add your new effect id with its associated priority (0) to MoveEffectPriorities. As you can see with Vital Throw, you aren't restricted to using just that table. You can make GetMovePriority return whatever you want.
Offline
Thanks for the prompt reply, I had this doubt from two weeks ago and did not dare to ask jaja
This is the information for use in a HEX editor:
Priority Table of move effect (no index numer of move)
$3c597 G/S
$3C5DF C
0x03 Protect, endure effect (no move index)
0x02 Quick Attack, etc.
0x00 Counter, Mirror Coat, Whirlwind.
Pointer to table
$3C587 G/S
$3C5CF C
Taking this opportunity, I've long wanted to make the effect of U-turn/Volt Switch but I have a problem, the only command available to make the change is to Baton Pass, but if you use it, the stat changes will be passed, so Leech Seeds and the other things to pass the Baton pass.
I dont know much of ASM, but maybe they can help me make a routine/battlecommand simple, which only allows changing a pokemon for other. This is the info that has Baton Pass
BattleCommand67: ; 379c9
; batonpass
ld a, [hBattleTurn]
and a
jp nz, .Enemy
call Function0x37ae9
jp z, Function0x37aab
call UpdateBattleMonInParty
call Function0x37e01
ld c, 50
call DelayFrames
call Function1d6e
callba Function3d2f7
callba Function3d380
call ClearPalettes
callba Function3ed9f
call Function1c17
call ClearSprites
ld hl, $c4a1
ld bc, $040a
call ClearBox
ld b, 1
call GetSGBLayout
call Function32f9
call Function0x37a67
callba Function3d2e0
jp c, EndMoveEffect
ld hl, Function3e459
call CallBankF
call Function0x37ab1
ret
.Enemy
ld a, [IsInBattle]
dec a
jp z, Function0x37aab
call Function0x37af6
jp z, Function0x37aab
call UpdateEnemyMonInParty
call Function0x37e01
call Function0x37a82
callba Function3d2e0
jp c, EndMoveEffect
xor a
ld [$c718], a
ld hl, $5517
call CallBankF
ld hl, $557a
call CallBankF
ld a, 1
ld [$d265], a
ld hl, $6cab
call CallBankF
ld hl, $5c23
call CallBankF
jr Function0x37ab1
; 37a67
Function0x37a67: ; 37a67
ld a, [InLinkBattle]
and a
ret z
ld a, 1
ld [$d0ec], a
call $1d6e
ld hl, $68e4
call CallBankF
call $1c17
xor a
ld [$d0ec], a
ret
; 37a82
Function0x37a82; 37a82
ld a, [InLinkBattle]
and a
ret z
call $1d6e
ld hl, $68e4
call CallBankF
ld a, [OTPartyCount]
add $4
ld b, a
ld a, [$d430]
cp $4
jr c, .asm_37aa0
cp b
jr c, .asm_37aa8
.asm_37aa0
ld a, [CurOTMon]
add $4
ld [$d430], a
.asm_37aa8
jp $1c17
; 37aab
Function0x37aab: ; 37aab
call Function0x37e77
jp PrintButItFailed
; 37ab1
Function0x37ab1: ; 37ab1
ld a, BATTLE_VARS_STATUS
call GetBattleVar
and 7
jr nz, .asm_37ac1
ld a, BATTLE_VARS_SUBSTATUS1
call _GetBattleVar
res 0, [hl]
.asm_37ac1
call Function0x372e7
ld hl, PlayerSubStatus1
res 7, [hl]
ld hl, EnemySubStatus1
res 7, [hl]
ld hl, PlayerSubStatus5
ld a, BATTLE_VARS_SUBSTATUS5
call _GetBattleVar
res 3, [hl]
res 4, [hl]
ld a, BATTLE_VARS_LAST_MOVE
call _GetBattleVar
ld [hl], 0
xor a
ld [$c730], a
ld [$c731], a
ret
; 37ae9
Function0x37ae9: ; 37ae9
ld hl, PartyMon1CurHP
ld a, [PartyCount]
ld d, a
ld a, [CurBattleMon]
ld e, a
jr Function0x37b01
; 37af6
Function0x37af6: ; 37af6
ld hl, OTPartyMon1CurHP
ld a, [OTPartyCount]
ld d, a
ld a, [CurOTMon]
ld e, a
; fallthrough
; 37b01
Function0x37b01: ; 37b01
xor a
ld b, a
ld c, a
.asm_37b04
ld a, c
cp d
jr z, .asm_37b1a
cp e
jr z, .asm_37b11
ld a, [hli]
or b
ld b, a
ld a, [hld]
or b
ld b, a
.asm_37b11
push bc
ld bc, $30
add hl, bc
pop bc
inc c
jr .asm_37b04
.asm_37b1a
ld a, b
and a
ret
; 37b1d
Offline
I had a look at some of the function calls for the batonpass effect. Most of it is just boilerplate to handle switching to the party select menu. The rest is bits and pieces of the Pokemon entrance functions with stat reset stuff taken out. So you'd just replace them with the functions they're based on.
Here's the code again with a few more labels:
BattleCommand67: ; 379c9
; batonpass
ld a, [hBattleTurn]
and a
jp nz, .Enemy
call CheckAnyOtherAlivePartyMons
jp z, FailedBatonPass
call UpdateBattleMonInParty
call AnimateCurrentMove
ld c, 50
call DelayFrames
; Transition into switchmon menu
call Function1d6e
callba Function3d2f7
callba ForcePickSwitchMonInBattle
; Return to battle scene
call ClearPalettes
callba Function3ed9f
call Function1c17
call ClearSprites
hlcoord 1, 0
lb bc, 4, 10
call ClearBox
ld b, 1
call GetSGBLayout
call Function32f9
call Function37a67
; Something to do with mobile link battles
callba Function3d2e0
jp c, EndMoveEffect
ld hl, PassedBattleMonEntrance
call CallBattleCore
call ResetBatonPassStatus
ret
.Enemy
; Wildmons don't have anything to switch to
ld a, [IsInBattle]
dec a
jp z, FailedBatonPass
call CheckAnyOtherAliveEnemyMons
jp z, FailedBatonPass
call UpdateEnemyMonInParty
call AnimateCurrentMove
call Function37a82
; Something to do with mobile link battles
callba Function3d2e0
jp c, EndMoveEffect
; Passed enemy PartyMon entrance
xor a
ld [$c718], a
ld hl, Function3d517
call CallBattleCore
ld hl, Function3d57a
call CallBattleCore
ld a, 1
ld [$d265], a
ld hl, Function3ecab
call CallBattleCore
ld hl, SpikesDamage
call CallBattleCore
jr ResetBatonPassStatus
; 37a67
Fixing the player side is simple. PassedBattleMonEntrance is a trimmed-down BattleMonEntrance (0x3e40b). Call that instead.
The enemy side is messier, since there are different types of enemy entrances. No one bothered to standardize them, so you're left with this ugly block:
; Passed enemy PartyMon entrance
xor a
ld [$c718], a
ld hl, Function3d517
call CallBattleCore
ld hl, Function3d57a
call CallBattleCore
ld a, 1
ld [$d265], a
ld hl, Function3ecab
call CallBattleCore
You can replace it with a call to EnemyPartyMonEntrance (0x3cf78).
Offline
Thanks for the answer but do not understand much of this, I am very new to ASM. Im starting with more simple things that have taught me to do Crystal_ and Miksy91.
You could help me a little more with this, Comet?
I download the "GB Assembler Plus", but not sure how the tags/labels are used.
Another thing, when the game check this, if i dont have pokemon in the party, fails the "change effect" or attack (including damage)?
call CheckAnyOtherAlivePartyMons
jp z, FailedBatonPass
Can I remove this part of the routine or is necessary?
; Something to do with mobile link battles
callba Function3d2e0
jp c, EndMoveEffect
Offline
For casual assembly edits your best bet is bgb. Press Esc to open the debugger. To go to an address, press Ctrl+G and enter bank:address (BattleCommand67 in Gold is at d:7ab7). To modify asm just start typing.
Can I remove this part of the routine or is necessary?
; Something to do with mobile link battles callba Function3d2e0 jp c, EndMoveEffect
You'd never see it without the Mobile Adapter, and it's not in Gold anyway. Here's Gold:
BattleCommand67: ; 37ab7
; batonpass
ld a, [hBattleTurn]
and a
jp nz, .Enemy
.Player
; Need something to switch to
call CheckAnyOtherAlivePartyMons
jp z, FailedBatonPass
call UpdateBattleMonInParty
call AnimateCurrentMove
; Transition into switchmon menu
ld c, 50
call DelayFrames
call Function1be0
callba Function3d224
callba ForcePickSwitchMonInBattle
; Return to battle scene
call ClearPalettes
callba Function3ebd8
call Function1ab4
call ClearSprites
hlcoord 1, 0
lb bc, 4, 10
call ClearBox
ld b, 1
call GetSGBLayout
call Function3546
; Enter BattleMon
call BatonPass_LinkPlayerSwitch
ld hl, PassedBattleMonEntrance
call CallBattleCore
call ResetBatonPassStatus
ret
.Enemy
; Wildmons don't have anything to switch to
ld a, [IsInBattle]
dec a
jp z, FailedBatonPass
; Need something to switch to
call CheckAnyOtherAliveEnemyMons
jp z, FailedBatonPass
call UpdateEnemyMonInParty
call AnimateCurrentMove
; Enter EnemyMon
call BatonPass_LinkEnemySwitch
xor a
ld [$cfb6], a
ld hl, Function3d3d5
call CallBattleCore
ld hl, Function3d438
call CallBattleCore
ld a, 1
ld [$d151], a
ld hl, Function3eae9
call CallBattleCore
ld hl, SpikesDamage
call CallBattleCore
jr ResetBatonPassStatus
; 37b43
If you're having trouble reading, skip over stuff you don't get. It's not important.
Another thing, when the game check this, if i dont have pokemon in the party, fails the "change effect" or attack (including damage)?
call CheckAnyOtherAlivePartyMons jp z, FailedBatonPass
FailedBatonPass: ; 37aab
call AnimateFailedMove
jp PrintButItFailed
; 37ab1
FailedBatonPass doesn't stop the move from executing by itself. Jumping to it just skips the switching part.
BatonPass:
checkobedience
usedmovetext
doturn
batonpass
endmove
Nothing else happens since the whole effect is in the batonpass command.
One more thing. At the end of the enemy part is
jr ResetBatonPassStatus
jr is a relative jump, which only jumps to stuff nearby. If you're jumping from further away you should use jp.
Last edited by comet (2014-01-03 11:16:51)
Offline
I forgot to mention that I'm not editing the Battlecommand Baton Pass, but I'm using the "Battlecommnad3C" marked as unused in document command. I do the repoint in the corresponding data and new addres is $37FA0 (Gold).
Now the problem is that there is not enough space to copy the routine, although I understand that I replace all the "call" to "callba" but for now I leave that part out. What interests me right now is that the effect on the player's turn to work fine.
I replace PassedBattleMonEntrance with BattleMonEntrance (0x3e40b), but does not work well in battle, the screen is reset and change the pallets.
Before...
(...)
ld hl, PassedBattleMonEntrance ; 21 90 62
call CallBattleCore
call ResetBatonPassStatus
ret
After...
(...)
ld hl, BattleMonEntrance ; 21 0B 64
call CallBattleCore
call ResetBatonPassStatus
ret
The move look like this:
VOlt Switch
checkobedience (0x02)
usedmovetext (0x03)
doturn (0x04)
critical (0x05)
damagestats (0x06)
damagecalc (0x62)
stab (0x07)
damagevariation (0x08)
checkhit (0x09)
effectchance (0x90)
hittarget (0xAB)
resulttext (0x0D)
checkfaint (0x0E)
criticaltext (0x0F)
supereffectivetext (0x10)
checkdestinybond (0x11)
buildopponentrage (0x12)
effectchance (0x90)
u-turn (0x3C)
endmove (0xFF)
How you added other labels? is there any program that shows?
Offline
Fixing the player side is simple. PassedBattleMonEntrance is a trimmed-down BattleMonEntrance (0x3e40b). Call that instead.
You can replace it with a call to EnemyPartyMonEntrance (0x3cf78).
I was talking about Crystal. Here's the Gold addresses:
BattleMonEntrance: 0x3e242 (f:6242)
EnemyPartyMonEntrance: 0x3cf1a (f:4f1a)
Offline
How you added other labels? is there any program that shows?
bgb will try to read a symfile that has the same name as the rom.
If your rom was called gold.gbc, you would put the following into a text file named gold.sym:
0:033C DelayFrames
0:0EBD ClearBox
0:30FF ClearSprites
0:3564 ClearPalettes
0:3583 GetSGBLayout
0:3BC0 UpdateBattleMonInParty
0:3BD4 UpdateEnemyMonInParty
D:7AB7 BattleCommand67
D:7B0A BattleCommand67.Enemy
D:7B6F FailedBatonPass
D:7B75 ResetBatonPassStatus
D:7BAD CheckAnyOtherAlivePartyMons
D:7BBA CheckAnyOtherAliveEnemyMons
D:7ECC AnimateCurrentMove
D:7F3E CallBattleCore
F:4F1A EnemyPartyMonEntrance
F:528F ForcePickSwitchMonInBattle
F:5A84 SpikesDamage
F:6242 BattleMonEntrance
F:6290 PassedBattleMonEntrance
Then bgb would use those labels instead of their addresses. You can use labels when editing asm. Goto will accept labels and registers (pc is the most helpful).
The asm output will look nicer as well:
ROMD:7AB7 F0 E6 ld a,(ff00+E6)
ROMD:7AB9 A7 and a
ROMD:7ABA C2 0A 7B jp nz,7B0A
ROMD:7ABD CD AD 7B call 7BAD
ROMD:7AC0 CA 6F 7B jp z,7B6F
ROMD:7AC3 CD C0 3B call 3BC0
ROMD:7AC6 CD CC 7E call 7ECC
ROMD:7AC9 0E 32 ld c,32
ROMD:7ACB CD 3C 03 call 033C
ROMD:7ACE CD E0 1B call 1BE0
...
to
BattleCommand67: (7AB7) ld a,(ff00+E6)
0D:7AB9 and a
0D:7ABA jp nz,BattleCommand67.Enemy
0D:7ABD call CheckAnyOtherAlivePartyMons
0D:7AC0 jp z,FailedBatonPass
0D:7AC3 call UpdateBattleMonInParty
0D:7AC6 call AnimateCurrentMove
0D:7AC9 ld c,32
0D:7ACB call DelayFrames
0D:7ACE call 1BE0
...
Symfiles are generated automatically by rgbds, the assembler used to compile the Pokemon Red and Crystal disassemblies.
Offline
That's what I thought, that the addresses were of Crystal. in any case, I modify the data and continues to fail, the only thing that happens when using the attack is hitting, you hear a sound and the screen freezes.
This is the data that I insert in battlecommand3c:
BattleCommand3c: ; 37FA0
; U-turn
; Pointer in a pointer table of battle commands 3FDB3
; New Pointer data [A07F]
ld a, [hBattleTurn] ; F0 E6
and a ; A7
jp nz, .Enemy ; C2 0A 7B
.Player ; Need something to switch to
call CheckAnyOtherAlivePartyMons ; CD AB 7B
jp z, FailedBatonPass ; CA 6F 7B
call UpdateBattleMonInParty ; CD C0 3B
call AnimateCurrentMove ; CD CC 7E
; Transition into switchmon menu
ld c, 50 ; 0E 32
call DelayFrames ; CD 3C 03
call Function1be0 ; CD E0 1B
callba Function3d224 ; 3E 0F 21 24 52 CF
callba ForcePickSwitchMonInBattle ; 3E 0F 21 8F 52 CF
; Return to battle scene
call ClearPalettes ; CD 64 35
callba Function3ebd8 ; 3E 0F 21 D8 6B CF
call Function1ab4 ; CD B4 1A
call ClearSprites ; CD FF 30
hlcoord 1, 0 ; 21 A1 C3
lb bc, 4, 10 ; 01 0A 04
call ClearBox ; CD BD 0E
ld b, 1 ; 06 01
call GetSGBLayout ; CD 83 35
call Function3546 ; CD 46 35
; Enter BattleMon
call BatonPass_LinkPlayerSwitch ; CD 43 7B
ld hl, PassedBattleMonEntrance ; 21 90 62 -> 21 42 62
call CallBattleCore ; CD 3E 7F
call ResetBatonPassStatus ; CD 75 7B
ret ; C9
Offline
call CheckAnyOtherAlivePartyMons ; CD AB 7B
should be CD BA 7B
Offline
OK, that has already run the routine, but now the problem is that the move hurt but the effect does not apply to "change" (the sign "but it failed" appears).
I must say that I have two pokemon in the party. Now that may be?
Offline
Whoops I assumed you meant BA and not AD.
D:7BAD CheckAnyOtherAlivePartyMons
D:7BBA CheckAnyOtherAliveEnemyMons
Offline
I change it and it worked!!!!
But now another thing jajajaja
When I chose the second pokemon in my party, the pokemon that comes to battle is the same that use u-turn....
Suggestions...
Offline
BattleMonEntrance:
...
ld a, [CurBattleMon]
ld [CurPartyMon], a
...
PassedBattleMonEntrance:
...
ld a, [CurPartyMon]
ld [CurBattleMon], a
...
ForcePickSwitchMonInBattle updates CurPartyMon only. To fix that, set CurBattleMon to CurPartyMon before calling BattleMonEntrance. This shouldn't be a problem for the enemy.
Offline
Everything went well, but now it does not load the name of the new pokemon jjaja
Offline
I only Return to give thanks to @comet
Everything went great and the error that I had with name was a syntax error.
Saludos!
Offline
Pages: 1