Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#626 2019-04-28 09:59:23

KeiTaRo
Member
Registered: 2015-12-05
Post 71/71
Website

Re: Simple Questions & Answers

Explosion and Selfdestruct are the only two attacks that still play an animation even if they miss. I know the code for this is in core.asm in Pokered, but I cannot seem to locate it for the life of me in Crystal (exhausting obvious options such as searching for instances of the move names, etc) Anyone have a clue?

Offline

#627 2019-09-04 16:13:00

SteppoBlazer
Member
Registered: 2019-09-04
Post 1/16

Re: Simple Questions & Answers

I've got an issue with the current commit I pushed to my repo, basically it allows for shiny mons in the wild and it seems to work just fine, what I'm trying to figure out is how to assing to each mon a specific shiny palette instead of having those that my commit uses. Tho I'm having and hard time figuring out how to achive such. My repo for reference https://github.com/SteppoBlazer/pokespa … 50d7aba917

Offline

#628 2019-09-15 23:39:05

Azure_Keys
Member
Registered: 2017-10-05
Post 51/64

Re: Simple Questions & Answers

I'm trying to understand the routine that animates the Magnet Train, and I can't find where it determines the source tilesets to use for the train and background. I understand how it's loading the tilemaps, but I can't find where it's actually determining to use the tiles from train_station.png, for example. Thanks.

Offline

#629 2019-09-16 00:37:01

Mateo
Member
Registered: 2009-11-25
Post 3,629/3,652

Re: Simple Questions & Answers

Looking at it, the best I can tell is that it doesn't actually load those tiles itself, because it has no reason to -- it is only ever called when you are in a train station map, so the train station tileset is already loaded. It's certainly possible that I'm missing something, though. Have you tried calling it from a map with a different tileset to see what happens?

Last edited by Mateo (2019-09-16 00:38:26)


I am not very active on this forum. I only pop in from time to time.

Offline

#630 2019-09-16 02:38:16

Azure_Keys
Member
Registered: 2017-10-05
Post 52/64

Re: Simple Questions & Answers

Mateo wrote:

Looking at it, the best I can tell is that it doesn't actually load those tiles itself, because it has no reason to -- it is only ever called when you are in a train station map, so the train station tileset is already loaded. It's certainly possible that I'm missing something, though. Have you tried calling it from a map with a different tileset to see what happens?

You know, I didn't think of that. I'll test it out and see what happens. I'm planning to try and re-use most of the routine with a different tilemap to make a boat-riding cutscene. Thanks.

Offline

#631 2019-09-24 02:51:31

Azure_Keys
Member
Registered: 2017-10-05
Post 56/64

Re: Simple Questions & Answers

Mateo wrote:

Looking at it, the best I can tell is that it doesn't actually load those tiles itself, because it has no reason to -- it is only ever called when you are in a train station map, so the train station tileset is already loaded. It's certainly possible that I'm missing something, though. Have you tried calling it from a map with a different tileset to see what happens?

This worked, by the way. Though the scene seemed to have trouble loading tiles with IDs above 7F. Either way, I got it working, so thanks!

Offline

#632 2019-09-24 03:10:35

Mateo
Member
Registered: 2009-11-25
Post 3,630/3,652

Re: Simple Questions & Answers

Azure_Keys wrote:
Mateo wrote:

Looking at it, the best I can tell is that it doesn't actually load those tiles itself, because it has no reason to -- it is only ever called when you are in a train station map, so the train station tileset is already loaded. It's certainly possible that I'm missing something, though. Have you tried calling it from a map with a different tileset to see what happens?

This worked, by the way. Though the scene seemed to have trouble loading tiles with IDs above 7F. Either way, I got it working, so thanks!

No problem, glad I could help.


I am not very active on this forum. I only pop in from time to time.

Offline

#633 2019-12-17 21:51:28

NobodySociety
Member
Registered: 2018-07-26
Post 25/28

Re: Simple Questions & Answers

Hiya! I was wondering if the constant "JOHTO_POKEMON" was of some kind of significance in pokecrystal? I'm working on a project with a new region, so I don't necessarily need a distinction like that, but according to the code its used in engine\gfx\pic_animation.asm as frame pointers.

