-
Posts
36 -
Joined
-
Last visited
Content Type
Profiles
Forums
Calendar
Everything posted by Alexos
-
Non so se il salvataggio è compatibile..cmq eccoti la Patch!! =)
-
Sono contento k ti piaccia..^^..cmq avevo trovato quell'errore e l'avevo corretto la scorsa settimana, solo k non avevo potuto uppare la nuova versione a causa di problemi di linea..l'ho fatto adesso con il permesso di Tio..adesso potete scaricare la versione pronta e finalmente completamente giocabile..=)..quindi..scaricate e commentate!!
-
grazie x la correzione^^..non ho mai studiato latino, ho cercato le parole su un traduttore in internet e quindi ho scritto quello che mi ha dato..XD..grazie ancora,correggerò e aspetterò la tua recensione!!
-
Scusate il doppio post...ho uppato la demo corretta pronta per il contest!! scaricate, commentate e criticate!!^^
-
Zalve!!Parto x le vacanze e tornerò il 15!! Sto già pensando a nuovi sviluppi x LoD e x un'altro gioco!! E cmq buone vacanze Dax!!^^
-
Benvenuto!!^^
-
Partecipo anch'io, sono Alexos!
-
Aiutoo non riesco a creare un forziere decente!!!!!
Alexos replied to Kan's question in Supporto VX e VX-Ace
Semplice..il VX ha la unzionalità di creare eventi rapidi selezionabili con il tasto dx..clicca con il dx e seleziona "creazione eventi rapidi", poi scegli "scrigno,baule" e scegli cosa verrà ottenuto con l'apertura di quel forziere e fai ok..verrà creato tutto il resto dal programma!! -
Grazie!!^^auguri anche a Ultima!!
-
Per il primo punto devo sistemare il tileE e x il secondo vedrò di correggere!!XD Grazie x le correzioni!!^^ Cmq nella prossima demo che posterò la storia finirà allo stesso punto, ma ci saranno aggiunte, come un sistema di ricercati, la prima Accademia e il crafting system se riesco a risolvere l'incompatibilà con il menu!!
-
Aggiornato il primo post con i link della Demo con e senza RTP!! Scaricate e commentate!! :smile:
-
Problema incompatibilità menu ff9 e acs!!
Alexos replied to Alexos's question in Supporto RGSS2 (VX)
Non vado tanto d'accordo con gli script.. ..cmq grazie!!^^ -
Salve!! Nel mio gioco uso il menu stile ff9 e un crafting system, ma quando testo il gioco, le finestre del menu sono posizionate male e mi compare un errore ogni volta che provo ad accedere alle opzioni del menu come oggetti, equip, abilità ecc, mi compare un errore..adesso posto gli script e metto gli screen!! Il menu dovrebbe essere così: http://img199.imageshack.us/img199/3411/menuok.th.png Invece è così: E questo è l'errore che mi da quando provo ad accedere ad es a "oggetti": E adesso gli script!! MENU Uno: Spoiler =begin BigEd781' Final Fantasy IX Menu Credit to PainHurt at rpgmakervx.net for most of the graphics =end module FF9_Config # set this to 'true' if you would like to use a cusotm background image USE_CUSTOM_BACK = false # the name of the custom background image, without the file extension (no .png) BACK_NAME = 'StoneBackground' # if you set this to 'true', you must be using the enhanced # Window class script that I posted: You can get that script here: # http://www.rpgmakervx.net/index.php?showtopic=8042&hl= # this will make the provided FF9 windowskin look really good. USE_TILED_WINDOW = true # When this is set to 'true', the menu cirsor will animate back and forth. # When set to 'false', it will stay in place ANIMATE_CURSOR = false # When set to 'true', four background panels are always drawn. # When set to 'false', a panel is only drawn for each party member DRAW_FOR_ALL = true # the name of the font used in the menu. # use 'Font.default_name' for the default font. Try 'Centaur' for a nice, smaller font. DEFAULT_FONT = Font.default_name # set this to true to enable the font above for all windows. # also sets the back_opacity to 255 for all windows. # I recommend setting this to 'true' to maintain a consistent look. USE_FOR_ALL = true # the icon id for your gold window portion of the menu, 194 by default. GOLD_ICON_ID = 194 end if FF9_Config::USE_FOR_ALL Font.default_name = FF9_Config::DEFAULT_FONT class Window_Base < Window alias :eds_pre_ff9_menu_base_initialize :initialize def initialize(*args) eds_pre_ff9_menu_base_initialize(*args) self.stretch = false if FF9_Config::USE_TILED_WINDOW self.back_opacity = 255 end end end class Window_Base < Window CAPTION_COLOR = Color.new(255,255,255)#(228, 228, 228) CAPTION_HEIGHT = 12 X_OFFSET = 16 Y_OFFSET = -5 alias :eds_pre_window_caption_intialize :initialize def initialize(*args) eds_pre_window_caption_intialize(*args) @caption_sprite = Sprite_Base.new(self.viewport) create_caption_bitmap(1, CAPTION_HEIGHT) @caption_sprite.x = self.x + X_OFFSET @caption_sprite.y = self.y + Y_OFFSET @caption_sprite.z = self.z + 1 end def x=(value) super @caption_sprite.x = value + X_OFFSET unless @caption_sprite.nil? end def y=(value) super @caption_sprite.y = value + Y_OFFSET unless @caption_sprite.nil? end def z=(value) super @caption_sprite.z = value + 1 unless @caption_sprite.nil? end def caption=(text) return unless text.is_a?(String) return if text.empty? @caption = text width = @caption_sprite.bitmap.text_size(@caption).width create_caption_bitmap(width, CAPTION_HEIGHT) draw_caption end def create_caption_bitmap(w, h) @caption_sprite.bitmap = Bitmap.new(w, h) @caption_sprite.bitmap.font.size = 12 @caption_sprite.bitmap.font.color = CAPTION_COLOR @caption_sprite.bitmap.font.bold = true end def draw_caption unless @caption.nil? h = @caption_sprite.bitmap.height w = @caption_sprite.bitmap.width rect = Rect.new( 0, h / 2, w, h / 4 ) @caption_sprite.bitmap.fill_rect(rect, Color.new(0, 0, 0, 96)) @caption_sprite.bitmap.draw_text(@caption_sprite.src_rect, @caption) end end alias :eds_pre_caption_window_dispose :dispose def dispose eds_pre_caption_window_dispose @caption_sprite.dispose end def find_window_width(text) return Bitmap.new(544, 416).text_size(text).width + 32 end end class Window_TimeGold < Window_Base def initialize(x, y) width = find_window_width("9999999") width = 140 if width < 140 super(x, y, width, WLH + 58) self.back_opacity = 255 self.stretch = false if FF9_Config::USE_TILED_WINDOW self.contents.font.name = FF9_Config::DEFAULT_FONT self.caption = "TIME & #{Vocab.gold}" @time_icon = Cache.picture('Timer') @intern_frame_count = 0 refresh end def draw_time sec = (Graphics.frame_count / 60) % 60 min = (Graphics.frame_count / 3600) % 60 hrs = Graphics.frame_count / 216000 self.contents.font.color = Color.new(255, 255, 255) time = "%02d:%02d:%02d" % [hrs, min, sec] self.contents.draw_text(0, 0, self.contents.width, WLH, time, 2) end def refresh self.contents.clear self.contents.blt(0, 0, @time_icon, @time_icon.rect) draw_icon(FF9_Config::GOLD_ICON_ID, 2, WLH) draw_currency_value($game_party.gold, 0, WLH, self.contents.width) draw_time end def draw_currency_value(value, x, y, width) gold_text = Vocab.gold cx = contents.text_size(gold_text[0,1]).width self.contents.font.color = normal_color self.contents.draw_text(x, y, width - cx - 2, WLH, value, 2) self.contents.font.color = system_color # just print the first character of Vocab::gold self.contents.draw_text(x, y, width, WLH, gold_text[0,1], 2) end def update super @intern_frame_count += 1 return if (@intern_frame_count % 60) != 0 refresh end def find_window_width(text) return Bitmap.new(544, 416).text_size(text).width + 80 end end class Window_MenuLocation < Window_Base def initialize(x, y) @map_name = load_data("Data/MapInfos.rvdata")[$game_map.map_id].name width = find_window_width(@map_name) super(x, y, width, WLH + 32) self.stretch = false if FF9_Config::USE_TILED_WINDOW self.contents.font.name = FF9_Config::DEFAULT_FONT self.back_opacity = 255 self.caption = "LOCATION" refresh end def refresh self.contents.clear self.contents.draw_text(0, 0, self.contents.width, WLH, @map_name, 1) end def find_window_width(text) return Bitmap.new(544, 416).text_size(text).width + 48 end end class Window_Command < Window_Selectable alias :eds_pre_ff9_menu_win_command_init :initialize def initialize(*args) @font_name = Font.default_name eds_pre_ff9_menu_win_command_init(*args) end #-------------------------------------------------------------------------- # * OVERWRITTEN #-------------------------------------------------------------------------- def refresh self.contents.clear self.contents.font.name = @font_name for i in 0...@item_max draw_item(i) end end def font_name=(name) @font_name = name end end class Window_Uses < Window_Base def initialize(right, y, item) @remaining_text = "Remaining: #{$game_party.item_number(item)}" w = 160 x = right ? (544 - w) : 0 super(x, y, w, WLH + 32) self.stretch = false if FF9_Config::USE_TILED_WINDOW self.contents.font.name = FF9_Config::DEFAULT_FONT refresh end def item=(item) return unless item.is_a?(RPG::Item) @remaining_text = "Remaining: #{$game_party.item_number(item)}" refresh end def visible=(value) super refresh if value end def refresh self.contents.clear self.contents.draw_text(self.contents.rect, @remaining_text, 1) end end class Window_SkillUses < Window_Base def initialize(right, y, actor, skill) @remaining_text = make_info_string(actor, skill) w = 182 x = right ? (544 - w) : 0 super(x, y, w, WLH + 32) self.stretch = false if FF9_Config::USE_TILED_WINDOW self.contents.font.name = FF9_Config::DEFAULT_FONT refresh end def make_info_string(actor, skill) return if actor.nil? || skill.nil? cost = actor.calc_mp_cost(skill) return "Unlimited" if cost < 1 return "Remaining: #{actor.mp / cost}" end def set_skill(actor, skill) return if actor.nil? || skill.nil? return unless skill.is_a?(RPG::Skill) @remaining_text = make_info_string(actor, skill) refresh end def visible=(value) super refresh if value end def refresh self.contents.clear self.contents.draw_text(self.contents.rect, @remaining_text, 1) end end class Window_MenuStatus < Window_Selectable #-------------------------------------------------------------------------- # * OVERWRITTEN #-------------------------------------------------------------------------- def initialize(x, y) super(x, y, 452, 352) @bg_image = Cache.picture('FF9_MenuBar') @arrow_image = Cache.picture('Pointer') create_arrow_sprites @sprite_last_draw_x = 0 @sprite_inc_x = 1 @intern_frame_count = 0 self.stretch = false if FF9_Config::USE_TILED_WINDOW self.contents.font.name = FF9_Config::DEFAULT_FONT self.opacity = 0 self.z = 99 self.active = false self.index = -1 refresh end #-------------------------------------------------------------------------- # * create_arrow_sprites #-------------------------------------------------------------------------- def create_arrow_sprites @arrow_sprites = [] for i in 0..3 @arrow_sprites << Sprite.new @arrow_sprites.bitmap = Bitmap.new(@arrow_image.width + 7, @arrow_image.height) @arrow_sprites.x = self.x @arrow_sprites.y = (i * 80) + self.y + 40 @arrow_sprites.z = 999 end end #-------------------------------------------------------------------------- # * OVERWRITTEN #-------------------------------------------------------------------------- def refresh self.contents.clear @item_max = $game_party.members.size draw_background_windows if FF9_Config::DRAW_FOR_ALL for actor in $game_party.members x = 104 y = actor.index * 80 y_offset = 6 draw_background_window(0, y) unless FF9_Config::DRAW_FOR_ALL draw_actor_face(actor, 19, y + 4, 73) draw_actor_name(actor, x, y + y_offset) draw_actor_class(actor, x + 125, y + y_offset) if actor.states.empty? draw_actor_level(actor, x, y + WLH * 1) draw_actor_state(actor, x + 125, y + y_offset) draw_actor_hp(actor, x, ((y) + (WLH * 2) - 5)) draw_actor_mp(actor, x + 125, ((y) + (WLH * 2) - 5)) end end #-------------------------------------------------------------------------- # * OVERWRITTEN #-------------------------------------------------------------------------- def update_cursor if @index < 0 #refactor into update arrow method @arrow_sprites.each { |sprite| sprite.bitmap.clear } return end @intern_frame_count += 1 return unless (@intern_frame_count % 5) == 0 if @sprite_last_draw_x >= 7 @sprite_inc_x = -1 elsif @sprite_last_draw_x <= 0 @sprite_inc_x = 1 end update_arrow_sprites end #-------------------------------------------------------------------------- # * update_arrow_sprites #-------------------------------------------------------------------------- def update_arrow_sprites @arrow_sprites.each { |sprite| sprite.bitmap.clear } if @index == 99 # all selected return unless (@intern_frame_count % 10) == 0 draw_arrow_sprites(@arrow_sprites, false) else draw_arrow_sprites([@arrow_sprites[@index]], FF9_Config::ANIMATE_CURSOR) end end #-------------------------------------------------------------------------- # * draw_arrow_sprites #-------------------------------------------------------------------------- def draw_arrow_sprites(sprites, animated=true) for sprite in sprites image_x = animated ? @sprite_last_draw_x + @sprite_inc_x : 0 @sprite_last_draw_x = image_x sprite.bitmap.blt(image_x, 0, @arrow_image, @arrow_image.rect) end end #-------------------------------------------------------------------------- # * y= #-------------------------------------------------------------------------- def y=(value) super unless @arrow_sprites.nil? for i in 0..3 @arrow_sprites.y = (i * 80) + value + 40 end end end #-------------------------------------------------------------------------- # * x= #-------------------------------------------------------------------------- def x=(value) super unless @arrow_sprites.nil? @arrow_sprites.each { |sprite| sprite.x = value } end end #-------------------------------------------------------------------------- # * draw_background_windows #-------------------------------------------------------------------------- def draw_background_windows self.contents.blt(0, 0, @bg_image, @bg_image.rect) self.contents.blt(0, 80, @bg_image, @bg_image.rect) self.contents.blt(0, 160, @bg_image, @bg_image.rect) self.contents.blt(0, 240, @bg_image, @bg_image.rect) end #-------------------------------------------------------------------------- # * draw_background_window (single) #-------------------------------------------------------------------------- def draw_background_window(x, y) self.contents.blt(x, y, @bg_image, @bg_image.rect) end #-------------------------------------------------------------------------- # * visible #-------------------------------------------------------------------------- def visible=(value) super @arrow_sprites.each { |sprite| sprite.visible = value } end #-------------------------------------------------------------------------- # * dispose #-------------------------------------------------------------------------- alias :eds_pre_ff9_win_stat_dispose :dispose def dispose eds_pre_ff9_win_stat_dispose @arrow_sprites.each { |sprite| sprite.dispose } end def enable_cursor?(rect=nil) # for compatibility with the improved command window return false end end class Scene_Menu #-------------------------------------------------------------------------- # * create_menu_background (only if USE_CUSTOM_BACK == true) #-------------------------------------------------------------------------- if FF9_Config::USE_CUSTOM_BACK def create_menu_background @menuback_sprite = Sprite.new @menuback_sprite.bitmap = Cache.picture(FF9_Config::BACK_NAME) @menuback_sprite.color.set(16, 16, 16, 128) update_menu_background end end #-------------------------------------------------------------------------- # * OVERWRITTEN #-------------------------------------------------------------------------- def create_command_window s1 = Vocab::item s2 = Vocab::skill s3 = Vocab::equip s4 = Vocab::status s5 = Vocab::save s6 = Vocab::game_end # just changed the width of the window here @command_window = Window_Command.new(132, [s1, s2, s3, s4, s5, s6]) @command_window.index = @menu_index @command_window.stretch = false if FF9_Config::USE_TILED_WINDOW if $game_party.members.size == 0 # If number of party members is 0 @command_window.draw_item(0, false) # Disable item @command_window.draw_item(1, false) # Disable skill @command_window.draw_item(2, false) # Disable equipment @command_window.draw_item(3, false) # Disable status end if $game_system.save_disabled # If save is forbidden @command_window.draw_item(4, false) # Disable save end # new stuff here @command_window.font_name = FF9_Config::DEFAULT_FONT @command_window.x = 528 - @command_window.width @command_window.y = 16 @command_window.back_opacity = 255 end #-------------------------------------------------------------------------- # * This method is intended to fix some compatibility problems # that scripts run into when they change the command window # in some way. So, we let them override "create_command_window" # and we simply don't call it from the "start" method. # Instead, we call this method which does some extra checking. #-------------------------------------------------------------------------- def eds_create_command_window create_command_window old_commands = @command_window.commands return if old_commands == [ Vocab::item, Vocab::skill, Vocab::equip, Vocab::status, Vocab::save, Vocab::game_end ] # so we know that the default command window is not being used # we don't want to create another window, so we manually resize it # before the player can see. long = '' # dynamically size the width based on the longest command old_commands.each { |command| long = command if command.length > long.length } # set the index to -1 so that the rectangle disappears. # if we don't do this, you can see the selection rectangle resize. @command_window.index = -1 @command_window.width = @command_window.contents.text_size(long).width + 42 @command_window.contents = Bitmap.new( @command_window.width - 32, @command_window.height - 32 ) @command_window.font_name = FF9_Config::DEFAULT_FONT @command_window.x = 528 - @command_window.width @command_window.y = 16 @command_window.back_opacity = 255 @command_window.refresh @command_window.index = @menu_index end #-------------------------------------------------------------------------- # * OVERWRITTEN #-------------------------------------------------------------------------- def start super create_menu_background #call this method for compatibility eds_create_command_window @gold_window = Window_TimeGold.new(372, 342) @gold_window.y -= @gold_window.height @gold_window.x = 528 - @gold_window.width @status_window = Window_MenuStatus.new(0, 12) @location_window = Window_MenuLocation.new(0, 0) @location_window.x = 528 - @location_window.width @location_window.y = 398 - @location_window.height end #-------------------------------------------------------------------------- # * Termination Processing #-------------------------------------------------------------------------- alias :eds_pre_ff9_menu_scene_menu_terminate :terminate def terminate eds_pre_ff9_menu_scene_menu_terminate @location_window.dispose end end class Scene_Item < Scene_Base #-------------------------------------------------------------------------- # * start #-------------------------------------------------------------------------- alias :eds_pre_ff9_menu_scene_item_start :start def start eds_pre_ff9_menu_scene_item_start @target_window.y = 58 @uses_window = Window_Uses.new(true, @help_window.height, nil) @uses_window.visible = false end #-------------------------------------------------------------------------- # * OVERWRITTEN # - right-align flag ignored #-------------------------------------------------------------------------- alias :eds_pre_ff9_menu_win_stat_show_target_window :show_target_window def show_target_window(right) @uses_window.item = @item_window.item @uses_window.visible = true @item_window.visible = false @item_window.active = false @target_window.visible = true @target_window.active = true @viewport.rect.set(0, 0, 544, 416) @viewport.ox = 0 end #-------------------------------------------------------------------------- # * hide_target_window #-------------------------------------------------------------------------- alias :eds_pre_ff9_menu_scene_item_hide_target_window :hide_target_window def hide_target_window eds_pre_ff9_menu_scene_item_hide_target_window @uses_window.visible = false unless @uses_window.nil? @item_window.visible = true end #-------------------------------------------------------------------------- # * determine_target #-------------------------------------------------------------------------- alias :eds_pre_ff9_menu_scene_item_determine_target :determine_target def determine_target eds_pre_ff9_menu_scene_item_determine_target @uses_window.item = @item_window.item end #-------------------------------------------------------------------------- # * Termination Processing #-------------------------------------------------------------------------- alias :eds_pre_ff9_menu_scene_item_terminate :terminate def terminate eds_pre_ff9_menu_scene_item_terminate @uses_window.dispose end end class Scene_Skill < Scene_Base #-------------------------------------------------------------------------- # * start #-------------------------------------------------------------------------- alias :eds_pre_ff9_menu_scene_skill_start :start def start eds_pre_ff9_menu_scene_skill_start @target_window.y = 58 @uses_window = Window_SkillUses.new(true, @help_window.height, nil, nil) @uses_window.visible = false end #-------------------------------------------------------------------------- # * OVERWRITTEN # - right-align flag ignored #-------------------------------------------------------------------------- def show_target_window(right) @uses_window.set_skill($game_party.members[@actor_index], @skill_window.skill) @uses_window.visible = true @status_window.visible = false @skill_window.visible = false @skill_window.active = false @target_window.visible = true @target_window.active = true @viewport.rect.set(0, 0, 544, 416) @viewport.ox = 0 end #-------------------------------------------------------------------------- # * hide_target_window #-------------------------------------------------------------------------- alias :eds_pre_ff9_menu_scene_skill_hide_target_window :hide_target_window def hide_target_window eds_pre_ff9_menu_scene_skill_hide_target_window @uses_window.visible = false unless @uses_window.nil? @skill_window.visible = true @status_window.visible = true end #-------------------------------------------------------------------------- # * determine_target #-------------------------------------------------------------------------- alias :eds_pre_ff9_menu_scene_skill_determine_target :determine_target def determine_target eds_pre_ff9_menu_scene_skill_determine_target @uses_window.set_skill($game_party.members[@actor_index], @skill_window.skill) end #-------------------------------------------------------------------------- # * Termination Processing #-------------------------------------------------------------------------- alias :eds_pre_ff9_menu_scene_item_terminate :terminate def terminate eds_pre_ff9_menu_scene_item_terminate @uses_window.dispose end end Due: Spoiler class WindowCursorRect < Rect attr_reader :x attr_reader :y attr_reader :width attr_reader :height #-------------------------------------------------------------------- # * intialize #-------------------------------------------------------------------- def initialize(window) @window = window @x = 0 @y = 0 @width = 0 @height = 0 end #-------------------------------------------------------------------- # * empty #-------------------------------------------------------------------- def empty needupdate = (@x != 0) || (@y != 0) || (@width != 0) || (@height != 0) if needupdate @x = 0 @y = 0 @width = 0 @height = 0 @window.width = @window.width end end #-------------------------------------------------------------------- # * isEmpty #-------------------------------------------------------------------- def isEmpty? return @x == 0 && @y == 0 && @width == 0 && @height == 0 end #-------------------------------------------------------------------- # * set #-------------------------------------------------------------------- def set(x,y,width,height) needupdate=@x!=x || @y!=y || @width!=width || @height!=height if needupdate @x=x @y=y @width=width @height=height @window.width=@window.width end end #-------------------------------------------------------------------- # * height= #-------------------------------------------------------------------- def height=(value) @height=value; @window.width=@window.width end #-------------------------------------------------------------------- # * width= #-------------------------------------------------------------------- def width=(value) @width=value; @window.width=@window.width end #-------------------------------------------------------------------- # * x= #-------------------------------------------------------------------- def x=(value) @x=value; @window.width=@window.width end #-------------------------------------------------------------------- # * y= #-------------------------------------------------------------------- def y=(value) @y=value; @window.width=@window.width end end #---------------------------------------------------------------------- # * Window Class #---------------------------------------------------------------------- class Window attr_reader :tone attr_reader :color attr_reader :blend_type attr_reader :contents_blend_type attr_reader :viewport attr_reader :contents attr_reader :ox attr_reader :oy attr_reader :x attr_reader :y attr_reader :z attr_reader :width attr_reader :active attr_reader :pause attr_reader :height attr_reader :opacity attr_reader :back_opacity attr_reader :contents_opacity attr_reader :visible attr_reader :cursor_rect attr_reader :openness #-------------------------------------------------------------------- # * windowskin #-------------------------------------------------------------------- def windowskin return @_windowskin end #-------------------------------------------------------------------- # * intialize #-------------------------------------------------------------------- def initialize(viewport=nil) @sprites={} @spritekeys= [ "back", "corner0","side0","scroll0", "corner1","side1","scroll1", "corner2","side2","scroll2", "corner3","side3","scroll3", "cursor","contents","pause" ] @sidebitmaps=[nil,nil,nil,nil] @cursorbitmap=nil @bgbitmap=nil @viewport=viewport @spritekeys.each { |key| @sprites[key]=Sprite.new(@viewport) } @disposed=false @tone=Tone.new(0,0,0) @color=Color.new(0,0,0,0) @blankcontents=Bitmap.new(1,1) # RGSS2 requires this @contents=@blankcontents @_windowskin=nil @rpgvx=false @x=0 @y=0 @width=0 @openness=255 @height=0 @ox=0 @oy=0 @z=0 @stretch=true @visible=true @active=true @blend_type=0 @contents_blend_type=0 @opacity=255 @back_opacity=255 @contents_opacity=255 @cursor_rect=WindowCursorRect.new(self) @cursorblink=0 @cursoropacity=255 @pause=false @pauseopacity=255 @pauseframe=0 privRefresh(true) end #-------------------------------------------------------------------- # * dispose #-------------------------------------------------------------------- def dispose if !self.disposed? for i in @sprites i[1].dispose if i[1] @sprites[i[0]]=nil end for i in 0...@sidebitmaps.length @sidebitmaps.dispose if @sidebitmaps @sidebitmaps=nil end @blankcontents.dispose @cursorbitmap.dispose if @cursorbitmap @backbitmap.dispose if @backbitmap @sprites.clear @sidebitmaps.clear @_windowskin=nil @_contents=nil @disposed=true end end #-------------------------------------------------------------------- # * openness= #-------------------------------------------------------------------- def openness=(value) @openness=value @openness=0 if @openness<0 @openness=255 if @openness>255 privRefresh end #-------------------------------------------------------------------- # * strecth= #-------------------------------------------------------------------- def stretch=(value) @stretch=value privRefresh(true) end #-------------------------------------------------------------------- # * visible= #-------------------------------------------------------------------- def visible=(value) @visible=value privRefresh end #-------------------------------------------------------------------- # * viewposrt= #-------------------------------------------------------------------- def viewport=(value) @viewport=value for i in @spritekeys @sprites.dispose if @sprites.is_a?(Sprite) @sprites = Sprite.new(@viewport) elsif @sprites.is_a?(Plane) @sprites = Plane.new(@viewport) else @sprites = nil end end privRefresh(true) end #-------------------------------------------------------------------- # * z= #-------------------------------------------------------------------- def z=(value) @z=value privRefresh end #-------------------------------------------------------------------- # * disposed? #-------------------------------------------------------------------- def disposed? return @disposed end #-------------------------------------------------------------------- # * contents= #-------------------------------------------------------------------- def contents=(value) @contents=value privRefresh end #-------------------------------------------------------------------- # * windowskin= #-------------------------------------------------------------------- def windowskin=(value) @_windowskin=value if value && value.is_a?(Bitmap) && !value.disposed? && value.width==128 @rpgvx=true else @rpgvx=false end privRefresh(true) end #-------------------------------------------------------------------- # * ox= #-------------------------------------------------------------------- def ox=(value) @ox=value privRefresh end #-------------------------------------------------------------------- # * active= #-------------------------------------------------------------------- def active=(value) @active=value privRefresh(true) end #-------------------------------------------------------------------- # * cursor_rect= #-------------------------------------------------------------------- def cursor_rect=(value) if !value @cursor_rect.empty else @cursor_rect.set(value.x,value.y,value.width,value.height) end end #-------------------------------------------------------------------- # * oy= #-------------------------------------------------------------------- def oy=(value) @oy=value privRefresh end #-------------------------------------------------------------------- # * width= #-------------------------------------------------------------------- def width=(value) @width=value privRefresh(true) end #-------------------------------------------------------------------- # * height= #-------------------------------------------------------------------- def height=(value) @height=value privRefresh(true) end #-------------------------------------------------------------------- # * pause= #-------------------------------------------------------------------- def pause=(value) @pause=value @pauseopacity=0 if !value privRefresh end #-------------------------------------------------------------------- # * x= #-------------------------------------------------------------------- def x=(value) @x=value privRefresh end #-------------------------------------------------------------------- # * y= #-------------------------------------------------------------------- def y=(value) @y=value privRefresh end #-------------------------------------------------------------------- # * opacity= #-------------------------------------------------------------------- def opacity=(value) @opacity=value @opacity=0 if @opacity<0 @opacity=255 if @opacity>255 privRefresh end #-------------------------------------------------------------------- # * back_opacity= #-------------------------------------------------------------------- def back_opacity=(value) @back_opacity=value @back_opacity=0 if @back_opacity<0 @back_opacity=255 if @back_opacity>255 privRefresh end #-------------------------------------------------------------------- # * contents_opacity= #-------------------------------------------------------------------- def contents_opacity=(value) @contents_opacity=value @contents_opacity=0 if @contents_opacity<0 @contents_opacity=255 if @contents_opacity>255 privRefresh end #-------------------------------------------------------------------- # * tone= #-------------------------------------------------------------------- def tone=(value) @tone=value privRefresh end #-------------------------------------------------------------------- # * color= #-------------------------------------------------------------------- def color=(value) @color=value privRefresh end #-------------------------------------------------------------------- # * blend_type= #-------------------------------------------------------------------- def blend_type=(value) @blend_type=value privRefresh end #-------------------------------------------------------------------- # * flash #-------------------------------------------------------------------- def flash(color,duration) return if disposed? @sprites.each {|sprite| sprite[1].flash(color,duration)} end def update return if disposed? mustchange=false if @active if @cursorblink==0 @cursoropacity-=8 @cursorblink = 1 if @cursoropacity<=128 else @cursoropacity+=8 @cursorblink=0 if @cursoropacity>=255 end mustchange=true if !@cursor_rect.isEmpty? else mustchange=true if @cursoropacity!=128 @cursoropacity=128 end if @pause @pauseframe=(Graphics.frame_count / 8) % 4 @pauseopacity=[@pauseopacity+64,255].min mustchange=true end privRefresh if mustchange for i in @sprites i[1].update end end #------------------ Private Methods ------------------# private #-------------------------------------------------------------------- # * ensureBitmap #-------------------------------------------------------------------- def ensureBitmap(bitmap,dwidth,dheight) if !bitmap||bitmap.disposed?||bitmap.width<dwidth||bitmap.height<dheight bitmap.dispose if bitmap bitmap=Bitmap.new([1,dwidth].max,[1,dheight].max) end return bitmap end #-------------------------------------------------------------------- # * tileBitmap #-------------------------------------------------------------------- def tileBitmap(dstbitmap,dstrect,srcbitmap,srcrect) return if !srcbitmap || srcbitmap.disposed? left=dstrect.x top=dstrect.y y=0;loop do break unless y<dstrect.height x=0;loop do break unless x<dstrect.width dstbitmap.blt(x+left,y+top,srcbitmap,srcrect) x+=srcrect.width end y+=srcrect.height end end #-------------------------------------------------------------------- # * privRefresh #-------------------------------------------------------------------- def privRefresh(changeBitmap=false) return if self.disposed? backopac = self.back_opacity * self.opacity / 255 contopac = self.contents_opacity cursoropac = @cursoropacity * contopac / 255 @sprites["contents"].bitmap = @contents unless @_windowskin.nil? || @_windowskin.disposed? for i in 0...4 @sprites["corner#{i}"].bitmap = @_windowskin @sprites["corner#{i}"].opacity = @opacity @sprites["corner#{i}"].tone = @tone @sprites["corner#{i}"].color = @color @sprites["corner#{i}"].blend_type = @blend_type @sprites["corner#{i}"].visible = @visible @sprites["side#{i}"].opacity = @opacity @sprites["side#{i}"].tone = @tone @sprites["side#{i}"].color = @color @sprites["side#{i}"].blend_type = @blend_type @sprites["side#{i}"].visible = @visible @sprites["scroll#{i}"].bitmap = @_windowskin @sprites["scroll#{i}"].opacity = @opacity @sprites["scroll#{i}"].tone = @tone @sprites["scroll#{i}"].blend_type = @blend_type @sprites["scroll#{i}"].color = @color @sprites["scroll#{i}"].visible = @visible end @sprites["pause"].bitmap = @_windowskin for key in ["back", "cursor", "pause", "contents"] @sprites[key].color = @color @sprites[key].tone = @tone @sprites[key].blend_type = @blend_type end @sprites["contents"].blend_type = @contents_blend_type @sprites["contents"].opacity = contopac @sprites["contents"].visible = @visible && (@openness == 255) @sprites["cursor"].opacity = cursoropac @sprites["cursor"].visible = @visible && (@openness == 255) @sprites["pause"].visible = @visible && @pause @sprites["pause"].opacity = @pauseopacity @sprites["back"].opacity = backopac @sprites["back"].visible = @visible hascontents = (!@contents.nil? && !@contents.disposed?) @sprites["scroll0"].visible = @visible && hascontents && @oy > 0 @sprites["scroll1"].visible = @visible && hascontents && @ox > 0 @sprites["scroll2"].visible = @visible && hascontents && (@contents.width - @ox) > @width - 32 @sprites["scroll3"].visible = @visible && hascontents && (@contents.height - @oy) > @height - 32 else for i in 0...4 @sprites["corner#{i}"].visible = false @sprites["side#{i}"].visible = false @sprites["scroll#{i}"].visible = false end @sprites["contents"].visible = @visible && @openness==255 @sprites["contents"].color = @color @sprites["contents"].tone = @tone @sprites["contents"].blend_type = @contents_blend_type @sprites["contents"].opacity = contopac @sprites["back"].visible = false @sprites["pause"].visible = false @sprites["cursor"].visible = false end @sprites.each { |sprite| sprite[1].z = @z } if @rpgvx @sprites["cursor"].z = @z # For Compatibility @sprites["contents"].z = @z # For Compatibility @sprites["pause"].z = @z # For Compatibility trimX = 64 backRect = Rect.new(0,0,64,64) blindsRect = Rect.new(0,64,64,64) else @sprites["cursor"].z = @z + 1 # For Compatibility @sprites["contents"].z = @z + 2 # For Compatibility @sprites["pause"].z = @z + 2 # For Compatibility trimX = 128 backRect = Rect.new(0,0,128,128) blindsRect = nil end trimY = 0 @sprites["corner0"].src_rect.set(trimX, trimY + 0, 16, 16); @sprites["corner1"].src_rect.set(trimX + 48, trimY + 0, 16, 16); @sprites["corner2"].src_rect.set(trimX, trimY + 48, 16, 16); @sprites["corner3"].src_rect.set(trimX + 48, trimY + 48, 16, 16); @sprites["scroll0"].src_rect.set(trimX + 24, trimY + 16, 16, 8) # up @sprites["scroll3"].src_rect.set(trimX + 24, trimY + 40, 16, 8) # down @sprites["scroll1"].src_rect.set(trimX + 16, trimY + 24, 8, 16) # left @sprites["scroll2"].src_rect.set(trimX + 40, trimY + 24, 8, 16) # right cursorX=trimX cursorY=trimY + 64 sideRects= [ Rect.new(trimX + 16, trimY + 0, 32, 16), Rect.new(trimX, trimY + 16, 16, 32), Rect.new(trimX + 48, trimY + 16, 16, 32), Rect.new(trimX + 16, trimY + 48, 32, 16) ] if (@width > 32) && (@height > 32) @sprites["contents"].src_rect.set(@ox, @oy, @width - 32, @height - 32) else @sprites["contents"].src_rect.set(0,0,0,0) end pauseRects=[ trimX + 32, trimY + 64, trimX + 48, trimY + 64, trimX + 32, trimY + 80, trimX + 48, trimY + 80, ] pauseWidth = 16 pauseHeight = 16 @sprites["pause"].src_rect.set( pauseRects[@pauseframe*2], pauseRects[@pauseframe*2+1], pauseWidth,pauseHeight ) @sprites["pause"].x = @x + (@width / 2) - (pauseWidth / 2) @sprites["pause"].y = @y + @height - 16 # 16 refers to skin margin @sprites["contents"].x = @x + 16 @sprites["contents"].y = @y + 16 @sprites["corner0"].x = @x @sprites["corner0"].y = @y @sprites["corner1"].x = @x + @width - 16 @sprites["corner1"].y = @y @sprites["corner2"].x = @x @sprites["corner2"].y = @y + @height - 16 @sprites["corner3"].x = @x + @width - 16 @sprites["corner3"].y = @y + @height - 16 @sprites["side0"].x = @x + 16 @sprites["side0"].y = @y @sprites["side1"].x = @x @sprites["side1"].y = @y + 16 @sprites["side2"].x = @x + @width - 16 @sprites["side2"].y = @y + 16 @sprites["side3"].x = @x + 16 @sprites["side3"].y = @y + @height - 16 @sprites["scroll0"].x = @x + @width / 2 - 8 @sprites["scroll0"].y = @y + 8 @sprites["scroll1"].x = @x + 8 @sprites["scroll1"].y = @y + @height / 2 - 8 @sprites["scroll2"].x = @x + @width - 16 @sprites["scroll2"].y = @y + @height / 2 - 8 @sprites["scroll3"].x = @x + @width / 2 - 8 @sprites["scroll3"].y = @y + @height - 16 @sprites["back"].x = @x + 2 @sprites["back"].y = @y + 2 @sprites["cursor"].x = @x + 16 + @cursor_rect.x @sprites["cursor"].y = @y + 16 + @cursor_rect.y if changeBitmap && !@_windowskin.nil? && !@_windowskin.disposed? width = @cursor_rect.width height = @cursor_rect.height if (width > 0) && (height > 0) cursorrects=[ # sides Rect.new(cursorX+2, cursorY+0, 28, 2), Rect.new(cursorX+0, cursorY+2, 2, 28), Rect.new(cursorX+30, cursorY+2, 2, 28), Rect.new(cursorX+2, cursorY+30, 28, 2), # corners Rect.new(cursorX+0, cursorY+0, 2, 2), Rect.new(cursorX+30, cursorY+0, 2, 2), Rect.new(cursorX+0, cursorY+30, 2, 2), Rect.new(cursorX+30, cursorY+30, 2, 2), # back Rect.new(cursorX+2, cursorY+2, 28, 28) ] margin = 2 fullmargin = 4 @cursorbitmap = ensureBitmap(@cursorbitmap, width, height) @cursorbitmap.clear @sprites["cursor"].bitmap = @cursorbitmap @sprites["cursor"].src_rect.set(0, 0, width, height) rect = Rect.new(margin, margin, width - fullmargin, height - fullmargin) @cursorbitmap.stretch_blt(rect, @_windowskin, cursorrects[8]) @cursorbitmap.blt(0, 0, @_windowskin, cursorrects[4]) # top left @cursorbitmap.blt(width-margin, 0, @_windowskin, cursorrects[5]) # top right @cursorbitmap.blt(0, height-margin, @_windowskin, cursorrects[6])# bottom right @cursorbitmap.blt(width-margin, height-margin, @_windowskin, cursorrects[7]) # bottom left rect = Rect.new(margin, 0, width - fullmargin, margin) @cursorbitmap.stretch_blt(rect, @_windowskin, cursorrects[0]) rect = Rect.new(0, margin, margin, height - fullmargin) @cursorbitmap.stretch_blt(rect, @_windowskin, cursorrects[1]) rect = Rect.new(width - margin, margin, margin, height - fullmargin) @cursorbitmap.stretch_blt(rect, @_windowskin, cursorrects[2]) rect = Rect.new(margin, height-margin, width - fullmargin, margin) @cursorbitmap.stretch_blt(rect, @_windowskin, cursorrects[3]) else @sprites["cursor"].visible = false @sprites["cursor"].src_rect.set(0, 0, 0, 0) end for i in 0..3 dwidth = (i == 0 || i == 3) ? @width-32 : 16 dheight = (i == 0 || i == 3) ? 16 : @height - 32 @sidebitmaps = ensureBitmap(@sidebitmaps, dwidth, dheight) @sprites["side#{i}"].bitmap = @sidebitmaps @sprites["side#{i}"].src_rect.set(0, 0, dwidth, dheight) @sidebitmaps.clear if (sideRects.width > 0) && (sideRects.height > 0) @sidebitmaps.stretch_blt( @sprites["side#{i}"].src_rect, @_windowskin,sideRects ) end end backwidth = @width-4 backheight = @height-4 if (backwidth > 0) && (backheight > 0) @backbitmap = ensureBitmap(@backbitmap, backwidth, backheight) @sprites["back"].bitmap = @backbitmap @sprites["back"].src_rect.set(0, 0, backwidth, backheight) @backbitmap.clear if @stretch @backbitmap.stretch_blt(@sprites["back"].src_rect, @_windowskin,backRect) else tileBitmap(@backbitmap,@sprites["back"].src_rect, @_windowskin,backRect) end if blindsRect tileBitmap(@backbitmap,@sprites["back"].src_rect, @_windowskin,blindsRect) end else @sprites["back"].visible = false @sprites["back"].src_rect.set(0,0,0,0) end end if @openness != 255 opn = @openness/255.0 for key in @spritekeys sprite = @sprites[key] ratio = (@height <= 0) ? 0 : (sprite.y - @y) * 1.0 / @height sprite.zoom_y = opn sprite.oy = 0 sprite.y = (@y + (@height / 2.0) + (@height * ratio * opn) - (@height / 2 * opn)).floor oldbitmap = sprite.bitmap oldsrcrect = sprite.src_rect.clone end else for key in @spritekeys sprite = @sprites[key] sprite.zoom_y = 1.0 end end # Ensure z order i = 0 for key in @spritekeys sprite = @sprites[key] y = sprite.y sprite.y = i sprite.oy = (sprite.zoom_y <= 0) ? 0 : (i - y) / sprite.zoom_y end end end CRAFTING SYSTEM Redefinitions: Spoiler #---------------------------------------------------------------# Redefine the menu to add the crafting window # & # Add a definition for crafting terminoligy to the Vocab #--------------------------------------------------------------- module Vocab def self.crafting #change this term if you want to call crafting something else in your game return "Crafting" end end module Sound #play critical success. change the SE if you want a different one def self.play_critical Audio.se_play("Audio/SE/Chime2", 100, 100) end end class Scene_Menu < Scene_Base def start #-------------------------------------------------------------------------- # Set this to true if you want to disable the "crafting" entry in the menu #-------------------------------------------------------------------------- @disableMenuChoice = false super create_menu_background if @disableMenuChoice oldCmdWindow else create_command_window end @gold_window = Window_Gold.new(0, 360) @status_window = Window_MenuStatus.new(160, 0) end def update super update_menu_background @command_window.update @gold_window.update @status_window.update if @command_window.active if @disableMenuChoice oldUpdCmdSel else update_command_selection end elsif @status_window.active update_actor_selection end end alias oldCmdWindow create_command_window def create_command_window s1 = Vocab::item s2 = Vocab::skill s3 = Vocab::equip s4 = Vocab::status s5 = Vocab::crafting s6 = Vocab::save s7 = Vocab::game_end @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7]) @command_window.index = @menu_index if $game_party.members.size == 0 # If number of party members is 0 @command_window.draw_item(0, false) # Disable item @command_window.draw_item(1, false) # Disable skill @command_window.draw_item(2, false) # Disable equipment @command_window.draw_item(3, false) # Disable status end if $game_system.save_disabled # If save is forbidden @command_window.draw_item(4, false) # Disable save end end alias oldUpdCmdSel update_command_selection def update_command_selection if Input.trigger?(Input::B) Sound.play_cancel $scene = Scene_Map.new elsif Input.trigger?(Input::C) if $game_party.members.size == 0 and @command_window.index < 4 Sound.play_buzzer return elsif $game_system.save_disabled and @command_window.index == 4 Sound.play_buzzer return end Sound.play_decision case @command_window.index when 0 # Item $scene = Scene_Item.new when 1,2,3 # Skill, equipment, status start_actor_selection when 4 # Crafting window $scene = Scene_Crafting.new when 5 #save $scene = Scene_File.new(true, false, false) when 6 # End Game $scene = Scene_End.new end end end end #------------------------------------------------------------------------------- # # Redefined the Scene_Title class to add the new systems into the game object # creation method. # #------------------------------------------------------------------------------- class Scene_Title < Scene_Base alias oldCreateGameObjectsACS create_game_objects def create_game_objects oldCreateGameObjectsACS $game_crafting = Game_Crafting.new end end #------------------------------------------------------------------------------- # # Wouldn't it be great if we could save our custom system data? # #------------------------------------------------------------------------------- class Scene_File < Scene_Base alias oldWriteSaveACS write_save_data def write_save_data(file) oldWriteSaveACS(file) Marshal.dump($game_crafting, file) end #------------------------------------------------------------------------------- # We need to be able to load it again though! #------------------------------------------------------------------------------- alias oldReadSaveACS read_save_data def read_save_data(file) oldReadSaveACS(file) $game_crafting = Marshal.load(file) end end #------------------------------------------------------------------------------- # # Extra methods are added to keep track of whether or not a party member # has been discovered. This allows for party hotswaping and accurate equip # feedback in the crafting status window # #------------------------------------------------------------------------------- class Game_Actors attr_accessor :discovered def initialize @data = [] initDiscovered end #----------------------------------------------------------------------------- # Sets all party members to discovered false, then checks the DB data to see # who actually has been discovered #----------------------------------------------------------------------------- def initDiscovered @discovered = [] for x in 1..@data.length @discovered[x-1] = false end for i in $data_system.party_members @discovered = true end end def length return @data.length end end #------------------------------------------------------------------------------ # # The game actor class needs to have some discovery methods # #------------------------------------------------------------------------------ class Game_Actor < Game_Battler #--------------------------------------------------- # Checks to see if an actor has been discovered yet #--------------------------------------------------- def isDiscovered? return $game_actors.discovered[@actor_id] end def discover $game_actors.discovered[@actor_id] = true end def hide $game_actors.discovered[@actor_id] = false end end Recipe: Spoiler #------------------------------------------------------------------------------# # This class defines a recipe object for use with the crafting system # #------------------------------------------------------------------------------ class Recipe attr_reader :name attr_reader :createdAmount attr_reader :criticalName attr_reader :criticalItem attr_reader :critAmount attr_reader :numOfIngredients attr_reader :ingredients attr_reader :ingAmounts attr_reader :itemCreated attr_reader :criticaled attr_reader :difficulty attr_reader :bonusStat attr_reader :disabledReason attr_reader :category #----------------------------------------------------------------------------- # # name: Name of item that the recipe makes # ingredients[]: An array of the ingredients used to make the item # ingAmounts[]: An array containing the amount of each ingredient needed # itemCreated: An int representing the item to be created # createdAmount: The amount of items to be created by the recipe normally # criticalItem: The item that is created if the recipe is a critical success # critAmount: Amount of the critical item created on a critical success # critChance: Chance this recipe will be criticaled. This is modded by # the party's average intelligence when the crafting system # creates the recipe. # difficulty: int 0 to 9 where 0 is easiest and 9 is most difficult #----------------------------------------------------------------------------- def initialize( name, ingredients, ingAmounts, itemCreated, createdAmount, criticalItem, critAmount, critChance, difficulty, bonusStat, bonusInterval, category) @name = name @ingredients = ingredients @numOfIngredients = ingredients.length @ingAmounts = ingAmounts @itemCreated = itemCreated @createdAmount = createdAmount @criticalItem = criticalItem @criticalName = criticalItem.name @critAmount = critAmount @critChance = critChance @difficulty = difficulty @bonusStat = bonusStat @bonusInterval = bonusInterval @category = category @discovered = false #-------------------------------------------------------------------------- # Recipe behavior customization starts here. # # @allowDiscoveryByItems: Allows recipes to be discovered when # ingredients of the recipe have been found # @requireAllItems: Requires all items of a recipe to be found # before the recipe will be revealed. # @allowStatBonuses: Allows bonus critical chance from the party's # current stats. # @requireStatThreshold: Requires an amount of the bonus stat in order # to craft the item. # @requireTools: Requires the presence of crafting tools to # make an item. #-------------------------------------------------------------------------- @allowDiscoveryByItems = true @requireAllItems = false @allowStatBonuses = true @requireStatThreshold = true @requireTools = true end #---------------------------------------------------------------------------- # Determines if the item is currently able to be crafted by the party #---------------------------------------------------------------------------- def isCraftable? #check to see if the party has enough of each needed ingredient for x in 1..@numOfIngredients if $game_party.item_number(@ingredients[x-1]) < @ingAmounts[x-1] @disabledReason = "Non possiedi gli ingredienti necessari!" return false end end #check to see if the party has the right tools if @requireTools requiredTools = $game_crafting.tools(@category) for tool in requiredTools if not $game_party.has_item?($data_items[tool]) @disabledReason = "Non hai gli oggetti necessari!" return false end end end #now check to see if the party has the neccessary stat if @requireStatThreshold avgStat = totalStat / $game_party.members.length if avgStat < $game_crafting.difficulties(@bonusStat)[@difficulty] case @bonusStat when 0 @disabledReason = "Il party non è abbastanza forte per creare questo oggetto!" when 1 @disabledReason = "Il party non è abbastanza ardito per creare questo oggetto!" when 2 @disabledReason = "Il party non è abbastanza brillante per creare questo oggetto!" when 3 @disabledReason = "Il party non è abbastanza rapido per creare questo oggetto!" end return false end end #if we didn't return yet, then the party has enough of each ingredient #and is smart enough to figure out how to put everything together return true end #---------------------------------------------------------------------------- # Determines if the recipe has been discovered by the party. # Recipes reveal when at least one ingredient is discovered or if they # Are found in the gameworld from a book, npc or other method #---------------------------------------------------------------------------- def isDiscovered? #check the flag first! if @discovered return true end #now check inventory for at least one item of each ingredient. include #equiped items! If we have it, then set the flag before returning. if @allowDiscoveryByItems totalItemsFound = 0 for x in 1..@numOfIngredients if $game_party.has_item?(@ingredients[x-1], true) totalItemsFound += 1 if not @requireAllItems @discovered = true return true end end end if totalItemsFound == @numOfIngredients @discovered = true return true end end #discovered flag is false and the party doesn't have any of the ingredients return false end #---------------------------------------------------------------------------- # These methods check the created item's type #---------------------------------------------------------------------------- def makesWeapon? return @itemCreated.is_a?(RPG::Weapon) end def makesArmor? return @itemCreated.is_a?(RPG::Armor) end def makesItem? return @itemCreated.is_a?(RPG::Item) end #---------------------------------------------------------------------------- # this will set discovered to true. this is so game NPCs, books or other # events can grant recipes that the party does not have ingredients for yet #---------------------------------------------------------------------------- def setDiscovered @discovered = true end #---------------------------------------------------------------------------- # This will execute the crafting recipe, removing the components and adding # the result to the party's inventory #---------------------------------------------------------------------------- def make #remove ingredients for x in 1..@numOfIngredients $game_party.lose_item(@ingredients[x-1], @ingAmounts[x-1]) end #calc critical chance totalCritChance = calcCriticalChance #make item! if rand(100) < totalCritChance $game_party.gain_item(@criticalItem, @critAmount) @criticaled = true else $game_party.gain_item(@itemCreated, @createdAmount) end end def calcCriticalChance if @allowStatBonuses # set stat bonus avgStat = (totalStat / $game_party.members.length) statBonus = avgStat - $game_crafting.difficulties(@bonusStat)[@difficulty] statBonus /= @bonusInterval totalCritChance = @critChance + statBonus else totalCritChance = @critChance end if totalCritChance > 100 totalCritChance = 100 end return totalCritChance end #---------------------------------------- # Returns the party's total intelligence #---------------------------------------- def totalStat x = 0 total = 0 case @bonusStat when 0 while x < $game_party.members.length total += $game_party.members[x].base_atk x += 1 end when 1 while x < $game_party.members.length total += $game_party.members[x].base_def x += 1 end when 2 while x < $game_party.members.length total += $game_party.members[x].base_spi x += 1 end when 3 while x < $game_party.members.length total += $game_party.members[x].base_agi x += 1 end end return total end #--------------------------------------- # Returns the recipe icon index #--------------------------------------- def icon_index(critical = false) if critical return @criticalItem.icon_index else return @itemCreated.icon_index end end #-------------------------------------------- # Resets the recipe critical flag to normal #-------------------------------------------- def resetCriticaled @criticaled = false end end Game_Crafting: Spoiler #--------------------------------------------------------------------# # This class implements the custom crafting system. The instanced # variable name is $game_crafting # #-------------------------------------------------------------------- class Game_Crafting attr_reader :categoryLabels attr_reader :categoryText attr_accessor :categoryStates #---------------------------------- # Init the system. #---------------------------------- def initialize initRecipes initDifficulties initCategories end #----------------------------------------------------------------------------- # creates the array for difficulty level comparisons. # Current party must have an average of this int in order to make the item #----------------------------------------------------------------------------- def initDifficulties @atkThresholds = [25, 40, 55, 70, 85, 100, 115, 130, 145, 160] @defThresholds = [25, 40, 55, 70, 85, 100, 115, 130, 145, 160] @spiThresholds = [25, 50, 75, 100, 125, 150, 175, 200, 225, 250] @agiThresholds = [25, 50, 75, 100, 125, 150, 175, 200, 225, 250] end #----------------------------------------------------------------------------- # Defines the text and required tools of each category #----------------------------------------------------------------------------- def initCategories #--------------------------------------------------------------------------- # Type in the names of your crafting categories here. As you can see, you # are not required to use all 10 spaces! Just make sure to have a comma # after the quotations for every item EXCEPT the last. #--------------------------------------------------------------------------- @categoryLabels = [ #Category 0 "Alchimia", #Category 1 "Creare Lingotti", #Category 2 "Forgiare Armature", #Category 3 "Forgiare Armi", #Category 4 "Forgiare Anelli", #Category 5 "Intagliare Bastoni", #Category 6 "Potenziamento Armi" #Category 7 #Category 8 #Category 9 ] #--------------------------------------------------------------------------- # Each number refers to the RPG::Item index of the required tool. You # should have the same number of categories here as you did above! # Make sure there is a comma after every bracket pair [] EXCEPT the last! #--------------------------------------------------------------------------- @requiredTools = [ #Category 0 [55, 56], #Category 1 [50, 51], #Category 2 [50, 51], #Category 3 [50, 51], #Category 4 [50, 51], #Category 5 [69, 70], #Category 6 [50, 51], #Category 7 #Category 8 #Category 9 ] #--------------------------------------------------------------------------- # This is the text that appears in the help box of the crafting menu # when hovering over a category label. Same rule for commas! #--------------------------------------------------------------------------- @categoryText = [ #Category 0 "Crea pozioni e altri rimedi.", #Category 1 "Crea lingotti utili per la forgiatura di altri oggetti.", #Category 2 "Crea Armature attraverso l'uso dei lingotti.", #Category 3 "Crea Armi attraverso l'uso dei lingotti.", #Category 4 "Crea Anelli attraverso l'uso dei lingotti.", #Category 5 "Crea basoni magici partendo dal legno.", #Category 6 "Potenzia le Armi forgiate in precedenza da te.", #Category 7 #Category 8 #Category 9 ] @categoryStates = [] end #--------------------------------------------------------------------------- # Get the recipe list from the file (include a recipes.txt in Data folder) #---------------------------------------------------------------------------- def initRecipes @recipes = [] x = 0 fileName = "Data/recipes.txt" if File.exists?(fileName) recipeFile = File.new(fileName, "r") buildRecipeList(recipeFile) exportData else @recipes = load_data("Data/recipes.rf") end end def buildRecipeList(recipeFile) while (line = recipeFile.gets) thisRecipe = createNewRecipe(line) @recipes.push(thisRecipe) unless thisRecipe == nil end end def exportData fileName = "Data/recipes.rf" if File.exists?(fileName) File.delete(fileName) end file = File.new(fileName, "wb") Marshal.dump(@recipes, file) end #---------------------------------------------------------------------------- # returns a new Recipe object. the recpies.txt file should have data in the # following format: # # name: Name of the item being created # itemType: 0 for item, 1 for weapon, 2 for armor. The normal # and critical form MUST be the same item type! # numOfIngs: number of different ingredients from 1 to 9 # ingreds 01..2999: the item indexes of the ingredients. the first # character determines the item type for each # ingredient. 0 for item, 1 for weapon, 2 for armor # amounts 1..999: amount of each ingredient # normalItem: index of item created on normal success # normalAmount: amount of normal item created on success # criticalItem: item created from a critical success # critAmount: amount of crit item created # critChance: chance to crit (out of 100) # difficulty: integer 0 to 9 where 0 is easiest and 9 is hardest # bonusStat: The statistic that will be used to calculate the # bonus critical chance. 0 for attack, 1 for defense, # 2 for spiri t, 3 for agility. # bonusInterval: The amount of the bonus stat it takes to get a 1% # higher critical chance # category: The type of crafting (smithing, woodworking, etc.) # As an integer from 0 to 9! # # The file allows for empty lines and comments using '#' to start a line # Here's some example lines from the file: # # #Leather Working # Rough_Leather 0 1 0204 2 205 1 205 3 10 0 2 10 1 # # NOTE: whitespace in the name must be replaced with underscores!!! # #---------------------------------------------------------------------------- def createNewRecipe(stringToParse) #first check for nil and comments return nil if stringToParse == nil return nil if stringToParse.strip.empty? return nil if stringToParse.lstrip.index("#") != nil #first parse out the text info #split at the whitespace attributes = stringToParse.split name = attributes[0].gsub("_", " ") #the first position is name itemType = attributes[1].to_i #2nd is item type numOfIngs = attributes[2].to_i #3nd position is the num of ingredients x = 0 ingreds = [] #ingredients start at the 3rd position while x < numOfIngs number = attributes[x + 3] ingredientType = number[0,1].to_i index = number[1,number.length - 1].to_i case ingredientType #switch for ingredients when 0 ingreds.push($data_items[index]) when 1 ingreds.push($data_weapons[index]) when 2 ingreds.push($data_armors[index]) end x += 1 end y = 0 amounts = [] #amounts start after the ingredients while y < numOfIngs amounts.push(attributes[x + y + 3].to_i) y += 1 end currentIndex = x + y + 3 case itemType #switch for resulting items when 0 normalItem = $data_items[attributes[currentIndex].to_i] criticalItem = $data_items[attributes[currentIndex + 2].to_i] when 1 normalItem = $data_weapons[attributes[currentIndex].to_i] criticalItem = $data_weapons[attributes[currentIndex + 2].to_i] when 2 normalItem = $data_armors[attributes[currentIndex].to_i] criticalItem = $data_armors[attributes[currentIndex + 2].to_i] end normalAmount = attributes[currentIndex + 1].to_i critAmount = attributes[currentIndex + 3].to_i critChance = attributes[currentIndex + 4].to_i difficulty = attributes[currentIndex + 5].to_i bonusStat = attributes[currentIndex + 6].to_i bonusInterval = attributes[currentIndex + 7].to_i category = attributes[currentIndex + 8].to_i #next, create the Recipe object, initialize it and return it! thisRecipe = Recipe.new(name, ingreds, amounts, normalItem, normalAmount, criticalItem, critAmount, critChance, difficulty, bonusStat, bonusInterval, category) return thisRecipe end #---------------------------------------------------------------------------- # Returns the array of recipes that are available #---------------------------------------------------------------------------- def recipeList return @recipes end #---------------------------------------------------------------------------- # Discovers the recipe at recipeIndex #---------------------------------------------------------------------------- def discover(recipeIndex) @recipes[recipeIndex].setDiscovered end #---------------------------------------------------------------------------- # Returns the difficulties of the specified stat #---------------------------------------------------------------------------- def difficulties(stat) case stat when 0 return @atkThresholds when 1 return @defThresholds when 2 return @spiThresholds when 3 return @agiThresholds end end #---------------------------------------------------------------------------- # Returns the array of required tools for the specified category #---------------------------------------------------------------------------- def tools(category) return @requiredTools[category] end #---------------------------------------------------------------------------- # Returns the name of the statistic being requested #---------------------------------------------------------------------------- def statName(stat) case stat when 0 return "Attacco" when 1 return "Diefsa" when 2 return "Intelligenza" when 3 return "Agilità" end end end Scene_Cafting: Spoiler class Scene_Crafting < Scene_Base def start super create_menu_background @viewport = Viewport.new(0, 0, 544, 416) @help_window = Window_Help.new @help_window.viewport = @viewport @ingredients_window = Window_Crafting_Ingredients.new(248, 56, 296, 138) @ingredients_window.viewport = @viewport @status_window = Window_Crafting_Status.new(248, 194, 296, 222) @status_window.viewport = @viewport @recipe_window = Window_Crafting_Recipes.new(0, 56, 248, 360) @recipe_window.viewport = @viewport @detail_window = Window_Crafting_Details.new(0, 56, 544, 360) @detail_window.viewport = @viewport @recipe_window.ingredients_window = @ingredients_window @recipe_window.status_window = @status_window @recipe_window.help_window = @help_window @recipe_window.detail_window = @detail_window @message_window = Window_Crafting_Message.new(72, 96, 400, 84) @message_window.viewport = @viewport @message_window.visible = false @detail_window.visible = false @detail_window.back_opacity = 230 @recipe_window.active = true #--------------------------------------------------------------------------- # If you don't like getting details from pressing Y on your gampad, change # this to another button. # # NOTE: The gamepad Y button is mapped to "s" on a keyboard by default! #--------------------------------------------------------------------------- @detailButton = Input::Y end def terminate super dispose_menu_background @viewport.dispose @help_window.dispose @recipe_window.dispose @ingredients_window.dispose @status_window.dispose @message_window.dispose end def return_scene $scene = Scene_Menu.new(0) end def update super update_menu_background @recipe_window.update @message_window.update @help_window.update if @message_window.visible if Input.trigger?(Input::C) @message_window.visible = false @recipe.resetCriticaled end else update_recipe_selection end end def update_recipe_selection if Input.trigger?(Input::B) Sound.play_cancel return_scene elsif Input.trigger?(Input::C) #get the recipe under the cursor, then execute if @recipe_window.isCategory? @recipe_window.toggleCategory @recipe_window.refreshNeeded = true Sound.play_decision else @recipe = @recipe_window.recipe if @recipe != nil if @recipe.isCraftable? @recipe.make if @recipe.criticaled @message_window.drawCritical(@recipe) @message_window.visible = true Sound.play_critical else Sound.play_decision end else #if it's not craftable show the reason and play the buzzer sound @message_window.drawFailure(@recipe) @message_window.visible = true Sound.play_buzzer end @recipe_window.refreshNeeded = true else Sound.play_buzzer end end elsif Input.press?(@detailButton) and not @recipe_window.isCategory? @detail_window.visible = true @detailWindowOpened = true elsif not Input.press?(@detailButton) and @detailWindowOpened @detailWindowOpened = false @detail_window.visible = false end end end Window_Crafting_Message: Spoiler class Window_Crafting_Message < Window_Base def initialize(x, y, width, height) super(x, y, width, height) end #----------------------------------------------------------------------------- # Draws the message that appears when an item is criticaled #----------------------------------------------------------------------------- def drawCritical(recipe) self.contents.clear self.contents.draw_text(0, 0, 172, WLH, "Critical Success!") self.contents.draw_text(0, 24, 96, WLH, "Recieved") critNameString = recipe.criticalName + " x " + recipe.critAmount.to_s draw_icon(recipe.icon_index(true), 96, 24) self.contents.draw_text(128, 24, 280, WLH, critNameString) end #----------------------------------------------------------------------------- # Draws the message that appears when an item is not craftable #----------------------------------------------------------------------------- def drawFailure(recipe) self.contents.clear self.contents.draw_text(0, 0, 172, WLH, "Unable to Craft:") self.contents.draw_text(0, 24, 380, WLH, recipe.disabledReason) end end Window_Crafting_Recipes: Spoiler class Window_Crafting_Recipes < Window_Selectable attr_reader :results_window attr_reader :status_window attr_reader :detail_window attr_accessor :refreshNeeded def initialize(x, y, width, height) super(x, y, width, height) self.index = 0 #--------------------------------------------------------------------------- # Icon indexes for the show/hide toggle for recipe categories #--------------------------------------------------------------------------- @showIcon = 1807 @hideIcon = 1806 #--------------------------------------------------------------------------- # Change this to false if you do not wish for the game to remember # whether a category was shown or hidden the last time the player used the # crafting interface #--------------------------------------------------------------------------- @rememberCategoryStates = true #--------------------------------------------------------------------------- # If you do not want to remember category states, then a default state is # chosen when the crafting menu is launched. Change this to true if you wish # to launch the menu with categories expanded. #--------------------------------------------------------------------------- @defaultShowState = false #--------------------------------------------------------------------------- # Change this to false if you would like to disable sorting by category #--------------------------------------------------------------------------- @usingCategories = true initCategories if @usingCategories if @usingCategories categoryRefresh else refresh end end def initCategories @categoryNames = $game_crafting.categoryLabels @categoryText = $game_crafting.categoryText @categoryIndices = [] @showCategory = [] if @rememberCategoryStates @showCategory = $game_crafting.categoryStates else for x in 0..@categoryNames.length - 1 @showCategory.push(@defaultShowState) end end end def update super updateIngredients updateStatus updateDetails update_help if @refreshNeeded if @usingCategories categoryRefresh else refresh end end end def categoryRefresh self.contents.clear @data = [] @categoryIndices = [] index = 0 for x in 0..@categoryNames.length - 1 @categoryIndices.push(index) @data.push(nil) index += 1 if @showCategory[x] for recipe in $game_crafting.recipeList if recipe.isDiscovered? and recipe.category == x @data.push(recipe) index += 1 end end end end @item_max = @data.size create_contents for i in 0...@item_max if @categoryIndices.index(i) != nil draw_category(i) else draw_recipe(i) end end @refreshNeeded = false end def refresh self.contents.clear @data = [] for recipe in $game_crafting.recipeList @data.push(recipe) if recipe.isDiscovered? end @item_max = @data.size create_contents for i in 0...@item_max draw_recipe(i) end @refreshNeeded = false end def draw_category(index) rect = item_rect(index) self.contents.clear_rect(rect) categoryIndex = @categoryIndices.index(index) categoryName = @categoryNames[categoryIndex] icon = @showCategory[categoryIndex] ? @showIcon : @hideIcon if categoryName != nil rect.width -= 4 draw_icon(icon, rect.x, rect.y, true) self.contents.font.color = normal_color self.contents.draw_text(rect.x + 24, rect.y, 172, WLH, categoryName) end end def draw_recipe(index) rect = item_rect(index) self.contents.clear_rect(rect) recipe = @data[index] if recipe != nil enabled = recipe.isCraftable? rect.width -= 4 draw_recipe_name(recipe, rect.x + 24, rect.y, enabled) end end def draw_recipe_name(recipe, x, y, enabled = true) if recipe != nil draw_icon(recipe.icon_index, x, y, enabled) self.contents.font.color = normal_color self.contents.font.color.alpha = enabled ? 255 : 128 self.contents.draw_text(x + 24, y, 172, WLH, recipe.name) end end def recipe return @data[self.index] end def isCategory? return false if @categoryIndices.index(self.index) == nil return true end def toggleCategory if @showCategory[@categoryIndices.index(self.index)] @showCategory[@categoryIndices.index(self.index)] = false else @showCategory[@categoryIndices.index(self.index)] = true end end def ingredients_window=(ingredients_window) @ingredients_window = ingredients_window updateIngredients end def status_window=(status_window) @status_window = status_window updateStatus end def detail_window=(detail_window) @detail_window = detail_window updateDetails end def updateIngredients if recipe == nil @ingredients_window.set_tools(@categoryIndices.index(self.index)) else @ingredients_window.set_ingredients(recipe) end end def updateStatus @status_window.set_status(recipe) end def updateDetails @detail_window.set_details(recipe) end #----------------------------------------------------------------------------- # Updates the help window with the text of the description of the item being # made or with the reason why it cannot be made #----------------------------------------------------------------------------- def update_help recipe = @data[self.index] if @item_max < 1 @help_window.set_text("You have not discovered any recipes yet!") else if recipe == nil categoryText = @categoryText[@categoryIndices.index(self.index)] @help_window.set_text(categoryText) else if recipe.isCraftable? descriptionText = recipe.itemCreated.description @help_window.set_text(recipe == nil ? "" : descriptionText) else @help_window.set_text(recipe == nil ? "" : recipe.disabledReason) end end end end def dispose super $game_crafting.categoryStates = @showCategory if @rememberCategoryStates end end Window_Crafting_Ingredients: Spoiler class Window_Crafting_Ingredients < Window_Base def initialize(x, y, width, height) super(x, y, width, height) end def set_ingredients(recipe) if recipe != nil self.contents.clear self.contents.font.color = normal_color @recipe = recipe #draw the ingredients self.contents.draw_text(0, 0, 172, WLH, "Ingredients:") x = 0 y = 28 index = 0 while index < recipe.numOfIngredients draw_icon(recipe.ingredients[index].icon_index, x, y) amount = $game_party.item_number(recipe.ingredients[index]) availString = amount.to_s + " / " + recipe.ingAmounts[index].to_s self.contents.draw_text(x + 28, y, 46, WLH, availString) x += 92 if x > 200 x = 0 y += 28 end index += 1 end end end def set_tools(categoryIndex) self.contents.clear self.contents.font.color = normal_color x = 0 y = 0 self.contents.draw_text(0, 0, 200, WLH, "Required Tools:") y += 24 x += 24 for tool in $game_crafting.tools(categoryIndex) enabled = $game_party.has_item?($data_items[tool]) draw_item_name($data_items[tool], x, y, enabled) y += 24 end end end Window_Crafting_Status: Spoiler class Window_Crafting_Status < Window_Base def initialize(x, y, width, height) super(x, y, width, height) #--------------------------------------------------------------------------- # Change these if you need to use different atribute up/down icons #--------------------------------------------------------------------------- @atkIconUp = 1916 @atkIconDown = 1932 @atkIconSame = 1948 @defIconUp = 1917 @defIconDown = 1933 @defIconSame = 1949 @spiIconUp = 1918 @spiIconDown = 1934 @spiIconSame = 1950 @agiIconUp = 1919 @agiIconDown = 1935 @agiIconSame = 1951 end #----------------------------------------------------------------------------- # Determines what to display based on the recipe object. # recipe: a recipe object to be analyzed #----------------------------------------------------------------------------- def set_status(recipe) if recipe != @recipe self.contents.clear self.contents.font.color = normal_color x = 0 y = 0 #if the recipe makes an item, no stat mods and no one can equip (all grey) if recipe == nil or recipe.makesItem? enabled = false; for z in 1..$game_actors.length if $game_actors[z-1] != nil and $game_actors[z-1].isDiscovered? draw_actor_graphic($game_actors[z-1], x, y + 12, enabled) x += 136 if x > 224 x = 0 y += 48 end end end #if the recipe makes a weapon, draw depending on equipability elsif recipe.makesWeapon? for z in 1..$game_actors.length if $game_actors[z-1] != nil and $game_actors[z-1].isDiscovered? #check to see if this actor can equip this item if $game_actors[z-1].equippable?(recipe.itemCreated) draw_actor_graphic($game_actors[z-1], x, y + 12, true) drawAttributeIcons($game_actors[z-1], recipe.itemCreated, x + 4, y) else draw_actor_graphic($game_actors[z-1], x, y + 12, false) end x += 136 if x > 224 x = 0 y += 48 end end end #if the recipe makes armor, draw depending on equipability elsif recipe.makesArmor? for z in 1..$game_actors.length if $game_actors[z-1] != nil and $game_actors[z-1].isDiscovered? #check to see if this actor can equip this item if $game_actors[z-1].equippable?(recipe.itemCreated) draw_actor_graphic($game_actors[z-1], x, y + 12, true) drawAttributeIcons($game_actors[z-1], recipe.itemCreated, x + 4, y) else draw_actor_graphic($game_actors[z-1], x, y + 12, false) end x += 136 if x > 224 x = 0 y += 48 end end end end @recipe = recipe end end #----------------------------------------------------------------------------- # This is basically identical to the method in Window_Base, with the added # ability to draw different opacities for enabled or disabled. # actor: actor being drawn # x: initial x-coordinate # y: initial y-coordinate # enabled: determines the opacity to draw #----------------------------------------------------------------------------- def draw_actor_graphic(actor, x, y, enabled = true) bitmap = Cache.character(actor.character_name) sign = actor.character_name[/^[\!\$]./] if sign != nil and sign.include?('$') cw = bitmap.width / 3 ch = bitmap.height / 4 else cw = bitmap.width / 12 ch = bitmap.height / 8 end n = actor.character_index src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch) self.contents.blt(x, y, bitmap, src_rect, enabled ? 255 : 128) bitmap.dispose end #------------------------------------------------------------------------- # Draws the atk/def/spi/agi up/down icons # actor: Actor to compare values against # item: item that is being compared # x: starting x position # y: starting y position #------------------------------------------------------------------------- def drawAttributeIcons(actor, item, x, y) return if item.is_a?(RPG::Item) chooseAttributeIcon(actor, item, "atk", x, y) chooseAttributeIcon(actor, item, "def", x, y) chooseAttributeIcon(actor, item, "spi", x, y) chooseAttributeIcon(actor, item, "agi", x, y) end #----------------------------------------------------------------------------- # Determines which icon will need to be drawn for the specific stat # actor: Actor to compare values against # item: item that is being compared # attrib: Attribute that is being compared # x: starting x position # y: starting y position #----------------------------------------------------------------------------- def chooseAttributeIcon(actor, item, attrib, x, y) #Figure out which item will be replaced if item.is_a?(RPG::Weapon) primaryWeapon = actor.weapons[0] secondaryWeapon = actor.weapons[1] if actor.two_swords_style #figure out which weapon we'll compare against pwAtk = primaryWeapon == nil ? 0 : primaryWeapon.atk swAtk = secondaryWeapon == nil ? 0 : secondaryWeapon.atk equipedItem = swAtk > pwAtk ? secondaryWeapon : primaryWeapon else equipedItem = actor.equips[item.kind + 1] end #switch to determine the applicable attribute case attrib when "atk" currentAtr = actor.base_atk itemAtr = item.atk equipAtr = equipedItem == nil ? 0 : equipedItem.atk atrIconUp = @atkIconUp atrIconDown = @atkIconDown atrIconSame = @atkIconSame x += 28 when "def" currentAtr = actor.base_def itemAtr = item.def equipAtr = equipedItem == nil ? 0 : equipedItem.def atrIconUp = @defIconUp atrIconDown = @defIconDown atrIconSame = @defIconSame x += 76 when "spi" currentAtr = actor.base_spi itemAtr = item.spi equipAtr = equipedItem == nil ? 0 : equipedItem.spi atrIconUp = @spiIconUp atrIconDown = @spiIconDown atrIconSame = @spiIconSame x += 28 y += 24 when "agi" currentAtr = actor.base_agi itemAtr = item.agi equipAtr = equipedItem == nil ? 0 : equipedItem.agi atrIconUp = @agiIconUp atrIconDown = @agiIconDown atrIconSame = @agiIconSame x += 76 y += 24 end #now find the right icon subAttribute = currentAtr - equipAtr + itemAtr newAtr = subAttribute if subAttribute > currentAtr atrIcon = atrIconUp elsif subAttribute < currentAtr atrIcon = atrIconDown else atrIcon = atrIconSame end #everything is calculated, pass to print function drawIconAndText(atrIcon, x, y, newAtr) end #----------------------------------------------------------------------------- # Draws an icon and the associated stat # iconNumber: The ID number of the icon being drawn # x: The starting x position # y: The starting y position # newAtr: The attribute value after the sending item is equiped #----------------------------------------------------------------------------- def drawIconAndText(iconNumber, x, y, newAtr) if iconNumber != nil draw_icon(iconNumber, x, y, true) end case iconNumber when @atkIconUp..@agiIconUp self.contents.font.color = text_color(3) #3 is green! when @atkIconDown..@agiIconDown self.contents.font.color = text_color(10) #10 is red! else self.contents.font.color = text_color(0) #0 is normal white! end self.contents.draw_text(x + 24, y, 24, WLH, newAtr.to_s) end end Window_Crafting_Details: Spoiler class Window_Crafting_Details < Window_Base def initialize(x, y, width, height) super(x, y, width, height) #--------------------------------------------------------------------------- # These variables control whether or not to display different sections of # The detail window. In this way, you can limit the information the player # has about the mechanisms of the crafting system. #--------------------------------------------------------------------------- @drawResults = true @drawTools = true @drawIngredients = true @drawStatInfo = true end def set_details(recipe) if recipe != nil and recipe != @recipe @recipe = recipe self.contents.clear self.contents.font.color = normal_color x = 0 y = 0 #draw the items made if @drawResults self.contents.draw_text(0, 0, 172, WLH, "Makes:") draw_item_name(recipe.itemCreated, 24, 24) self.contents.draw_text(0, 24, 248, WLH, "x " + recipe.createdAmount.to_s, 2) self.contents.draw_text(0, 48, 172, WLH, "Critical:") draw_item_name(recipe.criticalItem, 24, 72) self.contents.draw_text(0, 72, 248, WLH, "x " + recipe.critAmount.to_s, 2) end #draw tools if @drawTools self.contents.draw_text(272, 0, 200, WLH, "Required Tools:") y = 24 x = 296 for tool in $game_crafting.tools(recipe.category) enabled = $game_party.has_item?($data_items[tool]) draw_item_name($data_items[tool], x, y, enabled) y += 24 end end #draw the ingredients if @drawIngredients self.contents.font.color = normal_color self.contents.draw_text(0, 120, 172, WLH, "Ingredients:") x = 24 y = 144 index = 0 while index < recipe.numOfIngredients ingredient = recipe.ingredients[index] ingAmount = recipe.ingAmounts[index] enabled = $game_party.item_number(ingredient) < ingAmount ? false : true draw_item_name(ingredient, x, y, enabled) self.contents.draw_text(x - 24, y, 248, WLH, "x " + ingAmount.to_s, 2) x += 248 if x > 400 y += 24 x = 24 end index += 1 end end #draw Stat information if @drawStatInfo y += 36 self.contents.font.color = normal_color stat = recipe.bonusStat statName = $game_crafting.statName(stat) statAmount = $game_crafting.difficulties(stat)[recipe.difficulty] statString = "Requires " + statAmount.to_s + " " + statName + " to craft." self.contents.draw_text(0, y, 544, WLH, statString) y += 24 critChance = recipe.calcCriticalChance.to_s critString = "Chance to critical: " + critChance + "%" self.contents.draw_text(0, y, 544, WLH, critString) end end end end So di chiedere tanto, ma i creatori degli script non mi hanno risposto..Grazie mille in anticipo a tutti quelli che mi daranno una mano(che verranno creditati)! Grazie!!
