[From Discord] Shock step back - C-Dude - 01-11-2022
Lightning was trying to get Shock to animate properly when called as a spell animation, and Everything worked out a solution by modifying the Shock sprite layer to add a step-back routine jump. I believe this sort of change is very important to document, so I'm copying the Discord conversation here for posterity.
- Lightning — Today at 11:24 AM
So, per the conversation earlier, I decided to enable animations for Miracle, so the player knows if Cure1, Cure2, or Cure3 are being performed. However, I actually don't want the magic casting intro, because it's supposed to be more of a natural thing for Leo as opposed to magic. Any way I can disable the magic intro?
- CDude — Today at 1:21 PM
Should set it to the pointer for Blitz or Swdtech instead.
1b7a8 to 0x8d 0xb6 [<- 1.1 values]
- Lightning — Today at 2:03 PM
Cdude and I were private messaging a bit, and although we hit a brick wall, I'll ask the question here in case anyone has solved it: Is there a way to make Shock take a step back after stepping forward as a normal spell?
- everything8215 — Today at 2:27 PM
Did you disable the pre-attack animation?
- Lightning — Today at 2:28 PM
I think @CDude tried that, but I'm not entirely sure if that's what we did
- everything8215 — Today at 2:30 PM
There's a flag that gets set during the pre-attack animation that makes the character step back afterwards. If you disable the pre-attack animation they won't step back.
That's assuming you're doing the shock animation as a normal spell.
- Lightning — Today at 2:37 PM
I'm pretty sure Cdude looked into that. I believe the problem here is that shock is hard coded into C1 bank. That being said, I have the new Miracle code pointing Shock to spell Ids 172, 173, and 174 - but I believe parts of the animation are still handled elsewhere
- everything8215 — Today at 2:40 PM
Did you modify the animation jump table value for shock at C1/B7AB? The vanilla value is $BB49 (v1.0 ROM)
- Lightning — Today at 2:41 PM
Yup, although it's different for a 1.1 rom. I changed that value to E8 AB (EB AB for 1.0 rom). It successfully uses the spell animation instead of the hard coded animation, but the step forward persists without the step backward
So that part might still be chosen from C1 bank, but I don't understand it as well as Cdude
- everything8215 — Today at 2:42 PM
Okay great. Does it do the pre-attack animation?
- Lightning — Today at 2:42 PM
Leo steps forward, does the sword swing, the spell animation plays, but then he doesn't step back
What's strange is that Gau's rage works with this. you would think it would be broken too.
With Retainer. I just thought of that
- everything8215 — Today at 2:43 PM
Ah okay. Let me take a look and see if I can figure out why it's doing that
- Lightning — Today at 2:48 PM
Actually, you know what's strange? If I have Gau rage one of my relocated Megahit spells (with all the exact animations), he uses the Lore casting effect first before performing the attack
so I guess Megahit at ID 130 is hard coded somewhere
Oh yeah, it IS hardcoded! You can't change the spell animation of 130 to anything else. I just tested that
And now that I've changed the animation to E8 AB, Gau does not take a step back either if I choose ID 130
Although if I choose the new location for megahit, he casts the lore thing and steps back like he should
- everything8215 — Today at 2:56 PM
The step forward for shock is in the sprite animation script. This is different from normal spells where the step forward is part of the pre-attack animation. The step back works differently for normal spells than it does for commands, but there must be some way to make it take the step back anyway
everything8215 — Today at 3:11 PM
Try this. Starting at D0/68B1 insert
D0/68B1: 89 40 loop start (64 times)
D0/68B3: 0A [$0A]
D0/68B4: 8A loop end
D0/68B5: BF 40 70 jump to subroutine $7040
D0/68B8: FF end of script
That should modify the shock animation script to include the step back
Might not work lol
- Lightning — Today at 3:16 PM
Haha, he does in fact move back, but he "slides" back into place with no walk animation, and his arms stay up in the air
- everything8215 — Today at 3:16 PM
maybe we can do better lol
Instead of 7040 try 708E or 70DC
They're all similar but I don't really know what the difference is
- Lightning — Today at 3:20 PM
You mean instead of 40 70?
Do I reverse those bytes?
- everything8215 — Today at 3:20 PM
Yes
8E 70 etc.
- Lightning — Today at 3:20 PM
got it
Getting better, although he still kind of awkwardly slides into place and his feet are in a fighting position, but at least his arms are down now. lol
With 70 DC, that is
70 8E appears the same as 70 40
- CDude — Today at 3:34 PM
Okay, I get what Everything is shooting for, yeah, that's the animation for walking back. The awkward slide must be because the actor is set not to use the walking animation when moving. I... don't exactly recall how to reset that, though.
- everything8215 — Today at 3:36 PM
Okay let's try something a little messy. Revert the changes you did at D0/68B1 and insert this instead:
D0/68B5: BF 4A CF jump to subroutine $CF4A
D0/68B5: FF end of script
then at D0/CF4A (should be unused space) insert
D0/CF4A: 89 20 loop start (32 times)
D0/CF4C: 1F [---]
D0/CF4D: 8A loop end
D0/CF4E: 81 00 00 change attacker graphic to 0 (no action)
D0/CF51: BF 40 70 jump to subroutine $7040
D0/CF54: C0 return from subroutine
I think resetting to "no action" should restore the walking animation
But I couldn't get it to fit in the vanilla shock script
- CDude — Today at 3:38 PM
Subroutine to freespace is a good move, though. I don't think that Lightning will mind. I'm extra wary of animation scripts because I was getting into trouble when I tried to end them early, but that's more about the number of frames to play out than the bytes used.
- Lightning — Today at 3:39 PM
Yeah, using free space doesn't bother me much
- CDude — Today at 3:40 PM
It's weird that there are so many walk backward options... I was looking to see if it was a left/right/center formation thing, but I couldn't find any commands calling them conditionally like that.
- everything8215 — Today at 3:42 PM
Yeah it almost always uses forward and backward instead of left and right so that the animations can be the same for all battle types
- CDude — Today at 3:42 PM
Alrighty, good luck sorting this out, thank you Everything for helping. I've gotta bounce, take care all.
- Lightning — Today at 3:43 PM
See ya Cdude, thanks for help again
Shouldn't I start that jump command at D0/68B1 and not D0/68B5?
Otherwise isn't it doing the 89 20 twice?
- everything8215 — Today at 3:46 PM
Before I did 89 40, which skips 64 frames. Now it skips 32 frames and then 32 more frames. I think maybe he puts the sword down in between or something
Yeah it hides the sword sprite in between
- Lightning — Today at 3:47 PM
Is this correct then?
- [url=https://cdn.discordapp.com/attachments/151099327580864513/930578625873444884/checking.jpg][/url]everything8215 — Today at 3:48 PM
Yeah looks right
- Lightning — Today at 3:49 PM
He moves back into place, then a freeze ensues
It looked animated, though!
Is there something we are missing at the end of that command?
- everything8215 — Today at 3:51 PM
hmm, maybe? maybe it can't do nested subroutines
- Lightning — Today at 3:51 PM
Too much in the animation or something?
- everything8215 — Today at 3:56 PM
Okay revert the previous changes and try this:
D0/68B1: 89 40 loop start (64 times)
D0/68B3: 0A [$0A]
D0/68B4: 8A loop end
D0/68B5: FA 26 02 jump to $0226
- Lightning — Today at 4:01 PM
I think we have a winner!
So far I don't see any issues. He stays in the battle pose longer than the original animation I believe, but it's actually kind of a nice change
Makes it seem like he's making sure his opponents are down
Thanks, everything. You'll be added to my credits.
- everything8215 — Today at 4:05 PM
Thanks. Actually I just realized there's a way to do it so that he will put the sword down
- Lightning — Today at 4:06 PM
Oh yeah? I'll try it out
- everything8215 — Today at 4:07 PM
Revert everything and try this:
D0/68B5: FA 4A CF jump to $CF4A
D0/CF4A: 89 20 loop start (32 times)
D0/CF4C: 1F [---]
D0/CF4D: 8A loop end
D0/CF4E: 81 00 00 change attacker graphic to 0 (no action)
D0/CF51: BF 40 70 jump to subroutine $7040
D0/CF54: FF end of script
- Lightning — Today at 4:12 PM
When I put FA 4A CF, should I also change the remaining 8A after that to FF? I guess it doesn't matter since it's not used
- everything8215 — Today at 4:15 PM
Yeah it doesn't matter
- Lightning — Today at 4:16 PM
Working well so far! I guess the difference is that he drops his sword before walking back?
It looks just like it's supposed to the new way I believe
- everything8215 — Today at 4:19 PM
Yeah it should look the same as the vanilla animation now
- Lightning — Today at 4:20 PM
It's no different that I can tell!
- everything8215 — Today at 4:20 PM
Great, I'm glad it's working!
- Lightning — Today at 4:21 PM
Good job on that; I think that's something that stumped many people in various threads I've looked up
- everything8215 — Today at 4:22 PM
Yeah, I feel like I understand the stepping forward and back stuff a bit better now
- Lightning — Today at 4:25 PM
Might help a lot of people who want to modify other commands. Actually, I remember we stopped the walking forward and backward with Gau and rage with Blitz/Flood/Flame, and now I wonder if your stuff would work there too
That was like back in 2018 when nobody could figure out how to add the step back
- everything8215 — Today at 4:30 PM
You can probably just jump to the same code we added. If you insert
FA 4E CF
at the end of any animation script now it will make the character step back. Jumping to CF4E instead of CF4A skips the 32 frame skip that was needed for shock
Actually
FA 26 02
will do the same thing without jumping to unused space
- Lightning — Today at 4:44 PM
Oh, so at D0/68B5 I can just put FA 26 02?
Or do you mean only for other animations?
- everything8215 — Today at 4:58 PM
For other animations. Shock needs the extra 32 frame loop at D0/CF4A so that Leo puts the sword down before stepping back
It might be tricky to squeeze in 3 bytes at the end of other scripts though
You can always replace the
FF
script terminator, but you would need 2 more bytes to insert the jump
- Lightning — Today at 5:03 PM
I see. I probably won't get involved with the rage stuff since Gau doesn't take a step forward with Sandstorm and other moves anyway. Maybe one day.
We have it set so he doesn't move at all right now
TL, DR: To make Shock properly step back when called from a command that isn't the Shock command, make these changes to its animation script.
- D0/68B5: FA 4A CF jump to $CF4A
- D0/CF4A:89 20 loop start (32 times)
- D0/CF4C: 1F [---]
- D0/CF4D: 8A loop end
- D0/CF4E: 81 00 00 change attacker graphic to 0 (no action)
- D0/CF51: BF 40 70 jump to subroutine $7040
- D0/CF54: FF end of script
|