Users browsing this thread: 1 Guest(s)
changeing Health command

#1
Posts: 62
Threads: 16
Thanks Received: 10
Thanks Given: 4
Joined: May 2012
Reputation: 10
Status
None
hello, everyone. 
(I wrote using the google translator, I think that it is hard to read. sorry Cover)

now, I have a question one.
so i want to change Health to Miracle used in FF4TA.
(20% Cure, 50% Cure2, 30% Cure3)
Is this possible?

Code:
Health

C2/171E: A9 2E        LDA #$2E
C2/1720: 85 B6        STA $B6    
C2/1722: A9 05        LDA #$05
C2/1724: 80 3F        BRA $1765
  Find
Quote  

#2
Posts: 290
Threads: 3
Thanks Received: 40
Thanks Given: 1
Joined: Apr 2012
Reputation: 9
Status
None
Yes, it's possible, and it should be quite easy.

There is a random number generator at C2/4B5A. You would first want to call that, then run some comparisons based on what you want the odds of each spell to be.

First you would need to interrupt the Health routine and jump to some free space, since this code will be longer than Health's. So your function might look something like this (using the free space at C2/A65A):

Code:
C2/171E: A9 2D      LDA #$2D    (load Cure's spell ID instead of Cure 2's)
C2/1720: 85 B6      STA $B6     (store it into the skill to use; you'll see why shortly)
C2/1722: 4C 5A A6   JMP $A65A   (jump to some free space, since we've used up all of Health's)
C2/1725: EA         NOP

C2/A65A: 20 5A 4B   JSR $4B5A   (get a random number 0-255)
C2/A65D: C9 33      CMP #$33    (compare it to 51 (33 in hex; roughly 20% of 256))
C2/A65F: 90 08      BCC $A669   (if the random number is less than 51, use Cure)
C2/A661: C9 B3      CMP #$B3    (compare the random number to 179 (128 + 51; 50% chance))
C2/A663: 90 02      BCC $A667   (if the random number is less than 179 but greater than 51, use Cure 2)
C2/A665: E6 B6      INC $B6     (else, use Cure 3. Increment the spell ID we stored earlier twice to point to Cure 3)
C2/A667: E6 B6      INC $B6     (Cure 2 enters here, thus we will only increment the spell ID once so it points to Cure 2)
C2/A669: A9 05      LDA #$05    (this is left over from Health originally. Not sure what it's for; maybe the blue palette color. Cure also enters here, so we don't increment the spell ID at all)
C2/A66B: 4C 65 17   JMP $1765

Hopefully this makes sense.


GET A SILK BAG FROM THE GRAVEYARD DUCK TO LIVE LONGER.

Brave New World
  Find
Quote  
[-] The following 1 user says Thank You to Synchysi for this post:
  • Warrax (05-11-2021)

#3
Posts: 62
Threads: 16
Thanks Received: 10
Thanks Given: 4
Joined: May 2012
Reputation: 10
Status
None
oh, thank you Synchysi!
tried to write the code to advice as you.so, It was successful! Thanks!!

I tried trying to create a new command but, 1F seems to be the upper limit command. What a pity.
  Find
Quote  

#4
Posts: 324
Threads: 25
Thanks Received: 13
Thanks Given: 15
Joined: Oct 2013
Reputation: 2
Status
X-Zone
I have a similar question, I am trying to make something of the dummied out summon command.

I want it to cast 1 of 5 random spells (each spell 20% chance of being casted)

How would I do it, while still being able to have the edited command Health (because I will be using that in my hack as well)?


Shine 
  Find
Quote  

#5
Posts: 3,970
Threads: 279
Thanks Received: 236
Thanks Given: 58
Joined: Oct 2011
Reputation: 65
Status
Tissue-aware
Assuming you would choose spells IDs #$12, #$20, #$3F, #$70 and #$7F, it would be really similar to the code Synchysi wrote. Note that I only use the A register, there might be a more optimized way to write this:

Code:
01) JSR $4B5A (get random number)
02) CMP #$33 (Between 0% and ~20%)
03) BCC ???? (Branch to step 11)
04) CMP #$66 (Between ~21% and ~40%)
05) BCC ???? (Branch to step 13)
06) CMP #$99 (Between ~41% and ~60%)
07) BCC ???? (Branch to step 15)
08) CMP #$CC (Between ~61% and ~80%)
09) BCC ???? (Branch to step 17)
10) BRA ???? (Branch to step 19)
11) LDA #$12 (Load spell #1)
12) BRA ???? (Branch to step 20)  
13) LDA #$20 (Load spell #2)
14) BRA ???? (Branch to step 20)
15) LDA #$3F (Load spell #3)
16) BRA ???? (Branch to step 20)
17) LDA #$70 (Load spell #4)
18) BRA ???? (Branch to step 20)
19) LDA #$7F (more than ~80%, load spell #5)
20) STA $B6  (Store in skill to use)
21) LDA #$05 (used to display a spell name?)
22) JMP $1765

