Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#1 2014-12-22 06:59:40

daMoose52
Member
Registered: 2014-11-14
Post 20/108
Website

R/B Scripting; Transplanting initial OAK interaction...

I'm transplanting the initial OAK encounter so its not at the edge of Pallet Town, but rather in Oak's lab (the player's room warps instead to OAK's lab, not the 1st floor for the player's house).
The event triggers just fine (when the player leaves to exit the space) with the slight hiccup except that if moving fast enough/not relenting on the directional you can warp out without triggering the event. Not an issue right now, but provides insight into it.
I combed through the house levels and Pallet Town for the flags that are triggered, made a function in the player's bedroom to set those triggers right off the bat, and test it out.

- When I enter the LAB level, all NPCs are there as appropriate, deliver proper scripts.
- When I go to exit the lab, the event triggers as appropriate, the NPC approaches me (new steps in the NPC movement) and retreats, disappears as it should.
- When the game takes control of the player sprite, about 1/2 the time the character does not approach the new NPC instance fully but is a step off. The Rival sprite is missing, but the script executes from there as appropriate, I can interact with the OAK-NPC who is visible, I can interact with the pokeballs, attempt to leave, and pick a monster and have the "rival" pick a monster (though the sprite is MIA). When I do go to leave, the Rival sprite approaches from the lower left corner of the map and essentially walks into a bookcase.

- Now, what's also interesting, is the two cases that happen when I DO leave the lab and return:
The first the script functions perfectly. No issues what so ever.
The second, the script *appears* to be working correctly, all sprites are present, and all of the actions take place, but there's a LOT of garbage on the screen between the text boxes. I can otherwise carry out the rest of the script.
About half of that time, if I attempt to leave, the game locks up.

Code is as follows:
RedsHouse_2f

RedsHouse2FScript: ; 5c0b0 (17:40b0)
    ld a,[wd74b] ;Load memory address
    bit 4,a ;Check a bit, see if its set
    jr z,.next ;If its not (start of the game essentially) jump ahead
    jr _InitialBitSets
.next
    call EnableAutoTextBoxDrawing
    ld hl,RedsHouse2FScriptPointers
    ld a,[W_REDSHOUSE2CURSCRIPT]
    jp CallFunctionInTable

_InitialBitSets:
       ld hl,wd747
       set 6,[hl]
       ld hl,wd74a
       set 2,[hl]
       ld hl,wd74b
       set 4,[hl]
       set 6,[hl]
       set 7,[hl]
       ret

OaksLab (just added the bit to the OaksLabScript0 right now)

OaksLabScript0: ; 1cb4e (7:4b4e)
     ld a,[wd747]
     bit 0,a
     ret nz
    ;New OAK Event Code
    ld a,[W_YCOORD] ;load player y coord
    cp 11        ;compare, 11
    ret nz
    ld a,[W_XCOORD]    ;load player x coord
    cp 4        ;equal to, 4
    jr z,.next
    cp 5        ;equal to, 5
    jr z,.next
    ret
.next    ;jump here if it is a proper tile

    ld a, [wNPCMovementScriptFunctionNum]
    and a
    ret nz
    ld a, HS_OAKS_LAB_OAK_2
    ld [wcc4d], a
    predef ShowObject
    ld hl, wd72e
    res 4, [hl]

    ld a, $1
    ld [W_OAKSLABCURSCRIPT], a
    ret

Pokemon: Project Neo A Pokemon hack 15 years in the making...

Offline

Board footer

Powered by FluxBB