Joined
Jun 10, 2013
Messages
9
Reaction score
5
First Language
Portuguese
Primarily Uses
Unlimited and Optimized Pictures handle

Introduction
These are just some modifications in the original script.

Features
Remove the auto created (100 default) image objects, and create the image objects dynamically, and when the "erase Picture" is called, it also erase the object.

This doesn't create a object with empty values, it only relocate space for the used images.
So, even if you use, "$gameScreen.showPicture(9999999,"Image_Name", 0, x, y, 100, 100, 255, 0);" it will not make the variable size 9999999.


How to Use
Just save the script as a .js file and add it to your project.

Plugin Commands / Script Calls
The same from original.
As the engine has a limite of 100 when calling throug "Show Picture", use "$gameScreen.showPicture" function.
Example:
JavaScript:
$gameScreen.showPicture(
  id, name, origin, x, y, scaleX, scaleY, opacity, blendMode);
//Like
$gameScreen.showPicture(9999999,"Image_Name", 0, x, y, 100, 100, 255, 0);
You can use any "id" you want.
Like:
JavaScript:
$gameScreen.showPicture("Nun","People2_6", 1, 0, 0, 100, 100, 255, 0);
$gameScreen.showPicture("Doggy","Nature_1", 1, 0, 0, 100, 100, 255, 0);

Script
JavaScript:
var ImageController = undefined;

Game_Screen.prototype.maxPictures = function() {
    return 0;  // Added Line to remove the auto created pictures object
};

Spriteset_Base.prototype.initialize = function() {
    Sprite.prototype.initialize.call(this);
    this.setFrame(0, 0, Graphics.width, Graphics.height);
    this.loadSystemImages();
    this.createLowerLayer();
    this.createUpperLayer();
    this._animationSprites = [];
    ImageController = this; //Added line only to set the ImageController variable
};

Game_Screen.prototype.showPicture = function(pictureId, name, origin, x, y, scaleX, scaleY, opacity, blendMode) {
    const realPictureId = this.realPictureId(pictureId);
    if(ImageController._pictureContainer.children.find(picture => picture._pictureId == realPictureId) == undefined) {//Added line to check if the picture already exist
        ImageController._pictureContainer.addChild(new Sprite_Picture(realPictureId))  //Added line to create the picture object and add it to the container
        const picture = new Game_Picture();
        picture.show(name, origin, x, y, scaleX, scaleY, opacity, blendMode);
        picture.id = realPictureId;
        if(this._pictures.length > 0)
            {
                const ThisPictureIndex = this._pictures.indexOf(this._pictures.find(picture => picture === undefined));
                if(ThisPictureIndex != -1) {
                    this._pictures[ThisPictureIndex] = picture;
                    return;
                } else {
                    this._pictures.push(picture);
                    return;
                }
            }
        else
            this._pictures.push(picture)
    } else {
        $gameScreen.erasePicture(realPictureId);
        $gameScreen.showPicture(pictureId, name, origin, x, y, scaleX, scaleY, opacity, blendMode);
    }
};

Game_Screen.prototype.picture = function(pictureId) {
    const realPictureId = this.realPictureId(pictureId);
    return this._pictures.find(function(picture) {
        if(picture)
            return picture.id === realPictureId
        else
            return false;
    });
};

Sprite_Picture.prototype.remove = function() {
    this.parent.removeChild(this);
};

Game_Screen.prototype.erasePicture = function(pictureId) {
    const realPictureId = this.realPictureId(pictureId);
    this._pictures[this._pictures.indexOf($gameScreen.picture(realPictureId))] = undefined;
    //this._pictures[realPictureId] = null;
    const picture = ImageController._pictureContainer.children.find(picture => picture._pictureId == realPictureId);
    if(picture)
        picture.remove(); //Added line to remove the picture object from the container
};

Game_Screen.prototype.realPictureId = function(pictureId) {
    return pictureId;   //This was changed to only return the same pictureId inserted, function was not removed to keep compatibility with other plugins
};

Terms and Credits
Use it however you like, no need to give me credit, since it's just a modification of the original script.
 
Last edited:

ShadowDragon

Realist
Veteran
Joined
Oct 8, 2018
Messages
7,214
Reaction score
2,850
First Language
Dutch
Primarily Uses
RMMV
would this work in MV too? or is it slightly different?
if it is, would you make that version too for MV users?

as it can be extremely usefull :)
 
Joined
Jun 10, 2013
Messages
9
Reaction score
5
First Language
Portuguese
Primarily Uses
would this work in MV too? or is it slightly different?
if it is, would you make that version too for MV users?

as it can be extremely usefull :)

I'm not really sure about it, gonna download the engine and check it, if isn't gonna try make a MV version of it.
 

Latest Threads

Latest Posts

Latest Profile Posts

9 days left for Harold Jam... hope it's not too late to start gam mak
i think this girl has to be my favorite though :)
62702017_JJKXazrs2LInoZh.png
Wouldn't you know it? Every woman that is interested in me on FB is a bot. Maybe I should respond with 000100100011. If u r willing to date women on FB something has definitely went wrong with your life.
Hello world !! I've created a logo design for my game, I'm calling it "Soup Quest" (It was honestly the best I could come up with <:]) !!
[IMG]https://media.discordapp.net/attachments/866542330286178344/1076307540528332830/Soup_Quest_Game_Logo.png?width=473&height=473[/IMG]
P.S. ty to the person who told me about the "purple text not mixing well with dark mode". I'll be careful on using colored text in the future !!

Forum statistics

Threads
129,747
Messages
1,204,799
Members
170,835
Latest member
KathleenL42
Top