You are not logged in.
Pages: 1
I'm working on more of my intro script and tightening up some of the "story" elements. Goal is this:
- On arriving in Oak's lab from a stairwell on the far right (right on warping in then), the player is called out to by a lab tech near the stairs who has turned to face him;
- The player advances one space toward the lab tech, and the characters turn to face each other
- The lab tech gives a short set of text boxes about how he hasn't seen Oak, could the player go looking for him.
- It then sets a flag which switches the dialog to a simple "Any luck?"
Here is my set of scripts:
OaksLabScript_ConcernedAide_1: ;Load text for "PLAYER!"
ld a, $28
ld [$ff8c], a
call DisplayTextID
call Delay3
ld a, $14 ;Load ConceredAide_2
ld [W_OAKSLABCURSCRIPT],a
OaksLabScript_ConcernedAide_2: ;move player forward...
ld a, $1
ld [wSimulatedJoypadStatesIndex], a
ld a, D_LEFT
ld [wSimulatedJoypadStatesEnd], a
call StartSimulatingJoypadStates
ld a, PLAYER_DIR_LEFT
ld [wd528], a
ld a, $16 ;Load Movement toward NPC
ld [W_OAKSLABCURSCRIPT],a
OaksLabScript_ConcernedAide_3: ;Interact with Player...
ld a, $0a
ld [H_SPRITEINDEX], a
xor a
ld [$ff8d], a
call SetSpriteFacingDirectionAndDelay
call UpdateSprites
ld a, PLAYER_DIR_UP
ld [wd528], a
call SetSpriteFacingDirectionAndDelay
call UpdateSprites
ld a, $0a ;Load Text for "I haven't seen Oak..."
ld [$ff8c], a
call DisplayTextID
CheckAndSetEvent EVENT_SENT_TO_LOOK
ld a, $0 ;Return to normal script flow...
ld [W_OAKSLABCURSCRIPT],a
OaksLabScript_ConcernedAide_MovePlayer: ;move player forward...
ld a, [wSimulatedJoypadStatesIndex]
and a
ret nz
call Delay3
ld a, $15 ;Load ConcernedAide3
ld [W_OAKSLABCURSCRIPT], a
ret
Script 0 looks for the EVENT_SENT_TO_LOOK flag when you warp in to trigger the event. That works perfectly.
The initial text triggers perfectly, but does not appear in a text box.
The tech sprite is in the upper left hand corner of the screen (and if I am right, this is a symptom of not even being on the map yet)
The script does not advance the player sprite until after the whole "script" has executed...
The script does not even load the new text after the player exclamation, but does set the flag for the EVENT_SENT_TO_LOOK, which is at the end of that scripting segment.
The player sprite and NPC sprite DO get set properly amidst the script where they are supposed to.
Looking for any thoughts, tips, pointers, ideas on scripting structure. I emulated the structure as best it made sense to me from other scripts, separated the movement from the text more, loops to check if the character was in movement, etc.
Pokemon: Project Neo A Pokemon hack 15 years in the making...
Offline
Sorting some of the scripting out and getting the bug fixed/elements working according to plan.
One issue bugging me now is that the Aide sprite that should appear near the steps instead still appears in the upper left hand corner and then pops into place after the first script has run. Any thoughts?
Pokemon: Project Neo A Pokemon hack 15 years in the making...
Offline
This reminds me a little of the issues that came up when I was trying to help Fotomac put some scripted Phone Calls into the game that ran as soon as you entered the map. May or may not find anything useful looking through this thread.
I am not very active on this forum. I only pop in from time to time.
Online
Afraid no, at least not at first glance; it would have helped had I not gotten my movement and text scripts working out already so thanks for the pointer :D
But yea, the only thing sucking now is that sprite. Its like the sprite isn't loaded to the map yet when the script attempts to run.
Pokemon: Project Neo A Pokemon hack 15 years in the making...
Offline
I did try something "new" on this iteration; I identified where I made a couple little mistakes in the code and corrected those and reinserted some elements I had commented out or deleted. This appears to have fixed the sprite appearance issue as well, forcing the script to do something with the sprite right away. I'm totally cool with that, as its what I wanted anyway. SO, here's the functioning set of scripts:
OaksLabScript_ConcernedAide_1: ;Load text for "PLAYER!"
ld a, $0a ;Load Oak's Aide
ld [H_SPRITEINDEX], a
ld a, $C0 ;Set facing, Right
ld [$ff8d], a
ld a, PLAYER_DIR_LEFT ;Set Player Facing, Left
ld [wd528], a
call SetSpriteFacingDirectionAndDelay
call UpdateSprites
ld a, $28
ld [$ff8c], a
call DisplayTextID
call Delay3
ld a, $14 ;Load ConceredAide_2
ld [W_OAKSLABCURSCRIPT],a
ret
OaksLabScript_ConcernedAide_2: ;move player forward...
call Delay3
ld a, $1
ld [wSimulatedJoypadStatesIndex], a
ld a, D_LEFT
ld [wSimulatedJoypadStatesEnd], a
call StartSimulatingJoypadStates
ld a, PLAYER_DIR_LEFT
ld [wd528], a
ld a, $15 ;Load Movement toward NPC
ld [W_OAKSLABCURSCRIPT],a
ret
OaksLabScript_ConcernedAide_3: ;Interact with Player...
ld a, $0a
ld [H_SPRITEINDEX], a
xor a
ld [$ff8d], a
ld a, PLAYER_DIR_UP
ld [wd528], a
call SetSpriteFacingDirectionAndDelay
call UpdateSprites
ld a, $0a ;Load Text for "I haven't seen Oak..."
ld [$ff8c], a
call DisplayTextID
ld a, $0 ;Return to normal script flow...
ld [W_OAKSLABCURSCRIPT],a
ret
Pokemon: Project Neo A Pokemon hack 15 years in the making...
Offline
Well, kinda scratch that; he doesn't face to the right always :D Gotta see what's causing that; otherwise, he appears in the right spot, says the right stuff, and triggers all the right flags~ Now its just a matter of adding the next script: initiating a conversation with the Aide after the first battle & triggering the Pokeball event :D
Pokemon: Project Neo A Pokemon hack 15 years in the making...
Offline
Movement is my bane it seems...
Still can't get the facing right on a regular basis. But that script executes appropriately.
New script, copies the Give Pokeball script. It works just fine on its own; I want the Aid sprite to approach the hero though. I got THAT working on its own, but then it locks up the text when it does and won't proceed past the first set of lines...
OaksLabScript18: ; 1d009 (7:5009)
;Test for Pokeball Script
CheckEvent EVENT_GOT_POKEBALLS_FROM_OAK
ret nz
;Test for Y coordinate...
ld a, [W_YCOORD]
cp $8
ret nz
;Stop the Player
;Load Aide Sprite
ld a, $0a ;Load Oak's Aide
ld [H_SPRITEINDEX], a
ld de, AidMovement_1
ld a, [W_XCOORD]
cp $5
jp z, .runScript
ld de, AidMovement_2
.runScript
call MoveSprite
ld a, $16
ld [W_OAKSLABCURSCRIPT], a
ret
AidMovement_1:
db $80,$80,$FF
AidMovement_2:
db $80,$80,$80,$FF
OaksLabScript18a:
ld a, [wd730]
bit 0, a
ret nz
;Run Text Script OaksLab43
ld a, $29
ld [$ff8c], a
call DisplayTextID
;Step aside from player...
;Default Null script...
ld a, $12
ld [W_OAKSLABCURSCRIPT], a
ret
OaksLabText43:
db $08
ld hl, OaksLabAidePokeballText_1
call PrintText
ld bc, (POKE_BALL << 8) | 5
call GiveItem
ld hl, OaksLabAidePokeballText
call PrintText
ld hl, OaksLabAidePokeballText_2
call PrintText
.OaksLabText43a ; 0x1d2e7
ld hl, OaksLabAidPleaseVisitText
call PrintText
jp TextScriptEnd
OaksLabAidePokeballText_1:
TX_FAR _OaksAidPokeballText_1
db "@"
OaksLabAidePokeballText:
TX_FAR _OaksLabGivePokeballsText1
db "@"
OaksLabAidePokeballText_2:
TX_FAR _OaksAidPokeballText
db "@"
OaksLabAidPleaseVisitText:
TX_FAR _OaksAidPleaseVisitText
db "@"
Pokemon: Project Neo A Pokemon hack 15 years in the making...
Offline
Ah ha; it wasn't always with other movement/text scripts, it may have been in a later script in a sequence so I missed it.
Dropping this here so its useful for anyone encountering similar:
ld a, [wd730]
bit 0, a
ret nz ;Is an NPC moving or no? If so, return so it loops until finished
ld a, $fc
ld [wJoyIgnore], a ;Allow player input after moving an NPC, ignore joystick
;Do stuff in a script here...
xor a
ld [wJoyIgnore], a ;Restore full player control after the script
Now the relatively minor (though my experience probably more difficult) task of getting the script to behave properly on giving an item. It gives the item but does not do the whole sound effect routine, it just cruises through the "PLAYER got 5 Poke Balls!" text and into the next message...
Last edited by daMoose52 (2016-05-05 15:05:10)
Pokemon: Project Neo A Pokemon hack 15 years in the making...
Offline
Maybe this will help: https://github.com/TheFakeMateo/RedPlus … 4d07a73c97
I am not very active on this forum. I only pop in from time to time.
Online
Pages: 1