YesNoOk
avatar

ChangeAnim2 Doesn't Use My Animations... (Read 3713 times)

Started by George777, February 08, 2021, 08:05:56 pm
Share this topic:
ChangeAnim2 Doesn't Use My Animations...
New #1  February 08, 2021, 08:05:56 pm
  • avatar
Hey, so this is probably a simple one, but I've been trying to code an attack where, if I hit an opponent, they go through an animation that I made for them. From the initial attack, the opponent goes through a TargetState function to 4000, which reads as follows:

;Got Hit
[statedef 4000]
type    = A
movetype= H
physics = N
anim = 5150
velset = 0,0

[state 2200]
type = changeanim2
trigger1 = anim = 5150
value = 4000

(This is all there is because I'm trying to get the animation change to work first.)

When I test this ingame, the opponent uses their *own* animation 4000 instead of the one that I made (and animation 5150 never comes up, so that's not a problem). I'm probably missing something simple here, but I'm completely lost. Can I get some help?
Last Edit: February 09, 2021, 06:32:00 pm by George777
Re: ChangeAnim2 Doesn't Use My Animations...
#2  February 08, 2021, 09:05:01 pm
  • ***
  • Non est hoc propter hoc sed propter est hoc
    • USA
    • doubletrend-zeta.neocities.org/
Troubleshooting changeanim2 is a bit of a pain, have you tried testing another animation, like sending them to your 200?
Re: ChangeAnim2 Doesn't Use My Animations...
#3  February 08, 2021, 10:43:00 pm
  • **
  • Don't copy code if you don't understand it.
    • USA
    • a13rown@hotmail.com
If your original code doesn't work, maybe you need to be more specific.  Instead of using the animation for the trigger, maybe use time? Or something else?  For example:

;Got Hit
[statedef 4000]
type    = A
movetype= H
physics = N
anim = 5150
velset = 0,0

[state 2200]
type = changeanim2
trigger1 = !time ;anim = 5150
value = 4000

or

[state 2200]
type = changeanim2
trigger1 = time = 0
value = 4000

That may be the only problem; you might just have to use a more specific trigger.
Re: ChangeAnim2 Doesn't Use My Animations...
#4  February 08, 2021, 11:53:40 pm
  • avatar
Troubleshooting changeanim2 is a bit of a pain, have you tried testing another animation, like sending them to your 200?

If your original code doesn't work, maybe you need to be more specific.  Instead of using the animation for the trigger, maybe use time? Or something else?  For example:

;Got Hit
[statedef 4000]
type    = A
movetype= H
physics = N
anim = 5150
velset = 0,0

[state 2200]
type = changeanim2
trigger1 = !time ;anim = 5150
value = 4000

or

[state 2200]
type = changeanim2
trigger1 = time = 0
value = 4000

That may be the only problem; you might just have to use a more specific trigger.


Going to respond to both because they're a bit related.

I tried calling some different animations, including 200, and they *did* successfully change what animation was shown. This tells me that the trigger for calling the animation change was activating properly, though I also tried the time-based triggers as well, and they had the same effect as checking for anim 5150 so they work too.

Unfortunately, though, ChangeAnim2 was still always calling the target's animations, rather than my own, so we're still stuck here.

Something interesting that I noticed, though, is that looking through the target's files, the animations that get called ingame don't match the animation number that I'm making them call. ChangeAnim2 to 4000 doesn't activate *their* 4000, 200 doesn't activate *their* 200, and so on...

Edit: I just noticed something else interesting. The target is using an animation drawn from its own files (specifically, elems 16, 17, and 18 from its own animation 3020), but I can clearly see that it's using the "framedata" of my animation, which means it's reading information from my animations at least to an extent.
Last Edit: February 09, 2021, 12:20:52 am by George777
Re: ChangeAnim2 Doesn't Use My Animations...
#5  February 09, 2021, 01:55:52 pm
  • avatar
  • *
    • Canada
Post contents of your action 4000? In case there’s any confusion, CA2 will change to your character’s anim data (ie definition from the AIR file) but will still use the target’s sprite data, which sounds like the behaviour you’re describing in the last paragraph

It’s probably also a good idea to pause and stepframe when the opponent reaches your custom state so you can confirm the anim number in debug info

Is the state you posted in the OP the entirety of it? There’s some sort of uncommon bugs that can come up if you use changeanim2 and changeanim both in the custom state

Re: ChangeAnim2 Doesn't Use My Animations...
#6  February 09, 2021, 04:42:55 pm
  • avatar
Post contents of your action 4000? In case there’s any confusion, CA2 will change to your character’s anim data (ie definition from the AIR file) but will still use the target’s sprite data, which sounds like the behaviour you’re describing in the last paragraph

It’s probably also a good idea to pause and stepframe when the opponent reaches your custom state so you can confirm the anim number in debug info

Is the state you posted in the OP the entirety of it? There’s some sort of uncommon bugs that can come up if you use changeanim2 and changeanim both in the custom state

Ah, alright, so I didn't know that CA2 (enforced on the opponent via TargetState) caused the target to still use their own sprites, rather than mine.

So with that in mind, is there some kind of function one could use, that could force the target to use *my* animations and spritework, or would I have to do the roundabout method of creating a Helper using all of my animations and just rendering the opponent invisible temporarily?



Also to answer your question, yes that was the entirety of state 4000. I was trying to get the target to use my animations before I tried going any further with it.

I had also tried this variant, which removed the "CA" from state 4000, but it still gave the same result as the original post:

;Got Hit
[statedef 4000]
type = A
movetype= H
physics = N
velset = 0,0

[state 2200]
type = changeanim2
trigger1 = time = 0
value = 4000
Last Edit: February 09, 2021, 04:49:59 pm by George777
Re: ChangeAnim2 Doesn't Use My Animations...
#7  February 09, 2021, 05:49:15 pm
  • avatar
  • *
    • Canada
Unfortunately you can’t get the opponent to use both your sprites + anims at all, just anims via CA2. If you need to use your sprites, a Helper or Explod with the opponent Invisible+NoShadow is your best bet