Offline

#634 2020-05-16 07:02:48

noobimodder
Member
Registered: 2020-05-16
Post 1/10

Re: Simple Questions & Answers

I hope it's ok to post here. How do I change the starting location in pokered?
Like you start in RedsHouse2F normally. How do I change that?

Offline

#635 2020-05-16 18:19:00

Danny-E 33
Administrator
Registered: 2012-06-09
Post 1,176/1,188

Re: Simple Questions & Answers

It's definitely okay to post here
The initial map ID and initial coordinates are specified in data/special_warps.asm in the entry called "FirstMapSpec"

Offline

#636 2020-05-18 06:35:58

noobimodder
Member
Registered: 2020-05-16
Post 2/10

Re: Simple Questions & Answers

Thanks, that worked like a charm!
Now I was wondering if there are any tutorials for adding new NPCs? I tried adding one to my home town, and it shows up on a map editor, but when I compile the game it doesn't appear

Edit!
When I was editing map connections and adding new maps, he suddenly appeared. But he's scrolling up and down the screen all glitch-like.
I'm not sure what the bbcode is to display code nicely formatted so I'll just post this here and hope its fine...

PalletTown_Object:
    db $b ; border block

    db 4 ; warps
    warp 5, 7, 0, REDS_HOUSE_1F
    warp 11, 11, 0, BLUES_HOUSE
    warp 15, 3, 1, OAKS_LAB
    warp 10, 3, 2, UNOWN_CAVE

    db 3 ; signs
    sign 5, 11, 4 ; PalletTownText4
    sign 9, 5, 5 ; PalletTownText5
    sign 17, 5, 6 ; PalletTownText6

    db 3 ; objects
    object SPRITE_BUG_CATCHER, 1, 8, STAY, UP, 8 ; person
    object SPRITE_GIRL, 4, 3, WALK, 0, 2 ; person
    object SPRITE_FISHER2, 16, 14, WALK, 0, 3 ; person

    ; warp-to
    warp_to 5, 7, PALLET_TOWN_WIDTH ; REDS_HOUSE_1F
    warp_to 11, 11, PALLET_TOWN_WIDTH ; BLUES_HOUSE
    warp_to 15, 3, PALLET_TOWN_WIDTH ; OAKS_LAB
    warp_to 10, 3, PALLET_TOWN_WIDTH ; UNOWN_CAVE

Last edited by Danny-E 33 (2020-05-18 19:31:04)

Offline

#637 2020-05-18 19:38:32

Danny-E 33
Administrator
Registered: 2012-06-09
Post 1,177/1,188

Re: Simple Questions & Answers

I fixed the bbcode for you.

In this case I suspect the problem is that Pallet Town's script does a lot of custom funny business with NPC #0 (Oak). So by replacing him with a Bug Catcher and changing his movement properties, he is unlikely to behave correctly.

Offline

#638 2020-05-20 10:35:51

noobimodder
Member
Registered: 2020-05-16
Post 3/10

Re: Simple Questions & Answers

I know this is a tall order, but I think it would be best to get help instead of stumbling around in the dark. I want to create a guard script that won't let the player pass until a flag is met. I tried looking at the old man code from Viridian city but Viridian city's scripts are kind of confusing, so instead I began looking at the Route 7 gate script. I would just like this code explained to me, like the weird numbers(wd728, 1e111, etc.) And if its possible, how could I decipher their meaning on my own?

Route7GateScript_1e111:
    ld hl, wd730
    set 7, [hl]
    ld a, $20
    ld [wSimulatedJoypadStatesEnd], a
    ld a, $1
    ld [wSimulatedJoypadStatesIndex], a
    xor a
    ld [wSpriteStateData2 + $06], a
    ld [wOverrideSimulatedJoypadStatesMask], a
    ret

