Random situations in-game

Discussion in 'RGSSx Script Support' started by Andrea87Sky, Jul 1, 2019.

  1. Andrea87Sky

    Andrea87Sky Ah sh*t, here we go again. Veteran

    Messages:
    31
    Likes Received:
    1
    Location:
    Sicily
    First Language:
    Italian
    Primarily Uses:
    RMXP
    (Engine: RPG Maker XP, and sorry for the bad english)

    There's a way for make like a script for make a random situation in game? I mean, i wanna do like to show 3 pictures randomly in the title screen as background, for example randomly show the third picture as background, and randomly again show the first and etc. I don't know if someone will understand what i'm saying :C
     
    #1
  2. DerVVulfman

    DerVVulfman Resident Werewolf Veteran

    Messages:
    221
    Likes Received:
    110
    First Language:
    English
    Primarily Uses:
    RMXP
    So each time you run your game, the title screen may be different? Well, yeah.... that would be possible.

    FIRST, let me say that you're fortunate. Random numbers are easy to generate with RGSS and can be fairly random as RGSS automatically seeds the system based on the current time. Um, 'seeding' changes how a random number is generated.... otherwise you would randomly generate the SAME NUMBER EACH TIME ITS RUN! :XD: So RGSS automatically seeding is a good thing.

    Now, let's assume you're editing the Scene_Title to show three different title screens instead of just the one. Normally, you would have this generating your actual background:
    Code:
        # Make title graphic
        @sprite = Sprite.new
        @sprite.bitmap = RPG::Cache.title($data_system.title_name)
    You should have no problem replacing it with this:
    Code:
        # Make title graphic
        @sprite = Sprite.new
        rand_screen = rand(3)
        case randscreen
          when 1; @sprite.bitmap = RPG::Cache.title("Title_Screen 1")
          when 2; @sprite.bitmap = RPG::Cache.title("Title_Screen 2")
          else ;  @sprite.bitmap = RPG::Cache.title("Title_Screen 3")
        end
    Of course, you will need to edit the script as above to name them however you want in your Graphics\Titles folder.
     
    #2

Share This Page