Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#1 2016-08-10 11:20:20

pepitopon
Member
Registered: 2016-07-25
Post 22/38

Leaving trainer script

Hi!

I'm working with Pokered, and i'm trying to make a script of a leaving trainer when he is defeated. It can be seen on Pokemon Tower 7th floor (3 rockets). which are the important parts? Please forgive me, im really newbie in scripts. 

This is the script im trying to change to suit to another map:

PokemonTower7Script: ; 60d05 (18:4d05)
    call EnableAutoTextBoxDrawing
    ld hl, PokemonTower7TrainerHeaders
    ld de, PokemonTower7ScriptPointers
    ld a, [W_POKEMONTOWER7CURSCRIPT]
    call ExecuteCurMapScriptInTable
    ld [W_POKEMONTOWER7CURSCRIPT], a
    ret

PokemonTower7Script_60d18: ; 60d18 (18:4d18)
    xor a
    ld [wJoyIgnore], a
    ld [W_POKEMONTOWER7CURSCRIPT], a
    ld [W_CURMAPSCRIPT], a
    ret

PokemonTower7ScriptPointers:
    dw CheckFightingMapTrainers
    dw DisplayEnemyTrainerTextAndStartBattle
    dw PokemonTower7Script2
    dw PokemonTower7Script3
    dw PokemonTower7Script4

PokemonTower7Script2: ; 60d23 (18:4d23)
    ld hl, wFlags_0xcd60
    res 0, [hl]
    ld a, [W_ISINBATTLE] ; W_ISINBATTLE
    cp $ff
    jp z, PokemonTower7Script_60d18
    call EndTrainerBattle
    ld a, $f0
    ld [wJoyIgnore], a
    ld a, [wSpriteIndex]
    ld [H_DOWNARROWBLINKCNT2], a ; $ff8c
    call DisplayTextID
    call PokemonTower7Script_60db6
    ld a, $3
    ld [W_POKEMONTOWER7CURSCRIPT], a
    ld [W_CURMAPSCRIPT], a
    ret

PokemonTower7Script3: ; 60d56 (18:4d56)
    ld a, [wd730]
    bit 0, a
    ret nz
    ld hl, W_MISSABLEOBJECTLIST
    ld a, [wSpriteIndex]
    ld b, a
.missableObjectsListLoop
    ld a, [hli]
    cp b            ; search for sprite ID in missing objects list
    ld a, [hli]
    jr nz, .missableObjectsListLoop
    ld [wcc4d], a   ; remove missable object
    predef HideObject
    xor a
    ld [wJoyIgnore], a
    ld [wSpriteIndex], a
    ld [wTrainerHeaderFlagBit], a
    ld [wda38], a
    ld a, $0
    ld [W_POKEMONTOWER7CURSCRIPT], a
    ld [W_CURMAPSCRIPT], a
    ret

PokemonTower7Script4: ; 60d86 (18:4d86)       I THINK THIS PART IS FOR MR. FUJI SO I DONT NEED THIS.
    ld a, $ff
    ld [wJoyIgnore], a
    ld a, HS_POKEMONTOWER_7_MR_FUJI
    ld [wcc4d], a
    predef HideObject
    ld a, $4
    ld [wSpriteStateData1 + 9], a
    ld a, LAVENDER_HOUSE_1
    ld [H_DOWNARROWBLINKCNT1], a ; $ff8b
    ld a, $1
    ld [wDestinationWarpID], a
    ld a, LAVENDER_TOWN
    ld [wLastMap], a
    ld hl, wd72d
    set 3, [hl]
    ld a, $0
    ld [W_POKEMONTOWER7CURSCRIPT], a
    ld [W_CURMAPSCRIPT], a
    ret

PokemonTower7Script_60db6: ; 60db6 (18:4db6)
    ld hl, CoordsData_60de3 ; $4de3
    ld a, [wSpriteIndex]
    dec a
    swap a
    ld d, $0
    ld e, a
    add hl, de
    ld a, [W_YCOORD] ; wd361
    ld b, a
    ld a, [W_XCOORD] ; wd362
    ld c, a
.asm_60dcb
    ld a, [hli]
    cp b
    jr nz, .asm_60dde
    ld a, [hli]
    cp c
    jr nz, .asm_60ddf
    ld a, [hli]
    ld d, [hl]
    ld e, a
    ld a, [wSpriteIndex]
    ld [H_DOWNARROWBLINKCNT2], a ; $ff8c
    jp MoveSprite
.asm_60dde
    inc hl
.asm_60ddf
    inc hl
    inc hl
    jr .asm_60dcb

CoordsData_60de3: ; 60de3 (18:4de3)
    db $0C,$09
    dw MovementData_60e13
    db $0B,$0A
    dw MovementData_60e1b
    db $0B,$0B
    dw MovementData_60e22
    db $0B,$0C
    dw MovementData_60e22
    db $0A,$0C
    dw MovementData_60e28
    db $09,$0B
    dw MovementData_60e30
    db $09,$0A
    dw MovementData_60e22
    db $09,$09
    dw MovementData_60e22
    db $08,$09
    dw MovementData_60e37
    db $07,$0A
    dw MovementData_60e22
    db $07,$0B
    dw MovementData_60e22
    db $07,$0C
    dw MovementData_60e22

MovementData_60e13: ; 60e13
    db $C0,$00,$00,$00,$00,$00,$80,$FF

MovementData_60e1b: ; 60e1b
    db $00,$C0,$00,$00,$00,$00,$FF

MovementData_60e22: ; 60e22
    db $00,$00,$00,$00,$00,$FF

MovementData_60e28: ; 60e28
    db $80,$00,$00,$00,$00,$00,$00,$FF

MovementData_60e30: ; 60e30
    db $00,$00,$00,$80,$00,$00,$FF

MovementData_60e37: ; 60e37
    db $C0,$00,$00,$00,$00,$00,$00,$FF

Last edited by Danny-E 33 (2016-08-11 00:44:32)

Offline

#2 2016-08-11 01:01:05

Danny-E 33
Administrator
Registered: 2012-06-09
Post 973/1,031

Re: Leaving trainer script

I edited your post and put the code in a [­code][­/code] block, but it really wasn't necessary for you to copy/paste the whole script.

Also, you are using a version of pokered that is at least a year old or more. If you can, you should update your repo with the updates to pokered.
things like 'W_CURMAPSCRIPT' became 'wCurMapScript' over a year ago, which means you're missing all the updates since then.


Red Hack: Pokémon Prototype

Total number of registered users: 8000+
Total number of active users: ~12

Offline

Board footer

Powered by FluxBB