Route7GateScript0:
    ld a, [wd728] 
    bit 6, a
    ret nz
    ld hl, CoordsData_1e167
    call ArePlayerCoordsInArray 
    ret nc
    ld a, PLAYER_DIR_UP
    ld [wPlayerMovingDirection], a 
    xor a
    ld [hJoyHeld], a
    callba RemoveGuardDrink
    ld a, [$ffdb] 
    and a
    jr nz, .asm_1e15a 
    ld a, $2
    ld [hSpriteIndexOrTextID], a
    call DisplayTextID 
    call Route7GateScript_1e111 
    ld a, $1 
    ld [wRoute7GateCurScript], a 
    ret
.asm_1e15a
    ld a, $3
    ld [hSpriteIndexOrTextID], a
    call DisplayTextID
    ld hl, wd728 
    set 6, [hl]
    ret

CoordsData_1e167:
    db 3,3
    db 4,3
    db $ff

Route7GateScript1:
    ld a, [wSimulatedJoypadStatesIndex]
    and a
    ret nz
    call Delay3
    xor a
    ld [wJoyIgnore], a
    ld [wRoute7GateCurScript], a
    ld [wCurMapScript], a
    ret

Offline

#639 2020-05-22 13:26:03

noobimodder
Member
Registered: 2020-05-16
Post 4/10

Re: Simple Questions & Answers

Update!
Just wanted to say I managed to figure it out ^^ And I'll post the code here in case anyone else wants to see it/use it

PalletTownScript0:
    CheckEvent EVENT_GOT_POKEDEX
    ret nz
    ld hl, CoordsData_PalletTown1
    call ArePlayerCoordsInArray
    ret nc
    ld [hSpriteIndexOrTextID], a
    call DisplayTextID ; You can't go out
    xor a
    ld [hJoyHeld], a
    call PalletTownScript1
    ;ld a, $1 ;HAD TO REMOVE THIS LINE TO MAKE THE CODE WORK idk what it does or means lol
    ld [wPalletTownCurScript], a
    ret
    
PalletTownScript1: ; Move player right
    call StartSimulatingJoypadStates
    ld a, $1 ;moves $1 to A registry
    ld [wSimulatedJoypadStatesIndex], a ; in A registry you activate [wSimulatedJoypadStatesIndex]
    ld a, D_RIGHT ; Moves you right
    ld [wSimulatedJoypadStatesEnd], a ;It crashes here. It crashes after moving 1 step.
    xor a
    ld [wSpriteStateData1 + 9], a
    ld [wJoyIgnore], a
    ret

CoordsData_PalletTown1:
    db 9,1
    db 10,1
    db 11,1
    db $ff

PalletTown_TextPointers:
    dw PalletTownText0
    dw PalletTownText1

PalletTownText0: ;Bug Catcher
    TX_ASM
    ld hl, PalletTownText1
    call PrintText
    call PalletTownScript1
    ld a, $3
    ld [wPalletTownCurScript], a
    jp TextScriptEnd
    
PalletTownText1: ; You can't go out without a pokemon
    TX_FAR _PalletTownText4
    db "@"

Last edited by noobimodder (2020-05-22 13:26:40)

Offline

#640 2020-05-22 14:18:01

h0tp3ngu1n
Member
Registered: 2018-09-11
Post 17/20

Re: Simple Questions & Answers

noobimodder wrote:

Update!
Just wanted to say I managed to figure it out ^^ And I'll post the code here in case anyone else wants to see it/use it

Did you ever figure out those naming conventions? Because I haven't really looked at the disassembly much, but I too find some of the names a little confusing (like the "_1e111" on the end of the name of that one subroutine... no idea what that means). If someone could explain, that would be helpful. (Not for me though. Just a little curious.)

Anyway, I believe that anything beginning with "w" is a variable ("w" probably stands for "WRAM"). They're all listed in the wram.asm file. So "wd728" is the variable that's stored at memory address $D728 (contains eight bit flags keeping track of various things), whereas "wPalletTownCurScript" is the variable at memory address $D5F1 (not sure what it does, but it probably has something to do with keeping track of whether or not Oak is supposed to appear when you step in the grass). No idea what "Cur" means though, or why a variable name ends in the word "Script".


Also, just pointing out that you probably shouldn't be loading the contents of A into [wPalletTownCurScript]. Seems like a bad idea, since A presumably contains junk data at that point.

