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
6,651
Reaction score
2,580
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

Thinking of getting a mechanical keyboard, eventually! Would anyone be interested in a chill keycap-painting stream?
Walked through the rain to take pictures of an 50+ year old printing press for my students. Hope they will honor that effort xD
Can I promote my %75 OFF Creator Day Sale here, or it's against forum rules as well? :kaocry:
Tests for an alert system that spawns enemy reinforcements, as a stealth game should do :kaoswt2:
playing around animations with character sprites. having parallel events playing around with variables while also having an event have that same variable does wonders.

Forum statistics

Threads
126,908
Messages
1,182,248
Members
166,712
Latest member
Monet456
Top