Kitsuki 17 Report post Posted November 22, 2015 I want to toss two scripts together to make one functional script. I've been messing around in both, but it's clear that I won't be able to do it with my skill level (which is Level 0). I don't know if a script like the one I want is possible to make, but I figure I might as well get some feedback from people and see. #============================================================================== # ** Scene_Item #------------------------------------------------------------------------------ # This class performs item screen processing. #============================================================================== class Court_Record #-------------------------------------------------------------------------- # * Main Processing #-------------------------------------------------------------------------- def main # Make help window, item window @help_window = Window_Help.new @item_window = Window_Item.new # Associate help window @item_window.help_window = @help_window # Make target window (set to invisible / inactive) @target_window = Window_Target.new @target_window.visible = false @target_window.active = false # Execute transition Graphics.transition # Main loop loop do # Update game screen Graphics.update # Update input information Input.update # Frame update update # Abort loop if screen is changed if $scene != self break end end # Prepare for transition Graphics.freeze # Dispose of windows @help_window.dispose @item_window.dispose @target_window.dispose end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update # Update windows @help_window.update @item_window.update @target_window.update # If item window is active: call update_item if @item_window.active update_item return end # If target window is active: call update_target if @target_window.active update_target return end end #-------------------------------------------------------------------------- # * Frame Update (when item window is active) #-------------------------------------------------------------------------- def update_item # If B button was pressed if Input.trigger?(Input::B) # Play cancel SE $game_system.se_play($data_system.cancel_se) # Switch to menu screen $scene = Scene_Map.new return end # If C button was pressed if Input.trigger?(Input::C) # Get currently selected data on the item window @item = @item_window.item # If not a use item unless @item.is_a?(RPG::Item) # Play buzzer SE $game_system.se_play($data_system.buzzer_se) return end # If it can't be used unless $game_party.item_can_use?(@item.id) # Play buzzer SE $game_system.se_play($data_system.buzzer_se) return end # Play decision SE $game_system.se_play($data_system.decision_se) # If effect scope is an ally if @item.scope >= 3 # Activate target window @item_window.active = false @target_window.x = (@item_window.index + 1) % 2 * 304 @target_window.visible = true @target_window.active = true # Set cursor position to effect scope (single / all) if @item.scope == 4 || @item.scope == 6 @target_window.index = -1 else @target_window.index = 0 end # If effect scope is other than an ally else # If command event ID is valid if @item.common_event_id > 0 # Command event call reservation $game_temp.common_event_id = @item.common_event_id # Play item use SE $game_system.se_play(@item.menu_se) # If consumable if @item.consumable # Decrease used items by 1 $game_party.lose_item(@item.id, 1) # Draw item window item @item_window.draw_item(@item_window.index) end # Switch to map screen $scene = Scene_Map.new return end end return end end #-------------------------------------------------------------------------- # * Frame Update (when target window is active) #-------------------------------------------------------------------------- def update_target # If B button was pressed if Input.trigger?(Input::B) # Play cancel SE $game_system.se_play($data_system.cancel_se) # If unable to use because items ran out unless $game_party.item_can_use?(@item.id) # Remake item window contents @item_window.refresh end # Erase target window @item_window.active = true @target_window.visible = false @target_window.active = false return end # If C button was pressed if Input.trigger?(Input::C) # If items are used up if $game_party.item_number(@item.id) == 0 # Play buzzer SE $game_system.se_play($data_system.buzzer_se) return end # If target is all if @target_window.index == -1 # Apply item effects to entire party used = false for i in $game_party.actors used |= i.item_effect(@item) end end # If single target if @target_window.index >= 0 # Apply item use effects to target actor target = $game_party.actors[@target_window.index] used = target.item_effect(@item) end # If an item was used if used # Play item use SE $game_system.se_play(@item.menu_se) # If consumable if @item.consumable # Decrease used items by 1 $game_party.lose_item(@item.id, 1) # Redraw item window item @item_window.draw_item(@item_window.index) end # Remake target window contents @target_window.refresh # If all party members are dead if $game_party.all_dead? # Switch to game over screen $scene = Scene_Gameover.new return end # If common event ID is valid if @item.common_event_id > 0 # Common event call reservation $game_temp.common_event_id = @item.common_event_id # Switch to map screen $scene = Scene_Map.new return end end # If item wasn't used unless used # Play buzzer SE $game_system.se_play($data_system.buzzer_se) end return end end end ^That would be Scene_Item, but I changed the name to Court_Record. And then this: #============================================================================== # +++ MOG XP - Picture Gallery (v1.0) +++ #============================================================================== # By Moghunter # http://www.atelier-rgss.com/ #============================================================================== # Sistema de galeria de imagens. #============================================================================== # Para ativar o script use o comando abaixo através de um evento usando o # comando chamar script. (Call Script) # # $scene = Scene_Picture_Gallery.new # #============================================================================== # Para disponibilizar as imagens na galeria você deverá usar o seguinte # código através do comando chamar script. # # $game_system.gallery[iD] = true # # EX $game_system.gallery[10] = true # #============================================================================== # Você deverá criar uma pasta com o nome "Gallery" onde as imagens deverão # ser gravadas. # # Graphics/Gallery/ # # A nomeação das imagens devem ser numéricas. (ID da imagem) # 0.jpg (Imagem não disponÃvel.) # 1.jpg # 2.jpg # 3.jpg # ... # # Prefira usar imagens com resoluções igual ou maior a 640x480 pixels. # #============================================================================== module MOG_PICTURE_GALLERY #Quantidade maxima de imagens na galeria. MAX_PICTURES = 18 end #============================================================================== # â– Game_System #============================================================================== class Game_System attr_accessor :gallery #------------------------------------------------------------------------------ # â— Initialize #------------------------------------------------------------------------------ alias art_picture_initialize initialize def initialize art_picture_initialize @gallery = [] end end #============================================================================== # â– RPG #============================================================================== module RPG module Cache def self.gallery(filename) self.load_bitmap("Graphics/Gallery/", filename) end end end #============================================================================== # â– Window_Base #============================================================================== class Window_Base < Window #-------------------------------------------------------------------------- # Draw_Thumbnail #-------------------------------------------------------------------------- def draw_thumbnail(x,y,id) image = RPG::Cache.gallery(id.to_s) rescue nil return if image == nil cw = image.width ch = image.height src_rect = Rect.new(0, 0, cw , ch) src_rect2 = Rect.new(x, y, 150, 80) self.contents.stretch_blt(src_rect2, image, src_rect) end end #============================================================================== # â– Window_Picture #============================================================================== class Window_Picture < Window_Selectable #------------------------------------------------------------------------------ # â— Initialize #------------------------------------------------------------------------------ def initialize(page) super(0, 64, 640, 365) self.opacity = 0 @column_max = 3 @page = page @pic_max = MOG_PICTURE_GALLERY::MAX_PICTURES @pic_max = 1 if @pic_max <= 0 @pag_max = @pic_max / 9 if @pag_max == page o = @pag_max * 9 o2 = @pic_max - o @item_max = o2 else @item_max = 9 end refresh(page) self.index = 0 end #------------------------------------------------------------------------------ # â— Refresh #------------------------------------------------------------------------------ def refresh(page = 0) if self.contents != nil self.contents.dispose self.contents = nil end if @item_max > 0 self.contents = Bitmap.new(width - 32, row_max * 110) for i in 0...@item_max draw_item(i,page) end end end #------------------------------------------------------------------------------ # â— draw_item #------------------------------------------------------------------------------ def draw_item(index,page) np = 9 * page picture_number = index + 1 + np x = 15 + index % 3 * 215 y = 12 + index / 3 *110 s = picture_number s = 0 if $game_system.gallery[picture_number] == nil draw_thumbnail(x,y,s) self.contents.draw_text(x + 45,y + 70, 64, 32, "E - " + picture_number.to_s,1) end #------------------------------------------------------------------------------ # â— update_cursor_rect #------------------------------------------------------------------------------ def update_cursor_rect if @index < 0 self.cursor_rect.empty return end row = @index / @column_max if row < self.top_row self.top_row = row end if row > self.top_row + (self.page_row_max - 1) self.top_row = row - (self.page_row_max - 1) end cursor_width = self.width / @column_max - 32 x = index % 3 * 215 y = index / 3 *110 self.cursor_rect.set(x, y, cursor_width, 105) end end #============================================================================== # â– Scene_Artpictures #============================================================================== class Scene_Picture_Gallery include MOG_PICTURE_GALLERY #------------------------------------------------------------------------------ # â— Main #------------------------------------------------------------------------------ def main setup create_background create_window create_image create_cursor create_button execute_loop execute_dispose end #------------------------------------------------------------------------------ # â— Setup #------------------------------------------------------------------------------ def setup @max_pictures = MAX_PICTURES @max_pictures = 1 if @max_pictures <= 0 v = (@max_pictures / 9) v2 = (v - 1) * 9 v3 = (@max_pictures - v2) - 9 if v3 != 0 @max_pages = (@max_pictures / 9) + 1 else @max_pages = (@max_pictures / 9) end @max_pages = 1 if @max_pages == 0 @aw_center = 0 @aw_left = 0 @aw_right = 0 @slide_type = 0 @page_old = 0 @picture_id = 0 @image_active = false @old_index = 0 @pictures_enabled = 0 @comp = 0 @ex = 0 @ey = 0 @ex_max = 0 @ey_max = 0 for i in 0..MAX_PICTURES @pictures_enabled += 1 if $game_system.gallery end end #------------------------------------------------------------------------------ # â— create_background #------------------------------------------------------------------------------ def create_background @background = Sprite.new @background.bitmap = RPG::Cache.gallery("Background") @background.z = 0 @background2 = Plane.new @background2.bitmap = RPG::Cache.gallery("Background2") @background2.z = -1 end #------------------------------------------------------------------------------ # â— Create Window #------------------------------------------------------------------------------ def create_window @info = Window_Help.new @info.y = 416 @info.opacity = 0 @wp_page = 0 @wp_page_old = @wp_page @wp_index = 0 @wp =[] for i in 0...@max_pages @wp = Window_Picture.new(i) @wp.x = 32 * i end check_active_window(true) refresh_info_window(true) end #------------------------------------------------------------------------------ # â— Create_image #------------------------------------------------------------------------------ def create_image @picture = Sprite.new @picture.bitmap = RPG::Cache.gallery("") @picture.z = 100 @picture.opacity = 0 end #------------------------------------------------------------------------------ # â— Check Active Window #------------------------------------------------------------------------------ def check_active_window(starting = false) for i in 0...@max_pages if i == @wp_page @wp[@wp_page].active = true @wp[@wp_page].visible = true if @slide_type == 0 @wp[@wp_page].x = 640 else @wp[@wp_page].x = -640 end elsif i == @page_old and starting == false @wp[@page_old].active = false @wp[@page_old].visible = true @wp[@page_old].visible = false if starting @wp[@page_old].x = 0 else @wp.active = false @wp.visible = false end end end #------------------------------------------------------------------------------ # â— Create Button #------------------------------------------------------------------------------ def create_button @button_image = RPG::Cache.gallery("Button") @button_bitmap = Bitmap.new(@button_image.width, @button_image.height) @cw = @button_image.width @ch = @button_image.height / 2 src_rect = Rect.new(0, 0, @cw, @ch) @button_bitmap .blt(0,0, @button_image, src_rect) @button = Sprite.new @button.bitmap = @button_bitmap @button.y = 443 @button.z = 250 @button.opacity = 0 @button_fade_time = 0 end #------------------------------------------------------------------------------ # â— Create Cursor #------------------------------------------------------------------------------ def create_cursor @cx1 = 0 @cx2 = 0 @cursor_speed = 0 image = RPG::Cache.gallery("Cursor") @bitmap = Bitmap.new(image.width, image.height) cw = image.width / 2 ch = image.height src_rect = Rect.new(cw, 0, cw, ch) @bitmap.blt(0,0, image, src_rect) @cursor1 = Sprite.new @cursor1.bitmap = @bitmap @cursor1.x = 0 + @cx1 @cursor1.y = 220 @cursor1.z = 200 @bitmap2 = Bitmap.new(image.width, image.height) src_rect2 = Rect.new(0, 0, cw, ch) @bitmap2.blt(0,0, image, src_rect2) @cursor2 = Sprite.new @cursor2.bitmap = @bitmap2 @cursor2.x = 610 + @cx2 @cursor2.y = 220 @cursor2.z = 200 image.dispose if @max_pages == 1 @cursor1.visible = false @cursor2.visible = false end end #------------------------------------------------------------------------------ # â— Execute Loop #------------------------------------------------------------------------------ def execute_loop Graphics.transition loop do Graphics.update Input.update update if $scene != self break end end end #------------------------------------------------------------------------------ # â— Execute Dispose #------------------------------------------------------------------------------ def execute_dispose Graphics.freeze for i in 0...@max_pages @wp.dispose end @info.dispose if @picture.bitmap != nil @picture.bitmap.dispose end @picture.dispose @background.bitmap.dispose @background.dispose @background2.bitmap.dispose @background2.dispose @bitmap.dispose @bitmap2.dispose @cursor1.bitmap.dispose @cursor1.dispose @cursor2.bitmap.dispose @cursor2.dispose @button_bitmap.dispose @button.bitmap.dispose @button.dispose @button_image.dispose end #------------------------------------------------------------------------------ # â— Update #------------------------------------------------------------------------------ def update @wp[@wp_page].update @info.update if @image_active update_command_image else update_command end update_slide update_image_effect update_cursor_animation refresh_info_window # If B button was pressed if Input.trigger?(Input::B) # Play cancel SE $game_system.se_play($data_system.cancel_se) # Switch to menu screen $scene = Scene_Menu.new(0) return end end #------------------------------------------------------------------------------ # â— update_cursor_animation #------------------------------------------------------------------------------ def update_cursor_animation @cursor_speed += 1 case @cursor_speed when 1..20 @cx1 += 1 @cx2 -= 1 when 21..40 @cx1 -= 1 @cx2 += 1 else @cursor_speed = 0 @cx1 = 0 @cx2 = 0 end @cursor1.x = 0 + @cx1 @cursor2.x = 610 + @cx2 end #------------------------------------------------------------------------------ # â— Update Image Effect #------------------------------------------------------------------------------ def update_image_effect return if @wp[@wp_page].x != 0 @button_fade_time -= 1 if @button_fade_time > 0 if @image_active @picture.opacity += 25 if @button_fade_time != 0 @button.opacity += 10 else if @button.y < 640 @button.opacity -= 15 @button.y += 1 end end @wp[@wp_page].contents_opacity -= 25 @info.contents_opacity -= 25 @background.opacity -= 25 @cursor1.opacity -= 25 @cursor2.opacity -= 25 else @picture.opacity -= 10 @button.opacity -= 25 @wp[@wp_page].contents_opacity += 25 @info.contents_opacity += 25 @background.opacity += 25 @cursor1.opacity += 25 @cursor2.opacity += 25 end end #------------------------------------------------------------------------------ # â— Refresh Info Window #------------------------------------------------------------------------------ def refresh_info_window(starting = false) return if @image_active return if @wp_page_old == @wp_page and starting == false @wp_page_old = @wp_page page = @wp_page + 1 @picture_id = (9 * @wp_page) + @wp[@wp_page].index + 1 p_pages = "Page - " + page.to_s + " / " + @max_pages.to_s p_number = " Evidence " + @pictures_enabled.to_s + " / " + @max_pictures.to_s @info.set_text(" " + p_pages + p_number) end #------------------------------------------------------------------------------ # â— Update Slide #------------------------------------------------------------------------------ def update_slide @background2.ox += 0 return if @wp[@wp_page].x == 0 slide_speed = 35 @picture.opacity = 0 @background.opacity = 255 if @slide_type == 1 if @wp[@wp_page].x < 0 @wp[@wp_page].x += slide_speed if @wp[@wp_page].x >= 0 @wp[@wp_page].x = 0 end end if @wp[@page_old].x < 640 @wp[@page_old].x += slide_speed if @wp[@page_old].x >= 640 @wp[@page_old].x = 640 end end else if @wp[@wp_page].x > 0 @wp[@wp_page].x -= slide_speed if @wp[@wp_page].x <= 0 @wp[@wp_page].x = 0 end end if @wp[@page_old].x > -640 @wp[@page_old].x -= slide_speed if @wp[@page_old].x <= -640 @wp[@page_old].x = -640 end end end if @slide_type == 0 @wp[@wp_page].x = 0 if @wp[@wp_page].x <= 0 else @wp[@wp_page].x = 0 if @wp[@wp_page].x >= 0 end end #------------------------------------------------------------------------------ # â— Check_limite #------------------------------------------------------------------------------ def check_limit if @wp_page < 0 @wp_page = @max_pages - 1 elsif @wp_page >= @max_pages @wp_page = 0 end check_active_window end #------------------------------------------------------------------------------ # â— Update Command Image #------------------------------------------------------------------------------ def update_command_image if Input.trigger?(Input::B) or Input.trigger?(Input::C) $game_system.se_play($data_system.cursor_se) @image_active = false @wp[@wp_page].active = true return end if Input.trigger?(Input::R) or Input.trigger?(Input::L) $game_system.se_play($data_system.cursor_se) end if Input.press?(Input::RIGHT) @ex += 6 elsif Input.press?(Input::LEFT) @ex -= 6 elsif Input.press?(Input::DOWN) @ey += 6 elsif Input.press?(Input::UP) @ey -= 6 end @ex = 0 if @ex < 0 @ey = 0 if @ey < 0 @picture.x = -@ex @picture.y = -@ey end #------------------------------------------------------------------------------ # â— check_avaliable_picture? #------------------------------------------------------------------------------ def check_avaliable_picture? @picture_id = (9 * @wp_page) + @wp[@wp_page].index + 1 return false if $game_system.gallery[@picture_id] == nil return true end #------------------------------------------------------------------------------ # â— create_bitmap #------------------------------------------------------------------------------ def create_bitmap @picture.opacity = 0 @picture.bitmap.dispose @picture.bitmap = RPG::Cache.gallery(@picture_id.to_s) rescue nil @ex = 0 @ey = 0 if @picture.bitmap == nil @picture.bitmap = RPG::Cache.gallery("") refresh_button(0) return end if @picture.bitmap.width > 640 @ex_max = @picture.bitmap.width - 640 else @ex_max = 0 end if @picture.bitmap.height > 480 @ey_max = @picture.bitmap.height - 480 else @ey_max = 0 end if @picture.bitmap.width > 640 or @picture.bitmap.height > 480 refresh_button(1) else refresh_button(0) end end #------------------------------------------------------------------------------ # â— Refresh Button #------------------------------------------------------------------------------ def refresh_button(type = 0) @button.bitmap.clear if type == 0 src_rect = Rect.new(0, 0, @cw, @ch) else src_rect = Rect.new(0, @ch, @cw, @ch) end @button_bitmap .blt(0,0, @button_image, src_rect) @button.y = 443 @button_fade_time = 120 @button.opacity = 0 unless @button.y == 443 end #------------------------------------------------------------------------------ # â— Update Command #------------------------------------------------------------------------------ def update_command return if @wp[@wp_page].x != 0 if Input.trigger?(Input::B) $game_system.se_play($data_system.cursor_se) $scene = Scene_Map.new return end if Input.trigger?(Input::C) if check_avaliable_picture? $game_system.se_play($data_system.decision_se) @image_active = true @wp[@wp_page].active = false create_bitmap else $game_system.se_play($data_system.buzzer_se) end return end if Input.trigger?(Input::L) and @max_pages != 1 $game_system.se_play($data_system.cursor_se) @page_old = @wp_page @wp_page -= 1 @slide_type = 1 check_limit return elsif Input.trigger?(Input::R) and @max_pages != 1 $game_system.se_play($data_system.cursor_se) @page_old = @wp_page @wp_page += 1 @slide_type = 0 check_limit return end end end $mog_xp_picture_gallery = true This is Moghunter's picture gallery script, which allows you to call a scene that lets you view pictures. You can zoom in too, but I took that function out. It still makes the confirm SE when you press the zoom keys, but I'll figure remove that later. What I want to be able to do is have one whole script that works like Scene_Item, but with the graphics of the second script. That way, when you click on the item, it shows an image displaying the item description and picture. Ideally, there would be a way to select the item from the menu as well and call a common event from there by pressing another button (other than Enter or C). I don't know if a script like this is possible, but please let me know how I'd go about it! I'm trying to figure out what I can do with this, or else I might just go and create an evented picture system that allows me to do something similar. Thanks to everyone in advance! ~Kitsuki Share this post Link to post Share on other sites