YesNoOk
avatar

Finding an Frame/Sprite's Value (Read 5286 times)

Started by Capn_Zed, August 15, 2017, 09:39:32 am
Share this topic:
Finding an Frame/Sprite's Value
#1  August 15, 2017, 09:39:32 am
  • *
    • Jamaica
I'm currently making some adjustments to a character I feel is lacking in the form of sprites. I have swapped out their entire running animation (which originally consisted of 2 different sprites) and swapped in 3 brand new frames along with the original start and end frames (both are the same). So the animation is the original start frame, my 3 new sprites and the original end frame. The problem is when I try to code the new frames in the common.cns file, I don't know what the sprite's value is and so cannot assign it for the changeanim state.

So the first changeanim looked like this:
Code:
[State 0, ChangeAnim]
type = ChangeAnim
triggerall = var(0) = 0
trigger1 = vel x > 0 && Anim != 100
value = 100 ; this is what I mean by value

How do I find the 'value' of my new sprites so that I can add them to the changeanim state?
 

Re: Finding an Frame/Sprite's Value
#2  August 15, 2017, 03:26:18 pm
  • ****
  • Robotics Engineer
    • USA
    • altoiddealer@gmail.com
...The problem is when I try to code the new frames in the common.cns file...
Neither adding more sprites to your .SFF (you imported 3 new sprites - I'm assuming your run sprites are now indexed as 100,0 through 100,4),
or adding more animelems to an anim in your .AIR (Your anim 100 had 2 animelems, and you added 3 more)
...will require any changes to the code you provided.

In the .CNS, these changes would really only affect triggers based on animelem (example: "trigger1 = animelem = 2") - and maybe Time (example: "trigger1 = Time = 4")

Maybe you have other code in State 100 or in State -1 (the .CMD file) that has triggers based on animelem or time.

Re: Finding an Frame/Sprite's Value
#3  August 15, 2017, 03:43:04 pm
  • *****
  • Shame on you!
    • USA
Capn_Zed, you create any anim value you want.
The CNS doesn't ever care about sprite index values. Like sprite 0,2 is standing's 3rd frame. The CNS will never know that.
Only the AIR files care about the sprites in the animations.
The SFF file is the actual way those sprites get their numbers.

You can add any new anim to the air file, and add any sprite index from your sff file.

Use Fighter Factory 3, and use CTRL+F to bring up the Find box. Go to the animations and search for 100. You should see the animation. You can edit it, or create a new anim and change the value in the CNS to match it.
vVv Gouken718 vVv
Re: Finding an Frame/Sprite's Value
#4  August 15, 2017, 06:15:28 pm
  • *
    • Jamaica
Capn_Zed, you create any anim value you want.
The CNS doesn't ever care about sprite index values. Like sprite 0,2 is standing's 3rd frame. The CNS will never know that.
Only the AIR files care about the sprites in the animations.
The SFF file is the actual way those sprites get their numbers.

You can add any new anim to the air file, and add any sprite index from your sff file.

Use Fighter Factory 3, and use CTRL+F to bring up the Find box. Go to the animations and search for 100. You should see the animation. You can edit it, or create a new anim and change the value in the CNS to match it.

I've found the animation in the .air file. The startup frame had a value of 100. What value do the other 4 frames have? Or how do I create an anim value? Originally the 2 values used for the run were 100 and 10100.
Re: Finding an Frame/Sprite's Value
#5  August 15, 2017, 07:26:56 pm
  • ****
  • Robotics Engineer
    • USA
    • altoiddealer@gmail.com
It's highly recommended to use Fighter Factory 3 to edit your character, which has very user friendly interfaces for managing Sprites and Animations.

Launch the program, Open your character, then check out the Sprites tab and Animation tab - you'll see that it's pretty straight-forward

Re: Finding an Frame/Sprite's Value
#6  August 16, 2017, 08:02:25 pm
  • *
    • Jamaica
It's highly recommended to use Fighter Factory 3 to edit your character, which has very user friendly interfaces for managing Sprites and Animations.

Launch the program, Open your character, then check out the Sprites tab and Animation tab - you'll see that it's pretty straight-forward

Well I downloaded it but nothing seemed too different from what I had before. The only value shown for animations were the ones for the first frame of each animation.
So what I did was I replaced the sprites for the running group (which was 10 here) with my 3 new ones. So my sprites were now in group 10 and had the indexes 0,1......
With that, I put the value 10100 for my first new sprite in the first changeanim value. Then for the rest, I just put animelem = 3, 4 .....

The whole thing looked like this
Code:
[Statedef 100]
type    = S
physics = S
sprpriority = 1

[State 0, PlaySnd]
type = PlaySnd
trigger1 = animelem = 2
trigger2 = animelem = 3
trigger3 = animelem = 4
trigger4 = animelem = 5
value = S0, 68
volume = 1000

[State 0, Explod]
type = Explod
trigger1 = time = 1
anim = 53547
ID = 53547
pos = 10,-5
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = 1
vel = 0,0
accel = 0,0
random = 0,0
removetime = -2
sprpriority = 0
ontop = 0
scale = 0.5

[State 0, ChangeAnim]
type = ChangeAnim
triggerall = var(0) = 0
trigger1 = vel x > 0 && Anim != 100
value = 100

[State 0, ChangeAnim]
type = ChangeAnim
triggerall = var(0) = 0
trigger1 = vel x > 0 && Animelem != 10100
value = 10100

[State 0, ChangeAnim]
type = ChangeAnim
triggerall = var(0) = 0
trigger1 = vel x > 0 && Animelem != 3
value = animelem = 3

[State 0, ChangeAnim]
type = ChangeAnim
triggerall = var(0) = 0
trigger1 = vel x > 0 && Animelem != 4
value = animelem = 4

[State 0, ChangeAnim]
type = ChangeAnim
triggerall = var(0) = 0
trigger1 = vel x > 0 && Animelem != 5
value = animelem = 5


[State 100, 1]
type = VelSet
triggerall = var(0) = 0
trigger1 = 1
x = const(velocity.run.fwd.x)

[State 100, 1]
type = VelSet
triggerall = var(0) = 1
trigger1 = 1
x = const(velocity.run.fwd.x) + 5

[State 100, 1]
type = VelSet
triggerall = var(0) = 1
trigger1 = 1
x = const(velocity.run.fwd.x) + 10

[State 100, 1]
type = VelSet
triggerall = var(0) = 1
trigger1 = 1
x = const(velocity.run.fwd.x) + 15

[State 100, 1]
type = VelSet
triggerall = var(0) = 1
trigger1 = 1
x = const(velocity.run.fwd.x) + 20


[State 100, 1]
type = VelSet
triggerall = var(0) = 1
trigger1 = 1
x = 8.0

[State 100, 2] ;Prevent run from canceling into walk
type = AssertSpecial
trigger1 = 1
flag = NoWalk

[State 100, 3] ;Prevent from turning
type = AssertSpecial
trigger1 = 1
flag = NoAutoTurn

[State 100, 4]
type = ChangeState
trigger1 = command != "holdfwd"
value = 0

It is not perfect in game but it's more or less what I wanted and it worked so thanks for the help, especially with the animelem part.
Re: Finding an Frame/Sprite's Value
#7  August 16, 2017, 09:31:10 pm
  • ****
  • Robotics Engineer
    • USA
    • altoiddealer@gmail.com
I don't think you understand how animations work heh.

When your character is triggered to changeanim, the animation will play forever until another Changeanim is triggered.  The anim will loop from the beginning, unless you check the "repeat from this frame" checkbox - in which case the anim will loop from there instead.

Code:
[State 0, ChangeAnim]
type = ChangeAnim
triggerall = var(0) = 0
trigger1 = vel x > 0 && Anim != 100
value = 100

I'm not sure what var(0) represents, but this probably triggers immediately - meaning your character will use Anim 100.  So, Anim 100 will play until another Changeanim is triggered.


These controllers probably are not doing anything at all (except creating debug flood errors) because the animelem trigger can't be used in the parameter like this

Code:
[State 0, ChangeAnim]
type = ChangeAnim
triggerall = var(0) = 0
trigger1 = vel x > 0 && Animelem != 3 <<<< I don't think MUGEN will recognize animelem trigger unless an anim is also being checked. Example: anim = 100 && animelem != 3
value = animelem = 3 <<<< If this was a valid parameter (it's not) then it would return either 1 or 0.
 
[State 0, ChangeAnim]
type = ChangeAnim
triggerall = var(0) = 0
trigger1 = vel x > 0 && Animelem != 4
value = animelem = 4
 
[State 0, ChangeAnim]
type = ChangeAnim
triggerall = var(0) = 0
trigger1 = vel x > 0 && Animelem != 5
value = animelem = 5

Last Edit: August 16, 2017, 09:35:52 pm by altoiddealer
Re: Finding an Frame/Sprite's Value
#8  August 16, 2017, 11:30:31 pm
  • *
    • Jamaica
I don't think you understand how animations work heh.

When your character is triggered to changeanim, the animation will play forever until another Changeanim is triggered.  The anim will loop from the beginning, unless you check the "repeat from this frame" checkbox - in which case the anim will loop from there instead.

Code:
[State 0, ChangeAnim]
type = ChangeAnim
triggerall = var(0) = 0
trigger1 = vel x > 0 && Anim != 100
value = 100

I'm not sure what var(0) represents, but this probably triggers immediately - meaning your character will use Anim 100.  So, Anim 100 will play until another Changeanim is triggered.


These controllers probably are not doing anything at all (except creating debug flood errors) because the animelem trigger can't be used in the parameter like this

Code:
[State 0, ChangeAnim]
type = ChangeAnim
triggerall = var(0) = 0
trigger1 = vel x > 0 && Animelem != 3 <<<< I don't think MUGEN will recognize animelem trigger unless an anim is also being checked. Example: anim = 100 && animelem != 3
value = animelem = 3 <<<< If this was a valid parameter (it's not) then it would return either 1 or 0.
 
[State 0, ChangeAnim]
type = ChangeAnim
triggerall = var(0) = 0
trigger1 = vel x > 0 && Animelem != 4
value = animelem = 4
 
[State 0, ChangeAnim]
type = ChangeAnim
triggerall = var(0) = 0
trigger1 = vel x > 0 && Animelem != 5
value = animelem = 5


So if I take them out it wouldn't change a thing then? Ok I get it know. Thanks.
Re: Finding an Frame/Sprite's Value
#9  August 17, 2017, 01:43:29 am
  • *****
  • Shame on you!
    • USA
it seems like you're trying to set a variable to adjust your speed and animation.
Spoiler, click to toggle visibilty

Similarly you have your change anims set up improperly.
Spoiler, click to toggle visibilty

Hopefully these notes will clear up some problems
vVv Gouken718 vVv