bas

Revision as of 18:39, 27 January 2020 by imported>Ginger (→‎Parameters: Clarified JudgeOnce)

bas files each represent an animation that can be called by an actor or cutscene. They contain a reference to an animation name, but not the animation file itself. They can be found at Actor/AS/{EventName}/{AnimationSequenceName}.bas in beventpacks and TitleBG.pack/Actor/AS, and Actor/AS/{AnimationSequenceName}.bas in bactorpacks.


Layout

Each bas file is made up of one list of elements, named Elements. Each element (Element0, Element1, etc) can be either a test to figure out what animation to play, or a call to play the animation.

Parameters

All nodes have Parameters, which determine what kind of node they are. They can be a control node, which helps decide which animation to play, or an animation node, which actually plays the animation.

Key Type Description Type Default value
TypeIndex int Type of node the Element is. Known types are listed below the table. - -
NoSync bool - Control -
JudgeOnce bool Tells the game to skip evaluating this node (and use the previous result) if the input value has not changed since the last time the node was run. Control False
InputLimit float - Control -
FileName str64 Name of the animation to play Animation -
Morph int - Animation -

Parameter TypeIndexes

Index Control Type Animation Type Input (Control)/Output (Animation) Value
1 Range comparison - Current world temperature
7 Unknown - See #BitIndex[1][2][3]
14 Range evaluation - The movement analog stick's current orientation, in degrees, in counter-clockwise fashion. Accepts -359 to 360. (e.g. 270 and -90 both point directly to the right)
16 Range evaluation - Either Link's current movement speed or movement analog stick tilt[4]
44 String comparison - Name of a bone, but unknown how it decides which bone name to use.[5]
47 String comparison - Last played animation name. Known to accept two Children to test against, plus a default case, but might accept more or less.
61 Float comparison - Unknown[6]
62 - Material animation StrRef of the animation name. Its Extend uses a secondary animation name for unknown purpose.[7][8]
64 - Model animation (unknown difference between this and 67) StrRef of the animation name.
67 - Model animation (main usage) StrRef of the animation name.
72 Range evaluation - Unknown[9]
80 Unknown (believed to play multiple animations at once)[10] - -
82 Range evaluation - Unknown[11]
97 String comparison - Link's equipped weapon subtype (from its bgparamlist [ProfileUser] WeaponSubtype value)
98 String comparison - Link's equipped weapon profile (from its bxml ProfileUser value)

Children

Control nodes will have Children, in addition to Parameters, which determine which Element to go to after the control node is evaluated. The properties of Children will be named Child0, Child1, etc, and each will have a single integer value, which will correspond to the Element number. e.g. Child0: 7 points to Element7.

Extend

All nodes have an Extend, which contains specific details about the node. Control node Extends will contain details about the comparison being performed, while animation nodes will contain information about the animation being played, such as: during which frames of the animation a weapon will deal damage if it hits something, when user input is ignored, when to draw weapon trails through the air for attack animations, etc.

Typed Array

A list of variables of a given type to use for various Control comparisons. Corresponds directly the Children of the node. i.e. if Value0 matches the value being compared against, the code will jump to the Element listed under Child0. If no comparison of a lower Child number has evaluated as true, automatically evaluates a Child whose value is "default" as true.[12][13]

BitIndex

Used with Parameter TypeIndex 7. Also has TypeIndex, which are used to perform the check.

  • 2 - Unknown (believed to check if Link has any armor equipped)[2]
  • 30 - Whether or not Link has a shield equipped.[1]
  • 33 - Unknown[3]
  • 46 - Unknown (believed to check if Link is crouched)

Ranges

Used with Parameter TypeIndex 16. If the value being compared is above the Start value and below the End value, evaluates as true. Otherwise, moves on to the next value. (Unknown what happens if none of the Ranges evaluate to true, presumably game crash)

FrameCtrl

Used with Parameter TypeIndex 67. Required, even if it is empty.

Key Type Description Default value
Rate float Speed at which to play the animation. Higher numbers are faster. 1.0
EndFrame int - -

TriggerEvents

Used with Parameter TypeIndex 67. Events which are triggered during this animation.

Key Type Description Default value
TypeIndex int Which type of event to fire. Known events are detailed below -
Frame int Which frame to fire the event on, relative to the frame numbers of the animation. Can be negative. -
Value strRef - -

Known TypeIndex values:

  • 0 - Unknown (believed to define when an attack begins to deal damage)[14]
  • 4 - Triggers the animation controller to transition back into the idle stance. The Frame value should be a few before the end of the actual animation, so that the controller can make the blending look natural.[15]
  • 7 - Call AS. Loads another .bas file and starts evaluating from Element0.
  • 28 - Unknown (seems to always be triggered at frame -2, with value PV%03d, but needs more investigation)

HoldEvents

Used with Parameter TypeIndex 67. States that are entered into while the animation is playing.

Key Type Description Default value
TypeIndex int Which type of event to fire. Known events are detailed below -
StartFrame int Which frame to start the event on, relative to the frame numbers of the animation. Unknown if it can be negative. -
EndFrame int Which frame to end the event on, relative to the frame numbers of the animation. A value of -1 is treated as the ending frame of the animation. -
Value strRef - -

Known TypeIndex values:

  • 0 - Unknown
  • 2 - Unknown
  • 3 - Defines when an attack will deal damage. Value is the damage type. Left: slashing. Stab: piercing. Lower: blunt.
  • 17 - Unknown
  • 25 - Unknown
  • 45 - Defines when to accept input to start the next attack.
  • 48 - Defines when to display the trails in the air during an attack.

References

  1. 1.0 1.1 Element1 of Player_CutNinja.bas, WiiU 1.5.0
  2. 2.0 2.1 Element0 of Player_FaceDefault.bas, WiiU 1.5.0
  3. 3.0 3.1 Element2 of Player_FaceDefault.bas, WiiU 1.5.0
  4. Element2 of Player_CutNinja.bas, WiiU 1.5.0
  5. Element0 of Player_LadderJump.bas, WiiU 1.5.0
  6. Element0 of Player_Move.bas, WiiU 1.5.0
  7. Element1 of Player_SkinColor.bas, WiiU 1.5.0
  8. Element2 of Player_SkinColor.bas, WiiU 1.5.0
  9. Element0 of Player_SwimAtnMove.bas, WiiU 1.5.0
  10. Element0 of Player_FaceTalkWeaponShowSword.bas, WiiU 1.5.0
  11. Element1 of Player_FaceDefault.bas, WiiU 1.5.0
  12. Element0 of Player_CutNinja.bas, WiiU 1.5.0
  13. Element3 of Player_FaceDefault.bas, WiiU 1.5.0
  14. Compare Event0 of TriggerEvents and Event0 of HoldEvents for most of Link's attack animations
  15. Compare TriggerEvent TypeIndex 4 Frame value for an animation with the number of frames in the actual animation.