• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Other] How to add more priority attacks in Gen 1?

  • 6
    Posts
    11
    Years
    • Seen Sep 12, 2016
    I'm currently editing with pokered and thought creating priority moves will be as easy as going into data\moves.asm and giving other moves the same effect as Quick Attack, but Quick Attack has no addition effect, instead its programming is found in engine\battle\core.asm lines 460 to 470 and I'm not sure what to do.

    Suppose I wanted to include moves like Swift, Water Gun and Thunder Punch as priority attacks that allowed the Player/CPU to attack first, how would I go about this?
     
    In order to add more priority attacks, an inelegant solution would be rather simple.

    Starting at line 460, the original code is as follows. Note that we will need to modify the lines beyond 470 for full functionality.
    Code:
    	ld a, [wPlayerSelectedMove]
    	cp QUICK_ATTACK
    	jr nz, .playerDidNotUseQuickAttack
    	ld a, [wEnemySelectedMove]
    	cp QUICK_ATTACK
    	jr z, .compareSpeed  ; if both used Quick Attack
    	jp .playerMovesFirst ; if player used Quick Attack and enemy didn't
    .playerDidNotUseQuickAttack
    	ld a, [wEnemySelectedMove]
    	cp QUICK_ATTACK
    	jr z, .enemyMovesFirst ; if enemy used Quick Attack and player didn't
    	ld a, [wPlayerSelectedMove]
    	cp COUNTER
    	jr nz, .playerDidNotUseCounter
    	ld a, [wEnemySelectedMove]
    	cp COUNTER
    	jr z, .compareSpeed ; if both used Counter
    	jr .enemyMovesFirst ; if player used Counter and enemy didn't

    In order to add more priority moves, we simply need to add more comparisons. It's not a great solution but it should work. For example:
    Code:
    	; see next post for working code

    Like I said, inelegant but it should work. Untested, so let me know if it does. :) A better solution could include modifying the move data to include a field for priority or creating a table of priority moves to check against.
     
    Last edited:
    Thanks for the help Lost, although your code had a error, it gave me an idea of how to do it.

    In your code you wrote if I did not use Quick Attack then I did not use a priority move and jump straight to .playerDidNotUsePriority so Swift would fail to gain priority.

    Code:
            ld a, [wPlayerSelectedMove]
    	cp QUICK_ATTACK
    	jr nz, .playerDidNotUsePriority
    	ld a, [wPlayerSelectedMove] ; I included another ld a of the player move
    	cp SWIFT ; because I can't remember if cp modifies a or not
    	jr nz, .playerDidNotUsePriority

    So I worded it a bit differently.
    Code:
    .noLinkBattle	
    	; check to see if player used a priority move
    	ld a, [wPlayerSelectedMove]
    	cp QUICK_ATTACK
    	jp z, .playerDidUsePriorityMove
    	ld a, [wPlayerSelectedMove]
    	cp SWIFT
    	jp z, .playerDidUsePriorityMove
    	ld a, [wPlayerSelectedMove]
    	cp THUNDERPUNCH
    	jp z, .playerDidUsePriorityMove
    	ld a, [wPlayerSelectedMove]
    	cp WATER_GUN
    	jp z, .playerDidUsePriorityMove
    	; if player did not use a priority move then check to see if opponent did
    	ld a, [wEnemySelectedMove]
    	cp QUICK_ATTACK
    	jp z, .enemyMovesFirst
    	ld a, [wEnemySelectedMove]
    	cp SWIFT
    	jp z, .enemyMovesFirst
    	ld a, [wEnemySelectedMove]
    	cp THUNDERPUNCH
    	jp z, .enemyMovesFirst
    	ld a, [wEnemySelectedMove]
    	cp WATER_GUN
    	jp z, .enemyMovesFirst
    	; if neither used a priority move check to see if player used Counter
    	ld a, [wPlayerSelectedMove]
    	cp COUNTER
    	jr nz, .playerDidNotUseCounter
    	ld a, [wEnemySelectedMove]
    	cp COUNTER
    	jr z, .compareSpeed ; if both used Counter
    	jr .enemyMovesFirst ; if player used Counter and enemy didn't
    .playerDidUsePriorityMove	
    	;if player did use a priority move then check to see if opponent did
    	ld a, [wEnemySelectedMove]
    	cp QUICK_ATTACK
    	jr z, .compareSpeed
    	ld a, [wEnemySelectedMove]
    	cp SWIFT
    	jr z, .compareSpeed
    	ld a, [wEnemySelectedMove]
    	cp THUNDERPUNCH
    	jr z, .compareSpeed
    	ld a, [wEnemySelectedMove]
    	cp WATER_GUN
    	jr z, .compareSpeed
    	jr .playerMovesFirst ; if enemy didn't use a prioirity move

    I've tested it and it seems to be working fine so far. I wouldn't of known what to do without your help so thanks again.
     
    Back
    Top