Last edited by h0tp3ngu1n (2020-05-22 14:24:18)

Offline

#641 2020-05-22 16:02:58

Danny-E 33
Administrator
Registered: 2012-06-09
Post 1,181/1,188

Re: Simple Questions & Answers

The disassemblies were created by analyzing the binary ROM. The ROM contains no names for routines or RAM locations - only addresses.
So while creating the disassembly, we have to create our own names. Sometimes we use placeholder names such as "Route7GateScript_1e111" or "wd728" where 0x1e111 and 0xd728 are the ROM/RAM addresses that these placeholder names refer to.
Long term, it is ideal to update these names once the context is fully understood, such as "Route7GateScript_DoSomething" or "wSomeVariable".

h0tp3ngu1n is correct that the "w" prefix means it refers to WRAM.

h0tp3ngu1n is also correct that if you comment out "ld a, $1" then you should also comment out "ld [wPalletTownCurScript], a" on the next line. The way it is now, you are writing an arbitrary garbage value to that variable.

The "w*CurScript" variables should contain an index into the current map's "ScriptPointers" pointer table.

Offline

#642 2020-05-22 20:43:48

noobimodder
Member
Registered: 2020-05-16
Post 5/10

Re: Simple Questions & Answers

Danny-E 33 wrote:

h0tp3ngu1n is also correct that if you comment out "ld a, $1" then you should also comment out "ld [wPalletTownCurScript], a" on the next line. The way it is now, you are writing an arbitrary garbage value to that variable.

I just tried it and it made the game crash. I don't really understand much of this ASM stuff, but I put it like that because that's how it was in all of the scripts I looked at/copied (In CinnabarIsland, Route6Gate, and ViridianCity)

But thank you all so much for all your help and comments so far :D

Offline

#643 2020-05-23 19:33:29

Teek
New member
Registered: 2020-05-23
Post 1/1

Re: Simple Questions & Answers

Hi! I was wondering, in pokered's wram.asm, is it safe to add a new variable after wDataBoxEnd, or will that mess things up in a major way?
Edit: looking at Roaming Red's history, it seems that the author repurposed an unused memory location for their purposes - I suppose this is probably the way to do what I'm trying to?

Last edited by Teek (2020-05-23 22:27:16)

Offline

#644 2020-05-24 19:36:05

Danny-E 33
Administrator
Registered: 2012-06-09
Post 1,182/1,188

Re: Simple Questions & Answers