You can place this code in unused space in bank C2. You'll also need to change the pointer of the skill to point where your new code is. I'm not 100% sure if there is anything else to consider.

Pointer
Code:
C2/19F9: 63 17     (Summon)
  Find
Quote  

#6
Posts: 149
Threads: 21
Thanks Received: 40
Thanks Given: 3
Joined: Dec 2013
Reputation: 9
Status
Auto-life
Unfortunately, the targeting may be an issue. The summon command is a left over command and it doesn't work correctly without fixes. You can check the fixes at:

http://www.rpglegion.com/ff6/hack/summon.htm
http://www.romhacking.net/hacks/366/

Generally, any command has a standard targeting byte, separated from the triggered spells. If you use FF3 Multi Editor 6.7, you can check the targeting of commands at battle commands tab. If all the spells you want to trigger have the same targeting, you only need to adjust the targeting for the command in the tab. However, if the spells have different targets, you probably will have to adjust the targets by code.

Because summon is a incomplete code and doesn't work without fixes, I recommend to use another command instead. You may be forced to fix the summon command first before you can try to implement your changes. The already existent fixes may or may not work correctly with your changes.
  Find
Quote  

#7
Posts: 324
Threads: 25
Thanks Received: 13
Thanks Given: 15
Joined: Oct 2013
Reputation: 2
Status
X-Zone
Okay, so instead I decided to use the "Leap" command.

The Spell ID's are A7, AA, AC, B8, C9.

I have Changed the coding for all the spells listed and I have them set to their individual targeting and have them all set to auto-confirm.


Shine 
  Find
Quote  

#8
Posts: 2,549
Threads: 98
Thanks Received: 147
Thanks Given: 159
Joined: Aug 2009
Reputation: 52
Status
Nattak\'d
Hey Synchysi, I have a weird issue that came up with your code and I can't figure it out. =X

So I changed Health as well to behave like 'Miracle' here, I copied the code and it indeed works, but I noticed it also is affecting another spell that one of my character uses as a skill that is based off of Mantra - the skill attacks for how ever many HP the character currently has and also inflicts a random checked status effect. Anyway, it seems that this new code for Miracle is somehow tied to Mantra in some way - instead of attacking for the current HP, it breaks that and sometimes does a lot of damage (cure 3) medium damage (cure 2) or shitty damage (cure 1), and no longer does a random status effect. I don't see for the life of me why it's doing this, looking at the code here, and am hoping you might be able to see what's going on.

Here's my spell/skill's code which is just an edited Mantra:

C2/4263: A9 60 LDA #$60
C2/4265: 0C A2 11 TSB $11A2 (Set no split damage, & ignore defense)
C2/4268: 9C 14 34 STZ $3414 (Set to not modify damage)
C2/426B: C2 20 REP #$20 (Set 16-bit Accumulator)
C2/426D: B9 18 30 LDA $3018,Y
C2/4270: AE C9 3E LDX $3EC9 (Number of targets)
C2/4273: F0 01 BEQ $4278 (if $3018,Y ANDed with $A4 is zero, the Zero flag will be set.
in other words, we shouldn't decrement the target count
when the caster is not amongst the targets.)
C2/4275: CA DEX
C2/4276: B9 F4 3B LDA $3BF4,Y
C2/4279: EA EA EA NOP
C2/427C: 8D B0 11 STA $11B0 (Set damage)
C2/427F: 60 RTS

Any ideas on how to separate the two?


We are born, live, die and then do the same thing over again.
Quote  

#9
Posts: 290
Threads: 3
Thanks Received: 40
Thanks Given: 1
Joined: Apr 2012
Reputation: 9
Status
None
I don't see anything in either code blocks that should cause any overlap. Did you move the code for Miracle to some other location, maybe?

If not, your best bet is to use Geiger's SNES9x debugger and trace the Mantra-like ability and see if and where it's branching off to Miracle. If you want, I can take a look at this, but I would need a copy of the patch.


GET A SILK BAG FROM THE GRAVEYARD DUCK TO LIVE LONGER.

Brave New World
  Find
Quote  

#10
Posts: 2,549
Threads: 98
Thanks Received: 147
Thanks Given: 159
Joined: Aug 2009
Reputation: 52
Status
Nattak\'d
I did move the Miracle code to some free space I have at C2/CE40. I don't see any conflictions here, it appears to be just free space but its worth a shot to try another place and see if it yields different results. If not I can try the debugger as you suggest and if I still can't get it working I'll take you up on your offer and send the ROM your way.


We are born, live, die and then do the same thing over again.
Quote  



Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite