Users browsing this thread: 1 Guest(s)
Command Change Custom Event

#1
Posts: 175
Threads: 11
Thanks Received: 10
Thanks Given: 8
Joined: May 2013
Reputation: 13
Status
Well-Fed
This came up on Discord today and I ended up coding it already. It's a set of three basic custom events that will change a character's command on a more permanent basis than the command-changing relics, either as an upgrade or as the foundation for a class change hack. The first variant assumes that you'll only ever have one instance of this in the game and hard-codes the character and command (using defines in the .asm to make it easier on, well, everyone), while the second takes two variables, character ID and command ID. Both of these versions change the third-slot, character-specific ability. (Variant one is currently set to give Celes the Shock command instead of Runic; variant two would do this with A4 06 1B.)

The third variant is more flexible still, and takes three variables -- character ID, command slot (00-03), and command ID. A5 06 02 1B would again give Celes Shock instead of Runic, whereas A5 00 03 09 would give Terra Tools instead of Item. You get the idea. Laugh

Code:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Command Change v1.0
;
; Two-Variable (gen.act. A4)     - first variable is character ID, second variable is command ID
; Three-Variable (gen.act. A5)    - first vairable is character ID, second variable is command slot (00-03)
;                                  third variable is command ID
; CommandChange (gen.act. A3) takes no variables and is designed for scenarios where you only have one
;                                character who only ever has one command changed in your hack.
;                                It uses defines to make it easier on the modder (see below!)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

hirom
;header


;;;;;;;;;;;;;;;;;;;;
; DEFINES
;;;;;;;;;;;;;;;;;;;;

!FreespaceC0 = $C0D700        ; 10 bytes needed
;!FreespaceC0_1 = $C0xxxx    ; if placing second event command in different free space
;!FreespaceC0_2 = $C0xxxx    ; if placing third event command in different free space

!GeneralActionA3 = $C099A0    ; The location of the pointer for general action A3, which is unused in vanilla; we'll be following with A4 and A5
                            ; if your hack has other custom commands, make sure that you adjust this as necessary to a free one
;!GeneralActionA4 = $C0xxxx        ; if using different general action commands, please note which general action you're actually using
;!GeneralActionA5 = $C0xxxx

; Command Defines
!Fight = #$00
!Item = #$01
!Magic = #$02
!Morph = #$03
!Revert = #$04
!Steal = #$05
!Capture = #$06
!Swdtech = #$07
!Throw = #$08
!Tools = #$09
!Blitz = #$0A
!Runic = #$0B
!Lore = #$0C
!Sketch = #$0D
!Control = #$0E
!Slot = #$0F
!Rage = #$10
!Leap = #$11
!Mimic = #$12
!Dance = #$13
!Row = #$14
!Def = #$15
!Jump = #$16
!XMagic = #$17
!GPRain = #$18
!Summon = #$19
!Health = #$1A
!Shock = #$1B
!Possess = #$1C
!Magitek = #$1D

; Character Defines and ID reference
!Terra = $1618        ; #$00
!Locke = $163D        ; #$01
!Cyan = $1662        ; #$02
!Shadow = $1687        ; #$03
!Edgar = $16AC        ; #$04
!Sabin = $16D1        ; #$05
!Celes = $16F6        ; #$06
!Strago = $171B        ; #$07
!Relm = $1740        ; #$08
!Setzer = $1765        ; #$09
!Mog = $178A        ; #$0A
!Gau = $17AF        ; #$0B
!Gogo = $17D4        ; #$0C
!Umaro = $17F9        ; #$0D
!15th = $181E        ; #$0E
!16th = $1843        ; #$0F


;;;;;;;;;;;;;;;;;
; CODE
;;;;;;;;;;;;;;;;;


org !GeneralActionA3
dw CommandChange
;org !GeneralActionA4
dw TwoVariable
;org !GeneralActionA5
dw ThreeVariable

org !FreespaceC0
CommandChange:
LDA !Shock
STA !Celes
LDA #$01
JMP $9B5C

;org !FreespaceC0_1
TwoVariable:
LDA $EB        ; get character ID
STA $4202   ; store as first multiplier
LDA #$25    ; character blocks are 25h/37d bytes long
STA $4203    ; store as second multiplier
REP #$21
NOP
NOP
LDA $4216
TAX
TDC
SEP #$20
LDA $EC
STA $1618,X
LDA #$03
JMP $9B5C


;org !FreespaceC0_2
ThreeVariable:
LDA $EB        ; get character ID
STA $4202   ; store as first multiplier
LDA #$25    ; character blocks are 25h/37d bytes long
STA $4203    ; store as second multiplier
LDA $EC        ; this is the slot (0-3) the command is going into
REP #$21
NOP
ADC $4216
TAX
TDC
SEP #$20
LDA $ED        ; and this is the command!
STA $1616,X
LDA #$04
JMP $9B5C


Current Project: FF6: Tensei | Discord ID: TristanGrayse
  Find
Quote  
[-] The following 10 users say Thank You to GrayShadows for this post:
  • C-Dude (09-03-2019), Catone (09-06-2019), Gi Nattak (10-06-2017), Lockirby2 (10-12-2017), madsiur (10-06-2017), PowerPanda (10-19-2017), seibaby (10-07-2017), Simulacrum (10-26-2017), SSJ Rick (10-06-2017), Warrax (10-06-2017)

#2
Posts: 826
Threads: 11
Thanks Received: 22
Thanks Given: 13
Joined: Nov 2011
Reputation: 16
Status
Double
Huh, I was just thinking about something like this just before it came up on Discord.


Confused Moogles FTW
Quote  

#3
Posts: 617
Threads: 49
Thanks Received: 0
Thanks Given: 7
Joined: Feb 2017
Reputation: 25
Status
None
Hmmm... I might be able to use this in my upcoming hack in 2 ways.

1. I have wondered if it is possible to give Strago's character profile to Banon so that Banon can equip weapons/armor/relics while you have him in your party. This also would make it so there was no auto game-over when his HP reached 0. With this code, I could have Profile 7 start with "Health", and then change it to "Lore" when Strago joins the party.

2. In my hack, I will be utilizing the previously-made hack that makes Gau learn Rages as soon as he sees enemy, rather than having to Leap on the Veldt. To offset the ease of learning Rages, I have been wanting him to NOT be able to use Magic for the first half of the game. Then, upon meeting his father in the WoR, he will gain Fight/Magic.


Projects:
FFVI: Divergent Paths (Completed) - a complete storyline and gameplay hack of FF6 that adds Leo as a playable character
  Find
Quote  

#4
Posts: 175
Threads: 11
Thanks Received: 10
Thanks Given: 8
Joined: May 2013
Reputation: 13
Status
Well-Fed
It would definitely work for both of those (you'd be looking at variant 3, probably, since you'd be affecting commands in different slots). Using Strago with Banon may run into some other issues, though - take a look at the Lore-learning code? You might find that Banon learns Lores even when he can't use them, since IIRC it's linked to the character being in battle, and not the command. Is it possible to make a character in slot 0E or 0F equippable? It's been ages since I've looked at that, and I'm not at my desktop with most of my notes. You might be better off looking at something like that rather than swapping the character, at least in terms of Banon. (Or using another character, like Relm.)

But yeah, this would definitely work for your Gau idea.


Current Project: FF6: Tensei | Discord ID: TristanGrayse
  Find
Quote  

#5
Posts: 617
Threads: 49
Thanks Received: 0
Thanks Given: 7
Joined: Feb 2017
Reputation: 25
Status
None
I did a test of this, copying profile 7 to character slot 0E. The equipment flags go by character profile, not by character slot. But you're right, there's a lot of risk for some very modest gains. I'll probably skip that.


Projects:
FFVI: Divergent Paths (Completed) - a complete storyline and gameplay hack of FF6 that adds Leo as a playable character
  Find
Quote  

#6
Posts: 175
Threads: 11
Thanks Received: 10
Thanks Given: 8
Joined: May 2013
Reputation: 13
Status
Well-Fed
... Actually, why not use Umaro? The biggest issue you'd run into with making Banon equippable is having a bit free to determine what he can be equipped WITH. But Umaro can't be equipped, so he'd be unaffected by you using that bit to determine what Banon can use. (It would mean that Banon would be able to equip the Umaro-only relics, but you can't have them by that point anyway so it shouldn't actually change anything.)


Current Project: FF6: Tensei | Discord ID: TristanGrayse
  Find
Quote  

#7
Posts: 1
Threads: 0
Thanks Received: 0
Thanks Given: 0
Joined: Sep 2019
Reputation: 0
Status
None
Hey all. Closet hacker here. Wanted to say thanks to everyone for all their hard work.

Great code here, Grayshadows. Thanks for your work. I did notice an issue though. Actions A3 and A4 caused the "Magic" command to be overwritten instead of the character unique abilities. A5 worked like a charm! But I did notice that if I rearranged commands via the shortcut way before the event, I could have this code write over any command that happend to be in the chosen slot. I'm very comfortable with hex-editing and event hacking but not at all good with SRAM. Is there any way to force the SRAM to reorder a character's command list to default before overwriting the command to ensure that the proper command gets overwritten?

Thanks again.
  Find
Quote  

#8
Posts: 389
Threads: 35
Thanks Received: 19
Thanks Given: 15
Joined: Dec 2018
Reputation: 18
Status
Moog
(09-03-2019, 11:43 AM)KefkasKronie Wrote: Hey all. Closet hacker here. Wanted to say thanks to everyone for all their hard work.

Great code here, Grayshadows. Thanks for your work. I did notice an issue though. Actions A3 and A4 caused the "Magic" command to be overwritten instead of the character unique abilities. A5 worked like a charm! But I did notice that if I rearranged commands via the shortcut way before the event, I could have this code write over any command that happend to be in the chosen slot. I'm very comfortable with hex-editing and event hacking but not at all good with SRAM. Is there any way to force the SRAM to reorder a character's command list to default before overwriting the command to ensure that the proper command gets overwritten?

Thanks again.

I think the safest way to go about this would be to simply overwrite all four command slots with the four commands you want.  So for instance, if you want to trade "Tools" for "Jump" on Edgar, you'd use A5 four times, to give the character Fight in slot 0, Jump in slot 1, Magic in slot 2, and Items in slot 3.  That way even if they're scrambled, you'll still end up with the correct four commands.  I think Berserk and Zombie actually do this in the main battle loop, overwriting commands with 'Fight' temporarily.
  Find
Quote  

#9
Posts: 52
Threads: 16
Thanks Received: 6
Thanks Given: 11
Joined: Aug 2013
Reputation: 2
Status
None
Hey, everyone. Please forgive this bit of thread necromancy.

I'm about ready to release an all-new version of the General Leo hack. I'm a lot more experienced now so I was able to do a lot more and do things more cleanly and bug-free.

There's one last thing I want to implement, though. It looks like the answer is in this thread but I'm having trouble tracking with it.

The idea is that there will be a one-time option to give X-Magic to Terra, Celes, Strago, or Relm. No more Gem Box relic. X-Magic would then permanently replace Magic in the chosen character's command list.

The two-variable option created by GrayShadows seems to be just what I need, but I don't understand how to implement it. Is this just ASM? Does this involve manipulating RAM? I'm not familiar with the notation used.

I'm hoping someone can give me a For Dummies version of this. Thank you!
Quote  



Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite