IdaJS
    Preparing search index...

    Interface Ida

    The global ida object provides access to the mod engine configuration and API.

    interface Ida {
        IslandOverrides: IslandOverrides;
        Life: LifeOpcodes & LifeFunctions;
        LogLevels: LogLevels;
        Move: MoveOpcodes;
        StormModes: StormModes;
        disableLightning(): void;
        enableLightning(): void;
        forceIsland(islandOverride: IslandOverride): void;
        getAnimations(entityId: number): Uint16Array;
        getBodies(entityId: number): { [key: number]: string };
        getFirstImageId(): number;
        getFirstTextId(): number;
        getLogLevel(): LogLevel;
        getTextLanguage(): "en" | "fr" | "de" | "es" | "it" | "pt";
        getVoiceLanguage(): "en" | "fr" | "de";
        halt(): void;
        life(
            objectId: number,
            opcode: LifeOpcode,
            ...args: (string | number)[],
        ): void;
        lifef(objectId: number, opcode: LifeFunction, ...args: number[]): number;
        setEppEnabled(enabled: boolean): void;
        setIntroVideo(name: string): void;
        setLogLevel(level: LogLevel): void;
        setStartSceneId(sceneId: number): void;
        setStorm(mode: StormMode): void;
        useImages(configuration?: ImagesConfiguration): void;
        _cmove(objectId: number): Uint8Array<ArrayBufferLike>;
        _disableMove(objectId: number): void;
        _enableMove(objectId: number): void;
        _isMoveActive(objectId: number): boolean;
        _move(
            objectId: number,
            savedCode: number[],
            opcode: MoveOpcode,
            ...args: (string | number)[],
        ): void;
        _setMoveHandler(callback: (objectId: number) => void): void;
        _stopMove(objectId: number): void;
    }
    Index

    Properties

    IslandOverrides: IslandOverrides

    The island overrides options, which can be used with forceIsland().

    The string => number enum object, containing Life Script opcodes.

    LogLevels: LogLevels

    The log levels, which can be used to filter console logs.

    The string => number enum object, containing Move Script opcodes.

    StormModes: StormModes

    The force storm modes, which can be used with setStorm().

    Methods

    • Disables the lightning effect in the game life script. This is usefull when you called setStorm(StormModes.ForceNoStorm) and do not want to disable lightning actors on each separate scene.

      Returns void

    • Enables the lightning effect in the game life script. Enabled by default. Call it to re-enable if it was disabled.

      Returns void

    • Forces the game to use a specific island 3D model for Citadel and Celebration, overriding what is dictated by the game variables.

      Parameters

      Returns void

      IslandOverrides for the possible overrides.

    • Gets the available animations for the given entity ID.

      Parameters

      • entityId: number

        The ID of the 3D entity to get the animations for.

      Returns Uint16Array

      A Uint16Array containing the animation IDs.

    • Gets the available body models for the given entity ID.

      Parameters

      • entityId: number

        The ID of the 3D entity to get the body models for.

      Returns { [key: number]: string }

      An object mapping body model IDs to their names.

    • Returns the lowest free image ID, which is allowed for the mod engine to use.

      Returns number

    • Returns the lowest free text ID, which is allowed for the mod engine to use.

      Returns number

    • Returns the language, currently used in the game for text ("en", "fr", "de", "es", "it", "pt").

      You can use it for localizing your mod dialogs and text.

      Returns "en" | "fr" | "de" | "es" | "it" | "pt"

    • Returns the language, currently used in the game for voice ("en", "fr", "de").

      Returns "en" | "fr" | "de"

    • Halts the mod engine, stopping all scripts. Put it into the beginning of your index.js to temporarily stop your mod logic. Usefull for debugging purposes.

      Returns void

    • Executes a low level life script command of the game.

      Can be used only within the lifeHandler call.

      Parameters

      • objectId: number

        The ID of the object that executes this command. This should be always the id of the object on which this life handler is executed. Life handler callback function has it as the first parameter.

      • opcode: LifeOpcode

        The life script opcode to execute. Use one LM_* opcodes from the ida.Life (LifeOpcodes) enum object.

      • ...args: (string | number)[]

        The arguments for the life script command. Use LifeOpcodes documentation to know which arguments are needed for each opcode.

      Returns void

       ida.life(objectId, ida.Life.LM_CAMERA_CENTER, 0);
      
    • Executes a low level life script function of the game, returning a result.

      Parameters

      • objectId: number

        The ID of the object that executes this function. This should be always the id of the object on which this life handler is executed. Life handler callback function has it as the first parameter.

      • opcode: LifeFunction

        The life script function opcode to execute. Use one LF_* opcodes from the ida.Life (LifeFunctions) enum object.

      • ...args: number[]

        The arguments for the life script function. Use LifeFunctions documentation to know which arguments are needed for each function.

      Returns number

      The result of the life script function execution. Use LifeFunctions documentation to know the return type for each function.

      Can be used only within the lifeHandler call.

       if (ida.lifef(objectId, ida.Life.LF_DISTANCE, twinsenId) > 1200)) {
      // do something if distance to Twinsen is more than 1200 units away from this actor
      }
    • Enables or disables the Execution Protection Policy (EPP) system (enabled by default). EPP protects the game from crashes and abnormal behavior caused by executing commands in wrong contexts.

      Parameters

      • enabled: boolean

        true to enable, false to disable

      Returns void

      Disabling EPP might cause crashes and other issues in the game. Only disable if you know what you are doing.

    • Sets the intro video to play at the start of the new game. By default, it's "INTRO".

      Parameters

      • name: string

        The name of the video file to play (with or without extension).

      Returns void

      GameVideos to select from the vanilla game videos.

    • Sets the current log level to display for console logs.

      Default is LogLevels.Info.

      The messages with a lower level will not be displayed.

      Parameters

      Returns void

    • Sets the starting scene ID for the game. By default, it's 0 (Twinsen's house). Call it at the beginning of your mod script to start the game in a different scene.

      Parameters

      • sceneId: number

        The ID of the scene to start the game in.

      Returns void

    • Experimental

      Allows to force stormy or sunny weather, independently of LBA2 game variables state.

      Parameters

      Returns void

      Experimental feature: The stormy weather was designed for the Citadel island. Overall, it works on other islands too, but is not guaranteed to look good there.

      StormModes for the possible modes.

    • Imports user PNG images and sprites from the media folder to be used in the game. Please run this in the beginning of your mod script, if you are using custom dialog sprites or images anywhere in your mod.

      Parameters

      Returns void

      ImagesConfiguration for the configuration options.

    • Private

      Continues execution of the current move script command on the object, if it's not finished yet.

      Parameters

      • objectId: number

        The ID of the object to move.

      Returns Uint8Array<ArrayBufferLike>

      Move opcodes being executed including the in-memory changes for persistent move commands, otherwise undefined.

      Do not use! This is a system level function, and is used in the coroutine system. Only use it directly if you are implementing your own coroutine system and know what you are doing.

    • Private

      Disables further Ida move script executions on the object, until re-enabled. Also does the stopMove() internally.

      Parameters

      • objectId: number

        The ID of the object to disable move scripts on.

      Returns void

      Do not use! This is a system level function, and is used in the coroutine system. Only use it directly if you are implementing your own coroutine system and know what you are doing.

    • Private

      Re-enables further Ida move script executions on the object.

      Parameters

      • objectId: number

        The ID of the object to enable move scripts on.

      Returns void

      Do not use! This is a system level function, and is used in the Ida coroutine system. Only use it directly if you are implementing your own coroutine system and know what you are doing.

    • Private

      Checks if the object is currently running a move script command.

      Parameters

      • objectId: number

        The ID of the object to check.

      Returns boolean

      Do not rely on! This is a system level function, and is used in the coroutine system. Only use it directly if you are implementing your own coroutine system and know what you are doing.

    • Private

      Starts execution of a low level move script command on an actor. Can be used only within the moveHandler call.

      Parameters

      • objectId: number
      • savedCode: number[]
      • opcode: MoveOpcode
      • ...args: (string | number)[]

      Returns void

      Do not use! This function is normally executed by the coroutine system. Only call it directly if you are implementing your own coroutine system and now what you are doing.

      MoveOpcodes for the possible opcodes (MO_*) and their arguments.

    • Private

      Sets an Ida move handler callback to handle Move scripts for all the objects.

      Parameters

      • callback: (objectId: number) => void

      Returns void

      This is managed by Ida coroutines system internally. Only use this function, if you know what you are doing.

    • Private

      Stops the current move script command on the object, if it's running.

      Parameters

      • objectId: number

        The ID of the object to stop moving.

      Returns void

      Do not use! This is a system level function, and is used in the coroutine system. Only use it directly if you are implementing your own coroutine system and know what you are doing.