Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- # * [ACE] Choice Window Images
- #===============================================================================
- # * Made by: Sixth (www.rpgmakervxace.net, www.forums.rpgmakerweb.com)
- # * Version: 1.0
- # * Updated: 24/01/2016
- # * Requires: --------
- #-------------------------------------------------------------------------------
- # * < Change Log >
- #-------------------------------------------------------------------------------
- # * Version 1.0 (24/01/2016)
- # - Initial release.
- #-------------------------------------------------------------------------------
- # * < Description >
- #-------------------------------------------------------------------------------
- # * This script will let you set up images for your choices in the choice
- # window. These images will show up when the choice window is opened and will
- # be hidden when the choice window is closed.
- # * The images are tied with the choice window's selection cursor, so the image
- # displayed will depend on the selected option in the choice window.
- # In short, only one image will be displayed, and that is based on the
- # cursor's position. The shown image is updated in real time, so the player
- # can see the changes immediately.
- #-------------------------------------------------------------------------------
- # * < Script Calls >
- #-------------------------------------------------------------------------------
- # * To set up the images for a "Show Choices" command, use this script call
- # BEFORE the "Show Choices" command:
- #
- # set_choice_pics(image_settings)
- #
- # The 'image_settings' are your settings for your images.
- # Who would have guessed it, right? :D
- #
- # Okay, here is how one image setting looks:
- #
- # ["filename",x,y]
- #
- # The "filename" is the name of the image file you want to use.
- # The x and y is the X and Y positions of the image (no kidding! :P).
- #
- # So, this is one image setting, and you can enter as many as you want.
- # Each of them must be separated by commas!
- # Keep in mind that the maximum choices you can show is 4 unless you use
- # custom scripts to change that, so there is not much point to add more than
- # 4 image settings if you do not use scripts to increase that number.
- #
- # Examples:
- #
- # set_choice_pics(["Yes",250,200],["No",250,200])
- # This would show the "Yes" image when the cursor is on the first choice, and
- # would show the "No" image when the cursor is on the second choice.
- # If there are more than 2 choices, nothing will be shown for the rest of
- # them.
- #
- # img1 = ["Easy",120,140]
- # img2 = ["Normal",120,170]
- # img3 = ["Hard",120,200]
- # img4 = ["Insane",120,230]
- # set_choice_pics(img1,img2,img3,img4)
- # This would set 4 images for the first 4 choices.
- # You see, I set up the image settings separately, one on each lines, and
- # pass these settings to the script call as 'img1', 'img2', and so on.
- # This is to keep it organized and because I don't like long script calls
- # horizontally (some parts might get cut in the event command editor when
- # viewing them on the command list).
- # You don't have to use 'img1', 'img2', etc for their names, those are just
- # examples, you can name them however you like, just make sure to use the
- # same names in the 'set_choice_pics' call!
- #
- # NOTE1:
- # All images used in these script calls must be in the "Graphics/Pictures"
- # folder of your game!
- # NOTE2:
- # You must set up these images before ALL of your choice selections if you
- # want to show images for your choices, because the settings will get cleared
- # automatically when the choice window is closed!
- # If there is no image settings set up before a "Show Choices" command,
- # there will be no images shown for your choices!
- # NOTE3:
- # You don't have to use this script call exactly before the "Show Choices"
- # command. Once you useed this script call, it will be active all the time
- # until the choice window opens. When that happens, the settings will be
- # cleared the moment the choice window is closed.
- #-------------------------------------------------------------------------------
- # * < Installation >
- #-------------------------------------------------------------------------------
- # * Place this scipt below Materials but above Main!
- #-------------------------------------------------------------------------------
- # * < Compatibility Info >
- #-------------------------------------------------------------------------------
- # * No known incompatibilities.
- #-------------------------------------------------------------------------------
- # * < Known Issues >
- #-------------------------------------------------------------------------------
- # * No known issues.
- #-------------------------------------------------------------------------------
- # * < Terms of Use >
- #-------------------------------------------------------------------------------
- # * Free to use for whatever purposes you want.
- # * Credit me (Sixth) in your game, pretty please! :P
- # * Posting modified versions of this script is allowed as long as you notice me
- # about it with a link to it!
- #===============================================================================
- $imported = {} if $imported.nil?
- $imported["SixthChoiceWinPics"] = true
- #===============================================================================
- # No Settings! o.o
- #===============================================================================
- class Game_Interpreter
- def set_choice_pics(*imgs)
- $game_message.choice_pics = imgs
- end
- end
- class Game_Message
- attr_accessor :choice_pics
- end
- class Window_ChoiceList < Window_Command
- def open
- super
- show_choice_pics if $game_message.choice_pics
- end
- def close
- super
- hide_choice_pics if @imgs
- end
- def show_choice_pics
- @imgs = []
- $game_message.choice_pics.each_with_index do |img,i|
- @imgs[i] = Sprite.new
- @imgs[i].visible = i == @index ? true : false
- @imgs[i].bitmap = Cache.picture(img[0])
- @imgs[i].x = img[1]
- @imgs[i].y = img[2]
- @imgs[i].z = self.z - 1
- end
- end
- def hide_choice_pics
- @imgs.each {|img| img.bitmap.dispose; img.dispose}
- @imgs = nil
- $game_message.choice_pics = nil
- end
- def update
- super
- update_choice_pics if @imgs
- end
- def update_choice_pics
- @imgs.each_with_index do |img,i|
- if i == @index
- img.visible = true if !img.visible
- else
- img.visible = false if img.visible
- end
- end
- end
- end
- #==============================================================================
- # !!END OF SCRIPT - OHH, NOES!!
- #==============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement