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
Regular
Joined
Oct 8, 2018
Messages
8,238
Reaction score
3,511
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 Profile Posts

Finally started working on my first game, let's see where this gets me :)
Gonna repost this since it's currently tied 1-1! We've seen Strength with our adventurers and Charisma with our merchants, so which DnD stat would you like to see in the next NPC for my advent calendar: Constitution or Wisdom?

And a bonus game: if you can guess what type of character each stat will represent, I’ll make your suggested sprite for Christmas! First person to get it wins, so make your guess!
Steam is going to be forcing me to update my desktop OS for Mac. It's a good thing that my laptop is Windows otherwise some of my work and a lot of game save files for 32-bit games would become unusable for a while.
Last day in Florida and then we head home. It was a fun, relaxing trip with just the wifey poo. Still managed to make some progress on my Game Jam project though.
Never fully realized that I had this account, nice start

Forum statistics

Threads
136,846
Messages
1,270,688
Members
180,610
Latest member
Kayl22
Top