Hi Teek. Both of your suggestions are valid. There is no problem with adding new variables at the end of WRAM after wDataBoxEnd (as long as you don't add so much that you start to overwrite the stack).
There is also no problem with adding new variables at unused addresses in the middle of WRAM. wUnusedCC5B is just a 1-byte example, but there are longer stretches of many unused bytes too, for example the 128 bytes before wNumSigns.

Offline

#645 2020-05-25 09:49:10

gordogozon
New member
Registered: 2020-05-25
Post 1/8

Re: Simple Questions & Answers

Hi! I'm a beginner and i'm trying to familiarize with the dissasembly by doing minor edits and looking how it works out.
The first major issue i found was when i attempted to add a new trainer, i choose the map of Viridian Forest and the party of the unused bug catcher. The stuff i modifyed was:

-in data/mapobjects/viridianforest
...
db 9 ; objects
object SPRITE_BUG_CATCHER, 16, 43, STAY, NONE, 1 ; person
object SPRITE_BUG_CATCHER, 30, 33, STAY, LEFT, 2, OPP_BUG_CATCHER, 1
object SPRITE_BUG_CATCHER, 30, 19, STAY, LEFT, 3, OPP_BUG_CATCHER, 2
object SPRITE_BUG_CATCHER, 2, 18, STAY, LEFT, 4, OPP_BUG_CATCHER, 3
object SPRITE_BALL, 25, 11, STAY, NONE, 5, ANTIDOTE
object SPRITE_BALL, 12, 29, STAY, NONE, 6, POTION
object SPRITE_BALL, 1, 31, STAY, NONE, 7, POKE_BALL
object SPRITE_BUG_CATCHER, 27, 40, STAY, NONE, 8 ; person
object SPRITE_BUG_CATCHER, 29, 40, STAY, LEFT, 9, OPP_BUG_CATCHER, 12
...

-then added the text of the battle using the other bugcatchers as a template,
in text/maps/viridianforest
_ViridianForestText1::
...
_ViridianForestText14::
text "LEAVING"
line "VIRIDIAN FOREST"
cont "PEWTER CITY AHEAD"
done

_ViridianForestBattleText4::
text "Test test"
line "test"
done

_ViridianForestEndBattleText4::
text "Test test"
line "test Test"
cont "test"
prompt

_ViridianFrstAfterBattleText4::
text "Test test"
line "test test"
cont "Test"

para "Test test"
line "test"
cont "Test"
done

-finally i tried with the scripts, once more looking at the existant ones. I grabbed the unused event below the other bugcatchers in the file event_constants (it's named event 565),
in scripts/viridianforest
...
ViridianForestTrainerHeader2:
dbEventFlagBit EVENT_BEAT_VIRIDIAN_FOREST_TRAINER_2
db ($1 << 4) ; trainer's view range
dwEventFlagAddress EVENT_BEAT_VIRIDIAN_FOREST_TRAINER_2
dw ViridianForestBattleText3 ; TextBeforeBattle
dw ViridianForestAfterBattleText3 ; TextAfterBattle
dw ViridianForestEndBattleText3 ; TextEndBattle
dw ViridianForestEndBattleText3 ; TextEndBattle

ViridianForestTrainerHeader3:
dbEventFlagBit EVENT_565
db ($1 << 4) ; trainer's view range
dwEventFlagAddress EVENT_565
dw ViridianForestBattleText3 ; TextBeforeBattle
dw ViridianForestAfterBattleText3 ; TextAfterBattle
dw ViridianForestEndBattleText3 ; TextEndBattle
dw ViridianForestEndBattleText3 ; TextEndBattle

db $ff

ViridianForestText1:
TX_FAR _ViridianForestText1
db "@"
...
ViridianForestText14:
TX_FAR _ViridianForestText14
db "@"

ViridianForestBattleText4:
TX_FAR _ViridianForestBattleText4
db "@"

ViridianForestEndBattleText4:
TX_FAR _ViridianForestEndBattleText4
db "@"

ViridianForestAfterBattleText4:
TX_FAR _ViridianFrstAfterBattleText4
db "@"

in the same file i tried to add a new text pointer (added dw ViridianForestText15 in line 20) but then it falied to compile the rom, so i left them alone.


The result was weird, the sprite was inserted as intended but when i talked to him it displayed a signpost message (_ViridianForestText9).
In addition to this it glitched out the antidote item pickup. When i faced it or walked next to it, the exclamation mark appeared above it, then Red grabbed the antidote and inmediately a battle with a wild lv. 0 Lickitung started.

Im completely lost on what happened there and why, i suppose i'm missing a part or messed up with the event constant so a little push in the right direction will be much appreciated.

Thank you! And sorry for the grammar mistakes, i'm not a native speaker.

Offline

#646 2020-05-25 20:01:02

Danny-E 33
Administrator
Registered: 2012-06-09
Post 1,185/1,188

Re: Simple Questions & Answers

gordogozon wrote:

in the same file i tried to add a new text pointer (added dw ViridianForestText15 in line 20) but then it falied to compile the rom, so i left them alone.

Hi gordogozon. The issue is that this step is still unfinished.

The list of text pointers needs to match the list of "objects" plus "signs" from the mapObjects file.

Notice the order of text pointers here:

ViridianForest_TextPointers:
    dw ViridianForestText1
    dw ViridianForestText2
    dw ViridianForestText3
    dw ViridianForestText4
    dw PickUpItemText
    dw PickUpItemText
    dw PickUpItemText
    dw ViridianForestText8
    dw ViridianForestText9
    dw ViridianForestText10
    dw ViridianForestText11
    dw ViridianForestText12
    dw ViridianForestText13
    dw ViridianForestText14

Text pointers 1 through 8 are the 8 original objects. Text pointers 9 through 14 are the signs. You added a new object, so you must add a new text pointer between "ViridianForestText8" and "ViridianForestText9".
You can label it whatever you want, like "ViridianForestBugCatcherText", but it needs to be structured like the other trainer texts - ViridianForestText2, ViridianForestText3, and ViridianForestText4:

ViridianForest_TextPointers:
    dw ViridianForestText1
    dw ViridianForestText2
    dw ViridianForestText3
    dw ViridianForestText4
    dw PickUpItemText
    dw PickUpItemText
    dw PickUpItemText
    dw ViridianForestText8
    dw ViridianForestBugCatcherText
    dw ViridianForestText9
    dw ViridianForestText10
    dw ViridianForestText11
    dw ViridianForestText12
    dw ViridianForestText13
    dw ViridianForestText14

[...]

ViridianForestBugCatcherText:
    TX_ASM
    ld hl, ViridianForestTrainerHeader3
    call TalkToTrainer
    jp TextScriptEnd

Notice that this is where the new "ViridianForestTrainerHeader3" trainer header needs to be referenced.

Offline

#647 2020-05-26 06:34:19

gordogozon
New member
Registered: 2020-05-25
Post 2/8

Re: Simple Questions & Answers

Thank you very much! I managed to make it display the correct text and trigger the correct trainer party!

The only thing that i couldn't repair was the trainer view range, as i need to talk to the bugcatcher to trigger the battle:

gordogozon wrote:

In addition to this it glitched out the antidote item pickup. When i faced it or walked next to it, the exclamation mark appeared above it, then Red grabbed the antidote and inmediately a battle with a wild lv. 0 Lickitung started.

If i increase the trainer view range the antidote "walks" to me and the battle with Lickitung starts.

I think the trainer view range is applying to the wrong object. I noticed that the antidote and lickitung share the same constant ($0B).


Here is the data, maybe i didn't nail the correct order:

ViridianForest_Script:
    call EnableAutoTextBoxDrawing
    ld hl, ViridianForestTrainerHeader0
    ld de, ViridianForest_ScriptPointers
    ld a, [wViridianForestCurScript]
    call ExecuteCurMapScriptInTable
    ld [wViridianForestCurScript], a
    ret

ViridianForest_ScriptPointers:
    dw CheckFightingMapTrainers
    dw DisplayEnemyTrainerTextAndStartBattle
    dw EndTrainerBattle

ViridianForest_TextPointers:
    dw ViridianForestText1
    dw ViridianForestText2
    dw ViridianForestText3
    dw ViridianForestText4
    dw PickUpItemText
    dw PickUpItemText
    dw PickUpItemText
    dw ViridianForestText8
    dw ViridianForestBugCatcherText
    dw ViridianForestText9
    dw ViridianForestText10
    dw ViridianForestText11
    dw ViridianForestText12
    dw ViridianForestText13
    dw ViridianForestText14

ViridianForestTrainerHeader0:
    dbEventFlagBit EVENT_BEAT_VIRIDIAN_FOREST_TRAINER_0
    db ($4 << 4) ; trainer's view range
    dwEventFlagAddress EVENT_BEAT_VIRIDIAN_FOREST_TRAINER_0
    dw ViridianForestBattleText1 ; TextBeforeBattle
    dw ViridianForestAfterBattleText1 ; TextAfterBattle
    dw ViridianForestEndBattleText1 ; TextEndBattle
    dw ViridianForestEndBattleText1 ; TextEndBattle

ViridianForestTrainerHeader1:
    dbEventFlagBit EVENT_BEAT_VIRIDIAN_FOREST_TRAINER_1
    db ($4 << 4) ; trainer's view range
    dwEventFlagAddress EVENT_BEAT_VIRIDIAN_FOREST_TRAINER_1
    dw ViridianForestBattleText2 ; TextBeforeBattle
    dw ViridianForestAfterBattleText2 ; TextAfterBattle
    dw ViridianForestEndBattleText2 ; TextEndBattle
    dw ViridianForestEndBattleText2 ; TextEndBattle

ViridianForestTrainerHeader2:
    dbEventFlagBit EVENT_BEAT_VIRIDIAN_FOREST_TRAINER_2
    db ($1 << 4) ; trainer's view range
    dwEventFlagAddress EVENT_BEAT_VIRIDIAN_FOREST_TRAINER_2
    dw ViridianForestBattleText3 ; TextBeforeBattle
    dw ViridianForestAfterBattleText3 ; TextAfterBattle
    dw ViridianForestEndBattleText3 ; TextEndBattle
    dw ViridianForestEndBattleText3 ; TextEndBattle

ViridianForestTrainerHeader3:
    dbEventFlagBit EVENT_565 
    db ($4 << 4) ; trainer's view range
    dwEventFlagAddress EVENT_565 
    dw ViridianForestBattleText4 ; TextBeforeBattle
    dw ViridianForestAfterBattleText4 ; TextAfterBattle
    dw ViridianForestEndBattleText4 ; TextEndBattle
    dw ViridianForestEndBattleText4 ; TextEndBattle

    db $ff

ViridianForestText1:
    TX_FAR _ViridianForestText1
    db "@"

ViridianForestText2:
    TX_ASM
    ld hl, ViridianForestTrainerHeader0
    call TalkToTrainer
    jp TextScriptEnd

ViridianForestText3:
    TX_ASM
    ld hl, ViridianForestTrainerHeader1
    call TalkToTrainer
    jp TextScriptEnd

ViridianForestText4:
    TX_ASM
    ld hl, ViridianForestTrainerHeader2
    call TalkToTrainer
    jp TextScriptEnd

ViridianForestBattleText1:
    TX_FAR _ViridianForestBattleText1
    db "@"

ViridianForestEndBattleText1:
    TX_FAR _ViridianForestEndBattleText1
    db "@"

ViridianForestAfterBattleText1:
    TX_FAR _ViridianFrstAfterBattleText1
    db "@"

ViridianForestBattleText2:
    TX_FAR _ViridianForestBattleText2
    db "@"

ViridianForestEndBattleText2:
    TX_FAR _ViridianForestEndBattleText2
    db "@"

ViridianForestAfterBattleText2:
    TX_FAR _ViridianFrstAfterBattleText2
    db "@"

ViridianForestBattleText3:
    TX_FAR _ViridianForestBattleText3
    db "@"

ViridianForestEndBattleText3:
    TX_FAR _ViridianForestEndBattleText3
    db "@"

ViridianForestAfterBattleText3:
    TX_FAR _ViridianFrstAfterBattleText3
    db "@"

ViridianForestText8:
    TX_FAR _ViridianForestText8
    db "@"

ViridianForestBugCatcherText:
    TX_ASM
    ld hl, ViridianForestTrainerHeader3
    call TalkToTrainer
    jp TextScriptEnd
    
ViridianForestBattleText4:
    TX_FAR _ViridianForestBattleText4
    db "@"

ViridianForestEndBattleText4:
    TX_FAR _ViridianForestEndBattleText4
    db "@"

ViridianForestAfterBattleText4:
    TX_FAR _ViridianFrstAfterBattleText4
    db "@"

ViridianForestText9:
    TX_FAR _ViridianForestText9
    db "@"

ViridianForestText10:
    TX_FAR _ViridianForestText10
    db "@"

ViridianForestText11:
    TX_FAR _ViridianForestText11
    db "@"

ViridianForestText12:
    TX_FAR _ViridianForestText12
    db "@"

ViridianForestText13:
    TX_FAR _ViridianForestText13
    db "@"

ViridianForestText14:
    TX_FAR _ViridianForestText14
    db "@"

Thanks!

Offline

#648 2020-05-26 22:44:08

Danny-E 33
Administrator
Registered: 2012-06-09
Post 1,186/1,188

Re: Simple Questions & Answers

I couldn't tell what the issue was based on the code you shared so I tried to replicate your changes and I also saw the Antidote -> Lickitung battle.

I guess there is a limitation that all trainers must be grouped together in the mapObjects list, even though they don't necessarily have to be at the beginning or end of the list.
(The view-range-check assumes all the trainers are grouped together, which is why the range check was being applied to the Antidote. But talking to trainers directly does not assume the trainers are grouped together, so the battle is triggered normally.)

So you can move the new trainer right after the 3 original trainers:

db 9 ; objects
    object SPRITE_BUG_CATCHER, 16, 43, STAY, NONE, 1 ; person
    object SPRITE_BUG_CATCHER, 30, 33, STAY, LEFT, 2, OPP_BUG_CATCHER, 1
    object SPRITE_BUG_CATCHER, 30, 19, STAY, LEFT, 3, OPP_BUG_CATCHER, 2
    object SPRITE_BUG_CATCHER, 2, 18, STAY, LEFT, 4, OPP_BUG_CATCHER, 3
    object SPRITE_BUG_CATCHER, 29, 40, STAY, LEFT, 15, OPP_BUG_CATCHER, 12 ; the new one
    object SPRITE_BALL, 25, 11, STAY, NONE, 5, ANTIDOTE
    object SPRITE_BALL, 12, 29, STAY, NONE, 6, POTION
    object SPRITE_BALL, 1, 31, STAY, NONE, 7, POKE_BALL
    object SPRITE_BUG_CATCHER, 27, 40, STAY, NONE, 8 ; person

I also pretty badly misspoke in my last reply so I will try to clear it up here..
The list of text pointers does not have to exactly match the list of objects + signs. Instead, each object and sign contains a text ID in its definition. The list of text pointers can be in whatever order as long as the assignment of text IDs for the signs/objects makes sense. I completely forgot about this value in the mapObjects when making my previous reply.

You can see that in my code block above, the new trainer now has text ID 15. This puts their text pointer at the end of the list of text pointers:

ViridianForest_TextPointers:
    dw ViridianForestText1
    dw ViridianForestText2
    dw ViridianForestText3
    dw ViridianForestText4
    dw PickUpItemText
    dw PickUpItemText
    dw PickUpItemText
    dw ViridianForestText8
    dw ViridianForestText9
    dw ViridianForestText10
    dw ViridianForestText11
    dw ViridianForestText12
    dw ViridianForestText13
    dw ViridianForestText14
    dw ViridianForestBugCatcherText

This is nice because you do not have to shift around any original text pointers. (In fact, since you took my previous bad suggestion, you might notice all of your signs' texts are off by one.)

Offline

#649 2020-05-27 07:18:16

gordogozon
New member
Registered: 2020-05-25
Post 3/8

Re: Simple Questions & Answers

I see.. so if i'm getting this the right way, the only part thats need to follow a strict order is the objects list, in a way that all the trainers (and overworld pokemon I think) get grouped together. I'm right here?

With this new knowledge I'm understating a good deal better the mechanics of the text pointers and I managed to do some new things.

I'm going to mess around with the scripts to see what i can accomplish!

Thank you for taking your time to help me out!


EDIT:
It seems like the trainer behaves as intended, but the item in the seventh slot stops working (as interacting with it displays a blank text). If you remove the item the game works properly, so it's not a big loss, some sacrifices need to be made!

EDIT2:
Found the solution in this post: hax.iimarckus.org/post/47823/#p47823
You need to update the hide/show data for the items!

Last edited by gordogozon (2020-05-27 09:04:33)

Offline

#650 2020-05-31 07:48:52

MrSallt
New member
Registered: 2020-05-31
Post 1/9

Re: Simple Questions & Answers

Hi Everyone,

I'm actually working on the pokecrystal dissasembly, and my goal is to replace useless pokemon by last evolution pokemon ( exemple : togekiss replace ledyba )
I've followed each step to modified the pokemon stat but i'm blocked when it comes to edit the sprite. I've created a front and back sprite for togekiss on photoshop, indexed the colors and imported the togetic palette to work on it. After I saves it in the gfx/pokemon/ledyba folder, and tried to make my rom, cyg said that the palet I use for my front sprite isn't indexed, which I don't understand because it seems indexed..
Am I doing something wrong ?

Last edited by MrSallt (2020-05-31 07:52:23)


- If my english seems a little weardish, that's normal, Am French -

Offline

Board footer

Powered by FluxBB