@cccode/fxr - v22.0.0

    Class StateCondition

    Index

    Constructors

    • A condition for a state. The state remains active if all of its conditions are true or if it has no conditions. If the condition is false, the state is deactivated and the next state (nextState) is activated.

      Parameters

      • operator: Operator

        Controls what operation should be used for the condition.

      • unk1: number

        Unknown. Seems to always be 2 in vanilla Elden Ring. 3 seems to make the condition always true.

      • nextState: number

        If the condition is false, the state at this index will be checked next. Set it to -1 to disable the sfx if the condition is false.

      • leftOperandType: OperandType

        Controls what type of value the operand to the left of the operator should be.

      • leftOperandValue: number

        This does different things depending on the leftOperandType:

      • rightOperandType: OperandType

        Controls what type of value the operand to the right of the operator should be.

      • rightOperandValue: number

        This does different things depending on the rightOperandType:

      Returns StateCondition

    Properties

    leftOperandType: OperandType

    Controls what type of value the operand to the left of the operator should be.

    leftOperandValue: number

    This does different things depending on the leftOperandType:

    nextState: number

    If the condition is false, the state at this index will be checked next. Set it to -1 to disable the sfx if the condition is false.

    operator: Operator

    Controls what operation should be used for the condition.

    rightOperandType: OperandType

    Controls what type of value the operand to the right of the operator should be.

    rightOperandValue: number

    This does different things depending on the rightOperandType:

    unk1: number

    Unknown. Seems to always be 2 in vanilla Elden Ring. 3 seems to make the condition always true.

    Methods

    • Swaps the operands and changes the operator to match if the left operand is a literal value and the right operand is a non-literal value. This makes it a bit easier to read the expression, but doesn't affect functionality.

      Returns StateCondition

    • Parses a logical expression in a string and creates a StateCondition from it.

      Parameters

      • expression: string | StateCondition

        A string with a logical expression and optionally an else statement with a state index.

        expression = <operand> <operator> <operand>[ else[ goto] <stateIndex>]
        operand = <number> | External(<integer>) | StateTime | UnkMinus2
        operator = != | == | > | >= | < | <=
        stateIndex = <integer> | none
        

        External, StateTime, and UnkMinus2 are all case-insensitive and have shorter variations available. Here are some examples:

        ext(0)
        stateTime
        time
        minus2
        
        ext(0) > 1
        time < 5 else goto 2
        1 != External(10000) else 1
        

      Returns StateCondition

      A new StateCondition based on the expression.

    MMNEPVFCICPMFPCPTTAAATR