Chaos Project

RPG Maker => RPG Maker Scripts => Script Troubleshooting => Topic started by: AJNR95 on April 29, 2012, 04:19:04 pm

Title: [RESOLVED] Default RMXP Scene Question (Replace Black Area with Transparency?)
Post by: AJNR95 on April 29, 2012, 04:19:04 pm
Can you replace the black areas of default scenes such as Scene_Menu, Scene_Equip, etc.
with a transparent area that is similar to RMVX's menu?

My menu is just an ugly, fundamental version of the default with choices cut off
and windows re-sized.
Title: Re: Default RMXP Scene Question (Replace Black Area with Transparency?)
Post by: G_G on April 29, 2012, 04:25:12 pm
Like the map as a background? This should do it for Scene_Menu.
class Scene_Menu
  alias gg_init_map_background main
  def main
    @background = Spriteset_Map.new
    gg_init_map_background
    @background.dispose
  end
 
  alias gg_upd_map_background update
  def update
    @background.update
    gg_upd_map_background
  end
end
Title: Re: Default RMXP Scene Question (Replace Black Area with Transparency?)
Post by: stripe103 on April 29, 2012, 04:33:57 pm
Possible, and quite simple actually.
Just because I'm in a lazy mood I'll tell you how to learn to use it. And because I'm writing on my phone.

In Scene_Map, there is a line that uses Spriteset_Map I think it's called. That's the class that draws the map. Learn how to use it by following the variable that stores it and see what functions you need to use where.

Now you need to implement those parts into each scene you want the background to show in.

EDIT: Game_Guy was faster than me.
Title: Re: Default RMXP Scene Question (Replace Black Area with Transparency?)
Post by: AJNR95 on April 29, 2012, 05:00:53 pm
Quote from: game_guy on April 29, 2012, 04:25:12 pm
Like the map as a background? This should do it for Scene_Menu.
class Scene_Menu
  alias gg_init_map_background main
  def main
    @background = Spriteset_Map.new
    gg_init_map_background
    @background.dispose
  end
 
  alias gg_upd_map_background update
  def update
    @background.update
    gg_upd_map_background
  end
end



I am not a scripting expert so I didn't understand that wholly.
What line numbers do I insert those segments?

Insert at Line 7
class Scene_Menu
  alias gg_init_map_background main


Insert at Line 19

  def main
    @background = Spriteset_Map.new
    gg_init_map_background
    @background.dispose
  end


Quote from: stripe103 on April 29, 2012, 04:33:57 pm
EDIT: Game_Guy was faster than me.


Thank you anyway. Although I'm not in a learning mood for script  :P
Title: Re: Default RMXP Scene Question (Replace Black Area with Transparency?)
Post by: ForeverZer0 on April 29, 2012, 05:29:31 pm
Updating the spriteset will often cause bugs.

The simplest way is like this:

class Scene_NAMEOFSCENE

  alias background_main main
  def main
    background = Spriteset_Map.new
    background_main
    background.dispose
  end
end


This will work with practically any scene, just change the name of the class to match the scene you want to do it with.

Title: Re: Default RMXP Scene Question (Replace Black Area with Transparency?)
Post by: AJNR95 on April 29, 2012, 05:40:29 pm
Where do I insert these? What Line # of the script?
Title: Re: Default RMXP Scene Question (Replace Black Area with Transparency?)
Post by: ForeverZer0 on April 29, 2012, 05:43:43 pm
Anywhere below the script you want to modify.
In between the default scripts, and above main, where nearly every custom script is inserted. That's a good rule of thumb to follow.
Title: Re: Default RMXP Scene Question (Replace Black Area with Transparency?)
Post by: AJNR95 on April 29, 2012, 05:49:42 pm
Quote from: ForeverZer0 on April 29, 2012, 05:43:43 pm
Anywhere below the script you want to modify.
In between the default scripts, and above main, where nearly every custom script is inserted. That's a good rule of thumb to follow.


Jesus, I'm dumb. Thanks. I was trying to insert it into the actual Scene_Menu.
Title: Re: Default RMXP Scene Question (Replace Black Area with Transparency?)
Post by: ForeverZer0 on April 29, 2012, 06:04:13 pm
Its fine, that's why you see "alias" of often. Its used to modify methods without overwriting them or requiring them to be inserted in the original script. They need only be below where the original is defined to work.
Title: Re: Default RMXP Scene Question (Replace Black Area with Transparency?)
Post by: Calintz on April 29, 2012, 06:34:05 pm
about aliases...
when defining an alias' method, should you only write the modifications you want to make to the original definition, (in other words, only the mods) or should you include the original definition plus the modifications? (in other words, re-write the original definition and add the mods)
Title: Re: Default RMXP Scene Question (Replace Black Area with Transparency?)
Post by: ForeverZer0 on April 29, 2012, 07:01:32 pm
It can depend on the exact scenario, but if you omit the call using the alias name in your modification, it is really no different than overwriting the method.

Take a look at the example above.

The first call to in the modified method is to create the sprite. This happens BEFORE the original "main" method is called. We then call the original method. Processing is stuck here while the scene is active, because of the loop that is placed in scenes, so the any code after that call to the original is made as the scene exits. This is where we dispose the sprite.

Circumstances where the method returns a value are sometimes handled differently. Sometimes you need to see what the original method returns, and then process that data further. For example, let's say we want to modify Game_Actor so that if the name was "Tom" we return "Jerry" instead. We want the normal name returned in all other circumstances, only when the name is "Tom". You might make something like this.

class Game_Actor

  alias change_name name
  def name
    string = change_name # Stores original return value in variable "string"
    if string == 'Tom'
      return 'Jerry' # Returns 'Jerry' if name was 'Tom"
    else # If not 'Tom'
      return name # Returns the original name
   end
end






Title: Re: Default RMXP Scene Question (Replace Black Area with Transparency?)
Post by: AJNR95 on April 29, 2012, 08:17:37 pm
Problem resolved. I have no idea what the two of you are talking about.
Thanks everyone *Leaves*