Users browsing this thread: 1 Guest(s)
Summon Command Acts like Magicite

#1
Posts: 614
Threads: 49
Thanks Received: 0
Thanks Given: 4
Joined: Feb 2017
Reputation: 25
Status
None
I've been putting together my project plan for my hack, and have determined that part of it will be finishing off the Summon command ability (different than Summoning an Esper through the Magic Menu). I would like to have this ability jump to the portion of code that summons a random Esper via Magicite, but do it without using MP or an Item. (Note: This is an ability used for one storyline battle, but others may find it useful for other hacks.)

Note: The Summon Aiming fix is already applied

I've isolated the code that the command would need to jump to:
Quote:(Magicite)

C2/3FAD: 20 DC 37     JSR $37DC      (Picks random Esper, not Odin or Raiden)
C2/3FB0: 8D 00 34     STA $3400      (Save the spell number)
C2/3FB3: EE 70 3A     INC $3A70      (Increment the number of attacks remaining)
C2/3FB6: 60           RTS 

Pick a random Esper (not Odin or Raiden)

C2/37DC: A9 19        LDA #$19
C2/37DE: 20 65 4B     JSR $4B65      (random: 0 to #$18)
C2/37E1: C9 0B        CMP #$0B
C2/37E3: 90 02        BCC $37E7      (Branch if A < #$0B)
C2/37E5: 1A           INC            (Add 2 if over #$0B)
C2/37E6: 1A           INC 
C2/37E7: 18           CLC 
C2/37E8: 69 36        ADC #$36
C2/37EA: 60           RTS 

However, I can't find the section of code that controls the Summon command. I replaced what I thought it was (C2/368E to C2/3693), and it ended up replacing the Esper summoned through the battle menu. The MP deducted would be the same as the Esper you had equipped, and it would play your Esper's animation first, but with no effect. Then it would summon a random Esper and apply its effect. The same thing would happen when the Summon command was used. Interestingly enough, if you DIDN'T have an Esper equipped, the Summon command worked mostly how I wanted it to. It makes me think the Summon command jumps to C2/368E, but I can't find a place in the code that does that. Any help?
  Find
Quote  

#2
Posts: 149
Threads: 21
Thanks Received: 40
Thanks Given: 3
Joined: Dec 2013
Reputation: 9
Status
Auto-life
It looks like the code at C2/368E is an adjustment from the global spell index (all 256 spell listed in ff3usme) for the command and the command selection.

As example, if the spell is AuraBolt (identifier 94) then the command ($B5) is #$0A (Blitz) and the command selection ($B6) is #$01 (AuraBolt). #$00 is Pummel, #$01 is AuraBolt, #$02 is Suplex, etc. It is the move that you selected in the command menu.

Code:
C2/368E 38          SEC
C2/368F A5 B6       LDA $B6
C2/3691 E9 36       SBC #$36        ;54, the start of the espers spells
C2/3693 60          RTS

It may be possible that, when you summon a esper in the magic command menu, and not by the summon command, it may internally convert it as the summon command with their respective index. If it is true, it must be a conflict between the summon command code being used by the magic command and the summon command alone.

At C2/19C7 there is a table used to define the execution for all the commands in the game. You can analyze them and try to change the summon pointer for a custom code to alter the summon command behavior.

At C2/4D89 begins a code to adjust specific commands manually. At C2/4D92 begins the summon command adjustment. You should check it, just in case. I believe it affects the espers summoned by the magic command.

Code:
C2/4D92: C9 19        CMP #$19    
C2/4D94: D0 11        BNE $4DA7   (Branch if not Summon)
C2/4D96: 48           PHA 
C2/4D97: EB           XBA 
C2/4D98: C9 FF        CMP #$FF    (Check if no Esper equipped)
C2/4D9A: D0 03        BNE $4D9F
C2/4D9C: B9 44 33     LDA $3344,Y
C2/4D9F: EB           XBA 
C2/4DA0: B9 18 30     LDA $3018,Y
C2/4DA3: 0C 2E 3F     TSB $3F2E   
C2/4DA6: 68           PLA
  Find
Quote  
[-] The following 1 user says Thank You to HatZen08 for this post:
  • madsiur (03-03-2017)

#3
Posts: 200
Threads: 1
Thanks Received: 10
Thanks Given: 0
Joined: Oct 2015
Reputation: 18
Status
None
following from the above..

- have the C2/19C7 table entry go somewhere new, where you do: "JSR $37DC / STA $B6 / JMP $1763".
- having MP be untouched for one variety of the Summon command but not the other can be tricky.  if i follow a difference right, hook C2/4D9C, and branch somewhere to set Bit 6 of $B1 before doing "LDA $3344,Y".
Quote  

#4
Posts: 127
Threads: 8
Thanks Received: 21
Thanks Given: 12
Joined: Jan 2012
Reputation: 13
Status
None
Assassin beat me to it but anyways:

Code:
>> Summon Command Pointer
@ C219F9:       69 64

>> New Summon Command in free space
@ C26469:
       20 DC 37     # JSR $37DC      (Picks random Esper, not Odin or Raiden)
       85 B6        # STA $B6        (Set spell/animation)
       4C 63 17     # JMP $1763      (go summon it)

I'm pretty sure this code does not use MP.
  Find
Quote  

#5
Posts: 614
Threads: 49
Thanks Received: 0
Thanks Given: 4
Joined: Feb 2017
Reputation: 25
Status
None
(03-04-2017, 01:59 AM)m06 Wrote: Assassin beat me to it but anyways:

Code:
>> Summon Command Pointer
@ C219F9:       69 64

>> New Summon Command in free space
@ C26469:
       20 DC 37     # JSR $37DC      (Picks random Esper, not Odin or Raiden)
       85 B6        # STA $B6        (Set spell/animation)
       4C 63 17     # JMP $1763      (go summon it)

I'm pretty sure this code does not use MP.


Well, that answers the question. First off, it worked. Here are the strange parts though:
1. It DID use MP.
2. It DID change the Summon from the Magic menu also.
3. When I used the Summon command, it counted as my "1 summon" per battle for the magic menu. However, I could continually use the Summon command from the main menu.
4. All animations and captions otherwise displayed correctly.

So it appears these commands are inseparably linked. I'll continue to test later to see if I can possibly repurpose Possess to do this. I never used that ability anyway.
  Find
Quote  

#6
Posts: 763
Threads: 83
Thanks Received: 55
Thanks Given: 7
Joined: Apr 2015
Reputation: 22
Status
Obliviscence
(03-05-2017, 07:24 PM)PowerPanda Wrote:
(03-04-2017, 01:59 AM)m06 Wrote: Assassin beat me to it but anyways:

Code:
>> Summon Command Pointer
@ C219F9:       69 64

>> New Summon Command in free space
@ C26469:
       20 DC 37     # JSR $37DC      (Picks random Esper, not Odin or Raiden)
       85 B6        # STA $B6        (Set spell/animation)
       4C 63 17     # JMP $1763      (go summon it)

I'm pretty sure this code does not use MP.


Well, that answers the question. First off, it worked. Here are the strange parts though:
1. It DID use MP.
2. It DID change the Summon from the Magic menu also.
3. When I used the Summon command, it counted as my "1 summon" per battle for the magic menu. However, I could continually use the Summon command from the main menu.
4. All animations and captions otherwise displayed correctly.

So it appears these commands are inseparably linked. I'll continue to test later to see if I can possibly repurpose Possess to do this. I never used that ability anyway.

there's no such thing as "inseparably linked"... you just completed the first step is all. Now you need to figure out how to differentiate the two further and where to branch or skip code.
  Find
Quote  

#7
Posts: 200
Threads: 1
Thanks Received: 10
Thanks Given: 0
Joined: Oct 2015
Reputation: 18
Status
None
if you do my recommended C2/4D9C hook:

1) expand it to XBA, and then "JMP $4DA6" instead of RTS.  no longer counts against Summon limit.

2) have the new code reached from C2/19C7 test Bit 6 of $B1 to differentiate between the two Summon types.  admittedly, you'd be expanding this bit from its original purpose, but it's a way to do things without taking a custom RAM byte.  hopefully, this won't break Mimic; i think it's safe, because Mimic just sets that bit with X-Magic, and summons aren't usable with that.

alternatively, i wonder what happens if you have the C2/4D9C hook instead put a null ID [EDIT: FFh - 36h, rather] (or something outside the Esper range, at least) in top of A.  if that doesn't break the queuing or anything else, maybe have the C2/19C7-linked function test for that instead.
Quote  

#8
Posts: 763
Threads: 83
Thanks Received: 55
Thanks Given: 7
Joined: Apr 2015
Reputation: 22
Status
Obliviscence
(03-05-2017, 11:55 PM)assassin Wrote: alternatively, i wonder what happens if you have the C2/4D9C hook instead put a null ID [EDIT: FFh - 36h, rather] (or something outside the Esper range, at least) in top of A.  if that doesn't break the queuing or anything else, maybe have the C2/19C7-linked function test for that instead.

Admittedly, I haven't looked at any of the code, but changing A or B can have unforeseen consequences down the line if not restored... I ran into something similar doing magic expansion where I was breaking availability of spells in the menu 3 functions down the line because there was a value stored in B and the code ran an 8-bit A for a while keeping B in tact for a LONG time. but worth a test for sure.
  Find
Quote  

#9
Posts: 614
Threads: 49
Thanks Received: 0
Thanks Given: 4
Joined: Feb 2017
Reputation: 25
Status
None
I have to humbly admit I'm not following most of this. I know it's possible, I just don't think I'm good enough at doing this yet.
  Find
Quote  



Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite