Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#1 2019-08-09 07:19:11

BellsproutIsCool
New member
Registered: 2019-08-06
Post 1/3

Adding a new stat for alternate forms in Pokemon Crystal

I've been adding extra forms of specific pokemon to my Crystal project. I've been able to make pokemon use alternate palettes based on their "unown form" (wUnownLetter). However I'd like to implement a better method of doing alternate forms. I want  to create a new stat that is set when the pokemon is generated, and can then be used to determine which sprite and palette it uses whenever displayed.
For example I'd like to have two forms of Shellos, and have the "form" stat be set to 1 when spawned on one map, and 0 when spawned on another. Whenever Shellos is sent into battle or viewed in the party the game simply loads the "form" variable and displays the proper palette and sprite based on whether its a 1 or a 0.
I don't know how to add this stat. Attempting to add it to macros/wram.asm breaks the game so I don't know what to do. I assume I'm just missing something important in how the game deals with these things.

Offline

#2 2019-08-11 05:29:44

BellsproutIsCool
New member
Registered: 2019-08-06
Post 3/3

Re: Adding a new stat for alternate forms in Pokemon Crystal

I've made progress. Here's what I did. In macros/wram.asm I added \1Form:: db here:

party_struct: MACRO
box_struct \1
\1Status::         db
\1Unused::         db
\1HP::             dw
\1MaxHP::          dw
\1Stats:: ; big endian
\1Attack::         dw
\1Defense::        dw
\1Speed::          dw
\1SpclAtk::        dw
\1SpclDef::        dw
\1Form::    db ;New Line
\1StatsEnd::
ENDM

I also did the same beneath "battle_struct:"

then I updated pokemon_data_constants.asm like this:

; party_struct members (see macros/wram.asm)
MON_SPECIES            EQUS "(wPartyMon1Species - wPartyMon1)"
MON_ITEM               EQUS "(wPartyMon1Item - wPartyMon1)"
MON_MOVES              EQUS "(wPartyMon1Moves - wPartyMon1)"
MON_ID                 EQUS "(wPartyMon1ID - wPartyMon1)"
MON_EXP                EQUS "(wPartyMon1Exp - wPartyMon1)"
MON_STAT_EXP           EQUS "(wPartyMon1StatExp - wPartyMon1)"
MON_HP_EXP             EQUS "(wPartyMon1HPExp - wPartyMon1)"
MON_ATK_EXP            EQUS "(wPartyMon1AtkExp - wPartyMon1)"
MON_DEF_EXP            EQUS "(wPartyMon1DefExp - wPartyMon1)"
MON_SPD_EXP            EQUS "(wPartyMon1SpdExp - wPartyMon1)"
MON_SPC_EXP            EQUS "(wPartyMon1SpcExp - wPartyMon1)"
MON_DVS                EQUS "(wPartyMon1DVs - wPartyMon1)"
MON_PP                 EQUS "(wPartyMon1PP - wPartyMon1)"
MON_HAPPINESS          EQUS "(wPartyMon1Happiness - wPartyMon1)"
MON_PKRUS              EQUS "(wPartyMon1PokerusStatus - wPartyMon1)"
MON_CAUGHTDATA         EQUS "(wPartyMon1CaughtData - wPartyMon1)"
MON_CAUGHTLEVEL        EQUS "(wPartyMon1CaughtLevel - wPartyMon1)"
MON_CAUGHTTIME         EQUS "(wPartyMon1CaughtTime - wPartyMon1)"
MON_CAUGHTGENDER       EQUS "(wPartyMon1CaughtGender - wPartyMon1)"
MON_CAUGHTLOCATION     EQUS "(wPartyMon1CaughtLocation - wPartyMon1)"
MON_LEVEL              EQUS "(wPartyMon1Level - wPartyMon1)"
MON_STATUS             EQUS "(wPartyMon1Status - wPartyMon1)"
MON_HP                 EQUS "(wPartyMon1HP - wPartyMon1)"
MON_MAXHP              EQUS "(wPartyMon1MaxHP - wPartyMon1)"
MON_ATK                EQUS "(wPartyMon1Attack - wPartyMon1)"
MON_DEF                EQUS "(wPartyMon1Defense - wPartyMon1)"
MON_SPD                EQUS "(wPartyMon1Speed - wPartyMon1)"
MON_SAT                EQUS "(wPartyMon1SpclAtk - wPartyMon1)"
MON_SDF                EQUS "(wPartyMon1SpclDef - wPartyMon1)"
MON_FORM    EQUS "(wPartyMon1Form - wPartymon1)" ;New Line
BOXMON_STRUCT_LENGTH   EQUS "(wPartyMon1End - wPartyMon1)"
PARTYMON_STRUCT_LENGTH EQUS "(wPartyMon1StatsEnd - wPartyMon1)"
REDMON_STRUCT_LENGTH EQU 44

When I run the game, the battle system goes haywire, for whatever reason the Hitpoints bar and levels go wild! I got the battle sytem to work though by editing battle_constants.asm:

; stat constants
; indexes for:
; - wPlayerStats and wEnemyStats (see wram.asm)
; - party_struct and battle_struct members (see macros/wram.asm)
const_def 1
const STAT_HP
const STAT_ATK
const STAT_DEF
const STAT_SPD
const STAT_SATK
const STAT_SDEF
const STAT_FORM ;New Line
NUM_STATS EQU const_value
STAT_SPC EQU STAT_SATK

The battle system works fine again but now the question is, how do I read and write to and from "\1form"? I feel like if I knew that I can do anything with regard to alternate forms, assuming what I did is correct.

Last edited by BellsproutIsCool (2019-08-11 05:31:04)

Offline

Board footer

Powered by FluxBB