Random load image

Discussion in 'JS Plugin Requests' started by Soulrender, Aug 1, 2019.

  1. Soulrender

    Soulrender Veteran Veteran

    Messages:
    149
    Likes Received:
    78
    First Language:
    Poland
    Primarily Uses:
    RMMV
    Hello, it's been a while when I asked your for help, but I stuck in cosmetic problem, but I don't have a time to take care of it, so
    I wanted to ask you for a plugin that will display random image from directory specified by plugin parameter when game files are preloaded. I cannot offer a money for my request, but If you are a gentelman I am sure we can make a good deal.
     
    #1
  2. Eliaquim

    Eliaquim Raze: The Rakuen Zero's Guardian! Veteran

    Messages:
    660
    Likes Received:
    232
    Location:
    Brazil - Rio de Janeiro
    First Language:
    Portuguese - Br
    Primarily Uses:
    RMMV
    Maybe knowing why you want to do that will help.
    But, I think you can make this by events.
    Put the images in the pictures folder, the default one.

    Then you can add the random pictures feature showing the picture via a script call.
    Put inside a variable all the names of the pictures you want randomized.
    Or, put each name of each picture inside a different variable(then you can use the random command in control variables)

    Then in the script call, in the field name, you put this variable value.
    Sorry, I'm not in pc right now, when I get there, I will post an example here.
     
    #2
    Soulrender and Engr. Adiktuzmiko like this.
  3. caethyril

    caethyril ^_^ Veteran

    Messages:
    1,116
    Likes Received:
    689
    Location:
    UK
    First Language:
    English
    Primarily Uses:
    RMMV
    If you want to use the actual loading screen, it seems you can use this sort of thing in a script call:
    Code:
    Graphics.setLoadingImage('img/system/Loading.png');
    Alternatively this code should do the trick, save as a .js file and import as a plugin:
    Code:
    (function(alias) {
    
    'use strict';
    
    	const IMAGES = ['Loading','Loading1','Loading2'];	// Possible loading images
    
    	Graphics.startLoading = function() {
    		let img = IMAGES[Math.randomInt(IMAGES.length)];	// Get random image name
    		img = 'img/system/' + img + '.png';			// Add directory and file extension
    		Graphics.setLoadingImage(img);				// Assign new image
    		alias.call(this);					// Continue as usual
    	};
    
    })(Graphics.startLoading);
    You'll need to edit this line with the names of your loading images, you can add or remove entries as needed:
    Code:
    	const IMAGES = ['Loading','Loading1','Loading2'];	// Possible loading images
    Tip: you can force the loading screen to display indefinitely on game start by temporarily removing the game font. (Replace it when you're done testing.) :kaopride:
     
    #3
    Eliaquim and Soulrender like this.
  4. Soulrender

    Soulrender Veteran Veteran

    Messages:
    149
    Likes Received:
    78
    First Language:
    Poland
    Primarily Uses:
    RMMV
    Thank you all, @caethyril I'm right away to check your script and I give an edit :)

    @caethyril Works perfectly as I wanted. Thank you very much. I owe you one :)
     
    Last edited: Aug 2, 2019
    #4
    Eliaquim and caethyril like this.
  5. caethyril

    caethyril ^_^ Veteran

    Messages:
    1,116
    Likes Received:
    689
    Location:
    UK
    First Language:
    English
    Primarily Uses:
    RMMV
    Great, happy RPG Making! :kaojoy:
     
    #5

Share This Page