Character Definitions

From mugen-net
Revision as of 16:24, 27 October 2020 by Onisatomimi No Miko (talk | contribs) (Details the loading order of the CNS files specified by a character's definitions file.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

When MUGEN is loading a character's states ([Statedef XXX], [State YYY]), the following file types designated in the char's definition file's [Files] section are loaded in the following order:

  • st
  • st0
  • st1
  • st2
  • st3
  • st4
  • st5
  • st6
  • st7
  • st8
  • st9
  • cmd*
  • stcommon

*The [Command], [Remap], and [Defaults] sections of the cmd file are loaded prior to the state data/code loading process, probably so that MUGEN can tell which uses of the command trigger are valid or not:

[Command]
name = "ValidCommand"
command = ~D, DF, F, x

[Statedef -1]

[State Trigger Example]
trigger1 = !AILevel
trigger1 = ctrl
trigger1 = command = "ValidCommand"         ; Checks if the "ValidCommand" command has been inputted
trigger2 = command = "CommandThatIsInvalid" ; Causes an error since "CommandThatIsInvalid" is not a specified command

MUGEN ignores duplicated states, which is why the notion of 'overwriting' the common states usually found in the file designated as stcommon exists. The notion that MUGEN 'overwrites' states is incorrect though.

Specifying [Statedef 0] in say the file designated as st9 would make MUGEN ignore the one in stcommon, and a [Statedef -1] designated in stcommon would be ignored unless you remove the one in cmd.

Every one of the above files, if put in the [Files] section of a character's definition file, must contain at least one state, including cmd. Which is why [Statedef -1] is put in cmd to fill that hole and make MUGEN happy.

MUGEN doesn't load state code in the cns file in [Files], as in it ignores the [Statedef XXX] and [State YYY] sections entirely. However you can do what Kung Fu Man does and use the same file path for multiple file types:

st   = kfm.cns ; Parses the '[Statedef XXX]' and '[State YYY]' sections of "kfm.cns" to load state code for the character
cns  = kfm.cns ; Parses the '[Data]', '[Quotes]', '[Movement]', '[Size]', and '[Velocity]' sections of "kfm.cns" to load constants for the character
anim = kfm.cns ; Parses the '[Begin Action XXX]' sections to load animations for the character and their corresponding hitboxes

It is currently unknwon where and when in the loading process MUGEN loads the anim, sprite, and sound files specified in the [Files] section.