IdaJS
    Preparing search index...

    Interface Image

    The global image object provides methods to manage custom images in the mod.

    It allows loading user images and replacing existing game images.

    interface Image {
        PaletteAlgorithms: PaletteAlgorithms;
        Pictures: GamePictures;
        Videos: GameVideos;
        replace(gameImageId: number, imageName: string): number;
        restore(gameImageId: number): void;
        use(imageName: string): number;
        _reset(): void;
    }
    Index

    Properties

    PaletteAlgorithms: PaletteAlgorithms

    Palette conversion algorithms for png images importing (if you want to customize the style and improve the quality).

    Pictures: GamePictures

    Picture IDs from SCREEN.HQR in the vanilla LBA2 game.

    Videos: GameVideos

    Video file names for cutscenes in the vanilla LBA2 game (from VIDEO.HQR)

    Methods

    • Replaces a vanilla game image with a custom image. This allows overriding existing game images from SCREEN.HQR with custom ones. The replacement happens in runtime only, no HQR file is changed.

      The image size should be 640x480.

      Parameters

      • gameImageId: number

        The ID of the game image to replace (0 to 38 for vanilla game files).

      • imageName: string

        The name of the custom image file to use as replacement. Should be located in the mod's media/images folder, subfolders are allowed.

      Returns number

      The game image ID if successful, or undefined if parameters are invalid.

      image.replace(image.Pictures.MapEmeraldMoon, "myEmeraldMoonMap.png");
      
    • Restores a previously replaced game image to its original state. This removes the custom image replacement for the specified game image ID.

      Parameters

      • gameImageId: number

        The ID of the game image to restore to original.

      Returns void

      image.restore(image.Pictures.MapEmeraldMoon); // Restores game image MapEmeraldMoon to its original state
      
    • Sets the current user image to be used in LifeOpcodes.LM_PCX and LifeOpcodes.LM_PCX_MESS_OBJ life commands. The image file should be located in the mod's media/images folder, subfolders are allowed.

      The image size should be 640x480.

      Parameters

      • imageName: string

        The name of the image file to use (without path). Should be a valid filename without backslashes.

      Returns number

      The image ID that can be used to reference this image, or undefined if the image name is invalid.

      ida.life(objectId, ida.Life.LM_PCX, image.use("my-custom-image.png"), 0);
      
    • Private

      Resets all image data.

      Returns void

      This is an internal method and should not be used directly. Use only if you know what you are doing.