Viv JavaScript Runtime - v0.10.2
    Preparing search index...

    Interface AttemptActionArgs

    Arguments parameterizing a request to force a specific action to be attempted and/or performed.

    These are the effective arguments to attemptAction.

    interface AttemptActionArgs {
        actionName: string;
        causes?: string[];
        initiatorID?: string;
        precastBindings?: RoleBindings;
        suppressConditions?: true;
    }
    Index

    Properties

    actionName: string

    The name of the action to attempt.

    causes?: string[]

    An array containing entity IDs for arbitrary actions that the host application has indicated as causes of the action about to be performed.

    This parameter supports a design pattern in which a host application captures player activity Viv actions. In such a design, the host application might reason about the causes of player activity, to identify which NPC actions led to the behaviors that are being represented as simulation actions via the call here.

    It can also support a design pattern where something like a drama manager decides that it would be desirable if an action that did not occur actually had occurred -- for instance, a character affronted another one, who could have concocted a revenge scheme that fits nicely in a larger central narrative, but they did not happen to queue plot-revenge as a reaction. The drama manager could intervene by effectively forcing plot-revenge with the original affronting action as its cause, which means story sifting could work per usual over the causal line.

    Note: The runtime will confirm that each entry here is in fact the entity ID for some action, and it will also deduplicate the given causes automatically.

    initiatorID?: string

    Entity ID for the character who will attempt the action.

    If elided, characters will be shuffled, and each will attempt the action in turn. If this field is set, the same entity ID must appear in the initial role in precastBindings.

    Note: The runtime will confirm that this is an entity ID for a character.

    precastBindings?: RoleBindings

    Partial or complete role bindings to use when targeting the action.

    If both initiatorID and this field are present, initiatorID must be bound to the initiator role here. If there are any required role slots that have not been precast here, the role caster will attempt to fill them, and targeting will fail if they cannot be filled (though see suppressConditions). Likewise, the role caster will also attempt to fill any unfilled optional role slots.

    suppressConditions?: true

    A flag specifying that the action conditions should be ignored when targeting the action.

    In such cases, the action can effectively be forced to occur, so long as the role caster is able to find enough entities to fill each required role slot. For instance, if precastBindings does not cover all required role slots, and if a given role with an open slot requires nearby characters, and if there are not enough characters near the initiator, then targeting could fail even though this flag was set here. In other words, the flag doesn't force an action to occur, but rather prevents condition failure from thwarting actions for which casts could otherwise be assembled.

    Note that the flag only suppresses the conditions field of the action at hand. Any implied conditions in concerns like casting-pool declarations will still be honored.

    This field should always be true when present.

    false