Scripts; Updated; Scripts Demo Added - Printable Version +- Save-Point (https://www.save-point.org) +-- Forum: Material Development (https://www.save-point.org/forum-8.html) +--- Forum: Scripts Database (https://www.save-point.org/forum-39.html) +---- Forum: RPGMaker XP (RGSS) Engine (https://www.save-point.org/forum-116.html) +---- Thread: Scripts; Updated; Scripts Demo Added (/thread-588.html) |
Scripts; Updated; Scripts Demo Added - Geowil - 02-17-2010 Well, seeing as the RMXP community has been destroyed, again, for the third time, I am going to put up some scripts, between 20 and 25 to be exact, to facilitate some recreation. Near Fantastica's Anti Lag Script: Instructions: Nearââ¬â¢s Anti-lag script. If you have any other custom scripts, put this one above all of them in a class named Anti-Lag. If your using the shadow and sun effects scripts by Rataime, you will need this. Anti Lag Script
#====================================== # ? Anti Event Lag Script #====================================== # ?By: Near Fantastica # Date: 12.06.05 # Version: 3 #====================================== #====================================== # ? Game_Map #====================================== class Game_Map #-------------------------------------------------------------------------- def in_range?(object) screne_x = $game_map.display_x screne_x -= 256 screne_y = $game_map.display_y screne_y -= 256 screne_width = $game_map.display_x screne_width += 2816 screne_height = $game_map.display_y screne_height += 2176 return false if object.real_x <= screne_x-32 return false if object.real_x >= screne_width+32 return false if object.real_y <= screne_y-32 return false if object.real_y >= screne_height+32 return true end #-------------------------------------------------------------------------- def update if $game_map.need_refresh refresh end if @scroll_rest > 0 distance = 2 ** @scroll_speed case @scroll_direction when 2 scroll_down(distance) when 4 scroll_left(distance) when 6 scroll_right(distance) when 8 scroll_up(distance) end @scroll_rest -= distance end for event in @events.values if in_range?(event) or event.trigger == 3 or event.trigger == 4 event.update end end for common_event in @common_events.values common_event.update end @fog_ox -= @fog_sx / 8.0 @fog_oy -= @fog_sy / 8.0 if @fog_tone_duration >= 1 d = @fog_tone_duration target = @fog_tone_target @fog_tone.red = (@fog_tone.red * (d - 1) + target.red) / d @fog_tone.green = (@fog_tone.green * (d - 1) + target.green) / d @fog_tone.blue = (@fog_tone.blue * (d - 1) + target.blue) / d @fog_tone.gray = (@fog_tone.gray * (d - 1) + target.gray) / d @fog_tone_duration -= 1 end if @fog_opacity_duration >= 1 d = @fog_opacity_duration @fog_opacity = (@fog_opacity * (d - 1) + @fog_opacity_target) / d @fog_opacity_duration -= 1 end end end #====================================== # ? Spriteset_Map #====================================== class Spriteset_Map #-------------------------------------------------------------------------- def in_range?(object) screne_x = $game_map.display_x screne_x -= 256 screne_y = $game_map.display_y screne_y -= 256 screne_width = $game_map.display_x screne_width += 2816 screne_height = $game_map.display_y screne_height += 2176 return false if object.real_x <= screne_x return false if object.real_x >= screne_width return false if object.real_y <= screne_y return false if object.real_y >= screne_height return true end #-------------------------------------------------------------------------- def update if @panorama_name != $game_map.panorama_name or @panorama_hue != $game_map.panorama_hue @panorama_name = $game_map.panorama_name @panorama_hue = $game_map.panorama_hue if @panorama.bitmap != nil @panorama.bitmap.dispose @panorama.bitmap = nil end if @panorama_name != "" @panorama.bitmap = RPG::Cache.panorama(@panorama_name, @panorama_hue) end Graphics.frame_reset end if @fog_name != $game_map.fog_name or @fog_hue != $game_map.fog_hue @fog_name = $game_map.fog_name @fog_hue = $game_map.fog_hue if @fog.bitmap != nil @fog.bitmap.dispose @fog.bitmap = nil end if @fog_name != "" @fog.bitmap = RPG::Cache.fog(@fog_name, @fog_hue) end Graphics.frame_reset end @tilemap.ox = $game_map.display_x / 4 @tilemap.oy = $game_map.display_y / 4 @tilemap.update @panorama.ox = $game_map.display_x / 8 @panorama.oy = $game_map.display_y / 8 @fog.zoom_x = $game_map.fog_zoom / 100.0 @fog.zoom_y = $game_map.fog_zoom / 100.0 @fog.opacity = $game_map.fog_opacity @fog.blend_type = $game_map.fog_blend_type @fog.ox = $game_map.display_x / 4 + $game_map.fog_ox @fog.oy = $game_map.display_y / 4 + $game_map.fog_oy @fog.tone = $game_map.fog_tone i=0 for sprite in @character_sprites if sprite.character.is_a?(Game_Event) if in_range?(sprite.character) or sprite.character.trigger == 3 or sprite.character.trigger == 4 sprite.update i+=1 end else sprite.update i+=1 end end #p i @weather.type = $game_screen.weather_type @weather.max = $game_screen.weather_max @weather.ox = $game_map.display_x / 4 @weather.oy = $game_map.display_y / 4 @weather.update for sprite in @picture_sprites sprite.update end @timer_sprite.update @viewport1.tone = $game_screen.tone @viewport1.ox = $game_screen.shake @viewport3.color = $game_screen.flash_color @viewport1.update @viewport3.update end end Ccoa's Faces in Messages: Instructions: Installation: This script has several things in different places, so bear with me. First of all there is no need to make a new class for this. Now, go to the 'Window_Message' class and press ctrl + a then come back to here, select all of the code below then press ctrl + c. Go back to you Window_Message and make sure all of it is selected and press ctrl + v. This will replace your 'Window_Message' with the one below (the spoilered script). Then go to you 'Main' class and add this just after the begin command: Quote: #Are we showing a face this time? and the adding of the script is done. Now, to be able to use this is tricky. First, find a picture, i'd say 128x128 pixils at the most, and import it into the 'Pictures' folder in the Resource Manager. Remember the name of that picture! Usage: Now in an event, to show the picture, put this in a call script function just before the message: Quote: replace "name of picture" with what ever the picture that you imported's name was and press ok. Now. In order to stop showing the picture, you mus add a new command after the message(s) or else you will get the same picture on a different characters message. So, once the current character is done speaking, put this in a call script after the message: Quote: $face_showing = nil That will set the pic showing to none. remember, you must do this for every picture you show in a message. With this script, the text goes over the picture so in the opacity setting while importing, make sure to put it at 100 or less, so that the text will show up. Faces in Messages
#================================== # Window_Message #------------------------------- # The message window. #================================== class Window_Message < Window_Selectable attr_accessor :autoclosetime attr_accessor :op #------------------------------- # Object Initialization #------------------------------- def initialize super(80, 304, 480, 160) self.contents = Bitmap.new(width - 32, height - 32) self.visible = false self.z = 9998 @fade_in = false @fade_out = false @contents_showing = false @cursor_width = 0 @autoclosetime = -1 @op = 255 @refreshflag = false self.active = false self.index = -1 # ***ccoa*** # face for the message box @face = Sprite.new end #------------------------------- # Garbage Collection #------------------------------- def dispose terminate_message $game_temp.message_window_showing = false if @input_number_window != nil @input_number_window.dispose end super end #------------------------------- # Message Termination Process #------------------------------- def terminate_message self.active = false self.pause = false self.index = -1 self.contents.clear @contents_showing = false if $game_temp.message_proc != nil $game_temp.message_proc.call end $game_temp.message_text = nil $game_temp.message_proc = nil $game_temp.choice_start = 99 $game_temp.choice_max = 0 $game_temp.choice_cancel_type = 0 $game_temp.choice_proc = nil $game_temp.num_input_start = 99 $game_temp.num_input_variable_id = 0 $game_temp.num_input_digits_max = 0 if @gold_window != nil @gold_window.dispose @gold_window = nil end # ***ccoa*** #if there was a face showing, make it invisible if $face_showing != nil @face.visible = false end end #------------------------------- # Refresh #------------------------------- def refresh self.contents.clear self.contents.font.color = normal_color self.contents.font.name = "OldEnglish" self.contents.font.size = 19 x = y = 0 @cursor_width = 0 @autoclosetime = -1 @refreshflag = true lineheight = 32 active = "" a = "" centerflag = false rightflag = false bannerflag = false if $game_temp.choice_start == 0 x = 8 end if $game_temp.message_text != nil text = $game_temp.message_text begin last_text = text.clone text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] } end until text == last_text text.gsub!(/\\[Nn]\[([0-9]+)\]/) do $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : "" end text.gsub!(/\\\\/) { "\000" } text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" } text.gsub!(/\\[Gg]/) { "\002" } text.gsub!(/\\[Ii]\[([0-9]+)\]/) { "\003[#{$1}]" } text.gsub!(/\\[Ff]\[([0-9]+)\]/) { "\004[#{$1}]" } text.gsub!(/\\[Aa]\[([0-9]+)\]/) { "\005[#{$1}]" } text.gsub!(/\\[Xx]/) { "\006" } text.gsub!(/\\[Rr]/) { "\007" } text.gsub!(/\\[Dd]/) { "\011" } text.gsub!(/\\[Ss]\[([0-9]+)\]/) { "\023[#{$1}]" } text.gsub!(/\\[Bb]/) { "\017" } text.gsub!(/\\[Ww]\[([0-9]+)\]/) { "\014[#{$1}]" } text.gsub!(/\\[Mm]\[([0-9]+)\]/) { "\015[#{$1}]" } text.gsub!(/\\[Oo]\[([0-9]+)\]/) { "\016[#{$1}]" } text.gsub!(/\\[Jj]\[([0-9]+)\]/) { "\013[#{$1}]" } text.gsub!(/\\[Hh]\[([0-9]+)\]/) { "\021[#{$1}]" } text.gsub!(/\\[Kk]\[([0-9]+)\]/) { "\022[#{$1}]" } while ((c = text.slice!(/./m)) != nil) if c == "\000" c = "\\" end if c == "\001" text.sub!(/\[([0-9]+)\]/, "") color = $1.to_i if color >= 0 and color <= 7 self.contents.font.color = text_color(color) end next end if c == "\002" if @gold_window == nil @gold_window = Window_Gold.new @gold_window.x = 560 - @gold_window.width if $game_temp.in_battle @gold_window.y = 192 else @gold_window.y = self.y >= 128 ? 32 : 384 end @gold_window.opacity = self.opacity @gold_window.back_opacity = self.back_opacity end next end if c == "\003" text.sub!(/\[([0-9]+)\]/, "") item_sub = $1.to_i c = $data_items[item_sub].name l = self.contents.text_size©.width draw_item_name($data_items[item_sub], x, y * 32 + 1) x = x + l + 24 next end if c == "\004" text.sub!(/\[([0-9]+)\]/, "") fontize = $1.to_i case fontize when 1 self.contents.font.name = "OldEnglish" when 2 self.contents.font.name = "OldEnglish" when 3 self.contents.font.name = "OldEnglish" when 4 self.contents.font.name = "OldEnglish" end next end if c == "\005" text.sub!(/\[([0-9]+)\]/, "") @autoclosetime = $1.to_i next end if c == "\006" centerflag = true next end if c == "\007" rightflag = true next end if c == "\011" self.contents.font.name = "OldEnglish" self.contents.font.size = 19 self.contents.font.color = normal_color lineheight = 32 next end if c == "\014" text.sub!(/\[([0-9]+)\]/, "") w_sub = $1.to_i c = $data_weapons[w_sub].name l = self.contents.text_size©.width bitmap = RPG::Cache.icon($data_weapons[w_sub].icon_name) self.contents.blt(x+4, y * 32+ 4, bitmap, Rect.new(0, 0, 24, 24)) x += 28 self.contents.draw_text(x+4, 32 * y, l+32, lineheight, c) x = x + l next end if c == "\015" text.sub!(/\[([0-9]+)\]/, "") a_sub = $1.to_i c = $data_armors[a_sub].name l = self.contents.text_size©.width bitmap = RPG::Cache.icon($data_armors[a_sub].icon_name) self.contents.blt(x+4, y * 32+ 4, bitmap, Rect.new(0, 0, 24, 24)) x += 28 self.contents.draw_text(x+4, 32 * y, l+32, lineheight, c) x = x + l next end if c == "\016" text.sub!(/\[([0-9]+)\]/, "") @op = $1.to_i next end if c == "\017" bannerflag = true next end if c == "\018" text.sub!(/\[([0-9]+)\]/, "") jump = $1.to_i x += jump next end if c == "\021" text.sub!(/\[([0-9]+)\]/, "") lineheight = $1.to_i next end if c == "\022" text.sub!(/\[([0-9]+)\]/, "") skill_sub = $1.to_i c = $data_skills[skill_sub].name l = self.contents.text_size©.width bitmap = RPG::Cache.icon($data_skills[skill_sub].icon_name) self.contents.blt(x+4, y * 32+ 4, bitmap, Rect.new(0, 0, 24, 24)) x += 28 self.contents.draw_text(x+4, 32 * y, l+32, lineheight, c) x = x + l next end if c == "\023" text.sub!(/\[([0-9]+)\]/, "") bigness = $1.to_i self.contents.font.size = bigness next end if c == "\n" if centerflag == true x = 448 - x x = x / 2 self.contents.draw_text(x, 32 * y, 448-x, lineheight, a) end if rightflag == true x = 448 - x self.contents.draw_text(x, 32 * y, 448-x, lineheight, a) end if bannerflag == true x = 448 - x x = x / 2 self.contents.draw_text(x, 44, 448-x, lineheight, a) end a = "" centerflag = false rightflag = false bannerflag = false if y >= $game_temp.choice_start @cursor_width = [@cursor_width, x].max end y += 1 x = 0 if y >= $game_temp.choice_start x = 8 end next end # ***ccoa*** #display face? if $face_showing != nil #draw the face, then add the text to one side of it @face.bitmap = RPG::Cache.picture($face_showing) @face.x = self.x +10 @face.y = self.y +10 @face.z = 9999 @face.opacity = 100 @face.visible = true if centerflag == false && rightflag == false && bannerflag == false self.contents.draw_text(4 + x, 32 * y, 40, lineheight, c) x += self.contents.text_size©.width else a += c x += self.contents.text_size©.width end else # just put in the text if centerflag == false && rightflag == false && bannerflag == false self.contents.draw_text(4 + x, 32 * y, 40, lineheight, c) x += self.contents.text_size©.width else a += c x += self.contents.text_size©.width end end end end if $game_temp.choice_max > 0 @item_max = $game_temp.choice_max self.active = true self.index = 0 end if $game_temp.num_input_variable_id > 0 digits_max = $game_temp.num_input_digits_max number = $game_variables[$game_temp.num_input_variable_ id] @input_number_window = Window_InputNumber.new(digits_max) @input_number_window.number = number @input_number_window.x = self.x + 8 @input_number_window.y = self.y + $game_temp.num_input_start * 32 end end #------------------------------- # Reset the window in response to changes in the position or # transparency #------------------------------- def reset_window if $game_temp.in_battle self.y = 16 else case $game_system.message_position when 0 self.y = 16 when 1 self.y = 160 when 2 self.y = 304 end end if $game_system.message_frame == 0 self.opacity = 255 else self.opacity = 0 end self.back_opacity = 160 end #------------------------------- # Frame Update #------------------------------- def update super if @refreshflag && @fade_in == false self.contents_opacity = @op end if @autoclosetime == 0 @autoclosetime = -1 terminate_message end if @autoclosetime >= 1 @autoclosetime -= 1 end if @fade_in self.contents_opacity += 24 if @input_number_window != nil @input_number_window.contents_opacity += 24 end if self.contents_opacity >= @op @fade_in = false end return end if @input_number_window != nil @input_number_window.update # ?? if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se ) $game_variables[$game_temp.num_input_variable_id] = @input_number_window.number $game_map.need_refresh = true @input_number_window.dispose @input_number_window = nil terminate_message end return end if @contents_showing if $game_temp.choice_max == 0 self.pause = true end if Input.trigger?(Input::B) if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0 $game_system.se_play($data_system.cancel_se) $game_temp.choice_proc.call($game_temp.choice_can cel_type - 1) terminate_message end end if Input.trigger?(Input::C) if $game_temp.choice_max > 0 $game_system.se_play($data_system.decision_se ) $game_temp.choice_proc.call(self.index) end @op = 255 terminate_message end return end if @fade_out == false and $game_temp.message_text != nil @contents_showing = true $game_temp.message_window_showing = true reset_window refresh Graphics.frame_reset self.visible = true self.contents_opacity = 0 if @input_number_window != nil @input_number_window.contents_opacity = 0 end @fade_in = true return end if self.visible @fade_out = true self.opacity -= 48 if self.opacity == 0 self.visible = false @fade_out = false $game_temp.message_window_showing = false end return end end #------------------------------- # Updates the cursor rectangle. #------------------------------- def update_cursor_rect if @index >= 0 n = $game_temp.choice_start + @index # ***ccoa*** # make sure the cursor appears in the correct spot for choice messages if $face_showing != nil self.cursor_rect.set(7, n * 32, @cursor_width, 32) else self.cursor_rect.set(8, n * 32, @cursor_width, 32) end else self.cursor_rect.empty end end end Ccoa's Weather Script: Instructions: Installation: Ok, make a new class above 'Main' and add this into it. instructions at the bottom. Usage: Now as to how to use this, its actually quite simple. In an empty event set to Parallel Prossess in the trigger. Put this in a call script: Quote: Now, after weather in that call script we must define the type, power, and color of weather we want. so we get this $game_screen.weather [type (selects the type of weather, so use a number 1-15 according to the list at the begging of the script), Power (sets the power of the weather 0-40, 0 being none, 40 being strongest), Hue (0-255, changes the color). so, in the event, lets say we want heavy rain in the map. the call script would look like so: Quote: Thats all there is too it. Weather Script
# ccoa's weather script # with ideas by ScriptKitty and Dr DJ # # Weather Types: # 1 - rain # 2 - storm # 3 - snow # 4 - hail # 5 - rain with thunder and lightning # 6 - falling leaves (autumn) # 7 - blowing leaves (autumn) # 8 - swirling leaves (autumn) # 9 - falling leaves (green) # 10 - cherry blossom (sakura) petals # 11 - rose petals # 12 - feathers # 13 - blood rain # 14 - sparkles # 15 - user defined # # Weather Power: # An integer from 0-40. 0 = no weather, 40 = 400 sprites # # Usage: # Create a call script with the following: # $game_screen.weather(type, power, hue) # # Usage of user-defined weather: # Look at the following globals: $WEATHER_UPDATE = false # the $WEATHER_IMAGES array has changed, please update $WEATHER_IMAGES = [] # the array of picture names to use $WEATHER_X = 0 # the number of pixels the image should move horizontally (positive = right, negative = left) $WEATHER_Y = 0 # the number of pizels the image should move vertically (positive = down, negative = up) $WEATHER_FADE = 0 # how much the image should fade each update (0 = no fade, 255 = fade instantly) $WEATHER_ANIMATED = false # whether or not the image should cycle through all the images module RPG class Weather def initialize(viewport = nil) @type = 0 @max = 0 @ox = 0 @oy = 0 @count = 0 @current_pose = [] @info = [] @countarray = [] make_bitmaps # **** ccoa **** for i in 1..500 sprite = Sprite.new(viewport) sprite.z = 1000 sprite.visible = false sprite.opacity = 0 @sprites.push(sprite) @current_pose.push(0) @info.push(rand(50)) @countarray.push(rand(15)) end end def dispose for sprite in @sprites sprite.dispose end @rain_bitmap.dispose @storm_bitmap.dispose @snow_bitmap.dispose @hail_bitmap.dispose @petal_bitmap.dispose @blood_rain_bitmap.dispose for image in @autumn_leaf_bitmaps image.dispose end for image in @green_leaf_bitmaps image.dispose end for image in @rose_bitmaps image.dispose end for image in @feather_bitmaps image.dispose end for image in @sparkle_bitmaps image.dispose end for image in @user_bitmaps image.dispose end $WEATHER_UPDATE = true end def type=(type) return if @type == type @type = type case @type when 1 # rain bitmap = @rain_bitmap when 2 # storm bitmap = @storm_bitmap when 3 # snow bitmap = @snow_bitmap when 4 # hail bitmap = @hail_bitmap when 5 # rain w/ thunder and lightning bitmap = @rain_bitmap @thunder = true when 6 # falling autumn leaves bitmap = @autumn_leaf_bitmaps[0] when 7 # blowing autumn leaves bitmap = @autumn_leaf_bitmaps[0] when 8 # swirling autumn leaves bitmap = @autumn_leaf_bitmaps[0] when 9 # falling green leaves bitmap = @green_leaf_bitmaps[0] when 10 # sakura petals bitmap = @petal_bitmap when 11 # rose petals bitmap = @rose_bitmaps[0] when 12 # feathers bitmap = @feather_bitmaps[0] when 13 # blood rain bitmap = @blood_rain_bitmap when 14 # sparkles bitmap = @sparkle_bitmaps[0] when 15 # user-defined bitmap = @user_bitmaps[rand(@user_bitmaps.size)] else bitmap = nil end if @type != 5 @thunder = false end # **** ccoa **** for i in 1..500 sprite = @sprites[i] if sprite != nil sprite.visible = (i <= @max) sprite.bitmap = bitmap end end end def ox=(ox) return if @ox == ox; @ox = ox for sprite in @sprites sprite.ox = @ox end end def oy=(oy) return if @oy == oy; @oy = oy for sprite in @sprites sprite.oy = @oy end end def max=(max) return if @max == max; # **** ccoa **** @max = [[max, 0].max, 500].min for i in 1..500 sprite = @sprites[i] if sprite != nil sprite.visible = (i <= @max) end end end def update return if @type == 0 for i in 1..@max sprite = @sprites[i] if sprite == nil break end if @type == 1 or @type == 5 or @type == 13 # rain sprite.x -= 2 sprite.y += 16 sprite.opacity -= 8 if @thunder and (rand(8000 - @max) == 0) $game_screen.start_flash(Color.new(255, 255, 255, 255), 5) Audio.se_play("Audio/SE/061-Thunderclap01") end end if @type == 2 # storm sprite.x -= 8 sprite.y += 16 sprite.opacity -= 12 end if @type == 3 # snow sprite.x -= 2 sprite.y += 8 sprite.opacity -= 8 end if @type == 4 # hail sprite.x -= 1 sprite.y += 18 sprite.opacity -= 15 end if @type == 6 # falling autumn leaves @count = rand(20) if @count == 0 sprite.bitmap = @autumn_leaf_bitmaps[@current_pose[i]] @current_pose[i] = (@current_pose[i] + 1) % @autumn_leaf_bitmaps.size end sprite.x -= 1 sprite.y += 1 end if @type == 7 # blowing autumn leaves @count = rand(20) if @count == 0 sprite.bitmap = @autumn_leaf_bitmaps[@current_pose[i]] @current_pose[i] = (@current_pose[i] + 1) % @autumn_leaf_bitmaps.size end sprite.x -= 10 sprite.y += (rand(4) - 2) end if @type == 8 # swirling autumn leaves @count = rand(20) if @count == 0 sprite.bitmap = @autumn_leaf_bitmaps[@current_pose[i]] @current_pose[i] = (@current_pose[i] + 1) % @autumn_leaf_bitmaps.size end if @info[i] != 0 if @info[i] >= 1 and @info[i] <= 10 sprite.x -= 3 sprite.y -= 1 elsif @info[i] >= 11 and @info[i] <= 16 sprite.x -= 1 sprite.y -= 2 elsif @info[i] >= 17 and @info[i] <= 20 sprite.y -= 3 elsif @info[i] >= 21 and @info[i] <= 30 sprite.y -= 2 sprite.x += 1 elsif @info[i] >= 31 and @info[i] <= 36 sprite.y -= 1 sprite.x += 3 elsif @info[i] >= 37 and @info[i] <= 40 sprite.x += 5 elsif @info[i] >= 41 and @info[i] <= 46 sprite.y += 1 sprite.x += 3 elsif @info[i] >= 47 and @info[i] <= 58 sprite.y += 2 sprite.x += 1 elsif @info[i] >= 59 and @info[i] <= 64 sprite.y += 3 elsif @info[i] >= 65 and @info[i] <= 70 sprite.x -= 1 sprite.y += 2 elsif @info[i] >= 71 and @info[i] <= 81 sprite.x -= 3 sprite.y += 1 elsif @info[i] >= 82 and @info[i] <= 87 sprite.x -= 5 end @info[i] = (@info[i] + 1) % 88 else if rand(200) == 0 @info[i] = 1 end sprite.x -= 5 sprite.y += 1 end end if @type == 9 # falling green leaves if @countarray[i] == 0 @current_pose[i] = (@current_pose[i] + 1) % @green_leaf_bitmaps.size sprite.bitmap = @green_leaf_bitmaps[@current_pose[i]] @countarray[i] = rand(15) end @countarray[i] = (@countarray[i] + 1) % 15 sprite.y += 1 end if @type == 10 # sakura petals if @info[i] < 25 sprite.x -= 1 else sprite.x += 1 end @info[i] = (@info[i] + 1) % 50 sprite.y += 1 end if @type == 11 # rose petals @count = rand(20) if @count == 0 sprite.bitmap = @rose_bitmaps[@current_pose[i]] @current_pose[i] = (@current_pose[i] + 1) % @rose_bitmaps.size end if @info[i] % 2 == 0 if @info[i] < 10 sprite.x -= 1 elsif sprite.x += 1 end end sprite.y += 1 end if @type == 12 # feathers if @countarray[i] == 0 @current_pose[i] = (@current_pose[i] + 1) % @feather_bitmaps.size sprite.bitmap = @feather_bitmaps[@current_pose[i]] end @countarray[i] = (@countarray[i] + 1) % 15 if rand(100) == 0 sprite.x -= 1 end if rand(100) == 0 sprite.y -= 1 end if @info[i] < 50 if rand(2) == 0 sprite.x -= 1 else sprite.y -= 1 end else if rand(2) == 0 sprite.x += 1 else sprite.y += 1 end end @info[i] = (@info[i] + 1) % 100 end if @type == 14 # sparkles if @countarray[i] == 0 @current_pose[i] = (@current_pose[i] + 1) % @sparkle_bitmaps.size sprite.bitmap = @sparkle_bitmaps[@current_pose[i]] end @countarray[i] = (@countarray[i] + 1) % 15 sprite.y += 1 sprite.opacity -= 1 end if @type == 15 # user-defined if $WEATHER_UPDATE update_user_defined $WEATHER_UPDATE = false end if $WEATHER_ANIMATED and @countarray[i] == 0 @current_pose[i] = (@current_pose[i] + 1) % @user_bitmaps.size sprite.bitmap = @user_bitmaps[@current_pose[i]] end sprite.x += $WEATHER_X sprite.y += $WEATHER_Y sprite.opacity -= $WEATHER_FADE end x = sprite.x - @ox y = sprite.y - @oy if sprite.opacity < 64 or x < -50 or x > 750 or y < -300 or y > 500 sprite.x = rand(800) - 50 + @ox sprite.y = rand(800) - 200 + @oy sprite.opacity = 255 end end end def make_bitmaps color1 = Color.new(255, 255, 255, 255) color2 = Color.new(255, 255, 255, 128) @rain_bitmap = Bitmap.new(7, 56) for i in 0..6 @rain_bitmap.fill_rect(6-i, i*8, 1, 8, color1) end @storm_bitmap = Bitmap.new(34, 64) for i in 0..31 @storm_bitmap.fill_rect(33-i, i*2, 1, 2, color2) @storm_bitmap.fill_rect(32-i, i*2, 1, 2, color1) @storm_bitmap.fill_rect(31-i, i*2, 1, 2, color2) end @snow_bitmap = Bitmap.new(6, 6) @snow_bitmap.fill_rect(0, 1, 6, 4, color2) @snow_bitmap.fill_rect(1, 0, 4, 6, color2) @snow_bitmap.fill_rect(1, 2, 4, 2, color1) @snow_bitmap.fill_rect(2, 1, 2, 4, color1) @sprites = [] blueGrey = Color.new(215, 227, 227, 150) grey = Color.new(214, 217, 217, 150) lightGrey = Color.new(233, 233, 233, 250) lightBlue = Color.new(222, 239, 243, 250) @hail_bitmap = Bitmap.new(4, 4) @hail_bitmap.fill_rect(1, 0, 2, 1, blueGrey) @hail_bitmap.fill_rect(0, 1, 1, 2, blueGrey) @hail_bitmap.fill_rect(3, 1, 1, 2, grey) @hail_bitmap.fill_rect(1, 3, 2, 1, grey) @hail_bitmap.fill_rect(1, 1, 2, 2, lightGrey) @hail_bitmap.set_pixel(1, 1, lightBlue) color3 = Color.new(255, 167, 192, 255) # light pink color4 = Color.new(213, 106, 136, 255) # dark pink @petal_bitmap = Bitmap.new(4, 4) #This creates a new bitmap that is 4 x 4 pixels @petal_bitmap.fill_rect(0, 3, 1, 1, color3) # this makes a 1x1 pixel "rectangle" at the 0, 3 pixel of the image (upper left corner is 0, 0) @petal_bitmap.fill_rect(1, 2, 1, 1, color3) @petal_bitmap.fill_rect(2, 1, 1, 1, color3) @petal_bitmap.fill_rect(3, 0, 1, 1, color3) @petal_bitmap.fill_rect(1, 3, 1, 1, color4) @petal_bitmap.fill_rect(2, 2, 1, 1, color4) @petal_bitmap.fill_rect(3, 1, 1, 1, color4) brightOrange = Color.new(248, 88, 0, 255) orangeBrown = Color.new(144, 80, 56, 255) burntRed = Color.new(152, 0, 0, 255) paleOrange = Color.new(232, 160, 128, 255) darkBrown = Color.new(72, 40, 0, 255) @autumn_leaf_bitmaps = [] @autumn_leaf_bitmaps.push(Bitmap.new(8, 8)) # draw the first of the leaf1 bitmaps @autumn_leaf_bitmaps[0].set_pixel(5, 1, orangeBrown) @autumn_leaf_bitmaps[0].set_pixel(6, 1, brightOrange) @autumn_leaf_bitmaps[0].set_pixel(7, 1, paleOrange) @autumn_leaf_bitmaps[0].set_pixel(3, 2, orangeBrown) @autumn_leaf_bitmaps[0].fill_rect(4, 2, 2, 1, brightOrange) @autumn_leaf_bitmaps[0].set_pixel(6, 2, paleOrange) @autumn_leaf_bitmaps[0].set_pixel(2, 3, orangeBrown) @autumn_leaf_bitmaps[0].set_pixel(3, 3, brightOrange) @autumn_leaf_bitmaps[0].fill_rect(4, 3, 2, 1, paleOrange) @autumn_leaf_bitmaps[0].set_pixel(1, 4, orangeBrown) @autumn_leaf_bitmaps[0].set_pixel(2, 4, brightOrange) @autumn_leaf_bitmaps[0].set_pixel(3, 4, paleOrange) @autumn_leaf_bitmaps[0].set_pixel(1, 5, brightOrange) @autumn_leaf_bitmaps[0].set_pixel(2, 5, paleOrange) @autumn_leaf_bitmaps[0].set_pixel(0, 6, orangeBrown) @autumn_leaf_bitmaps[0].set_pixel(1, 6, paleOrange) @autumn_leaf_bitmaps[0].set_pixel(0, 7, paleOrange) # draw the 2nd of the leaf1 bitmaps @autumn_leaf_bitmaps.push(Bitmap.new(8, 8)) @autumn_leaf_bitmaps[1].set_pixel(3, 0, brightOrange) @autumn_leaf_bitmaps[1].set_pixel(7, 0, brightOrange) @autumn_leaf_bitmaps[1].set_pixel(3, 1, orangeBrown) @autumn_leaf_bitmaps[1].set_pixel(4, 1, burntRed) @autumn_leaf_bitmaps[1].set_pixel(6, 1, brightOrange) @autumn_leaf_bitmaps[1].set_pixel(0, 2, paleOrange) @autumn_leaf_bitmaps[1].set_pixel(1, 2, brightOrange) @autumn_leaf_bitmaps[1].set_pixel(2, 2, orangeBrown) @autumn_leaf_bitmaps[1].set_pixel(3, 2, burntRed) @autumn_leaf_bitmaps[1].set_pixel(4, 2, orangeBrown) @autumn_leaf_bitmaps[1].set_pixel(5, 2, brightOrange) @autumn_leaf_bitmaps[1].fill_rect(1, 3, 3, 1, orangeBrown) @autumn_leaf_bitmaps[1].fill_rect(4, 3, 2, 1, brightOrange) @autumn_leaf_bitmaps[1].set_pixel(6, 3, orangeBrown) @autumn_leaf_bitmaps[1].set_pixel(2, 4, burntRed) @autumn_leaf_bitmaps[1].fill_rect(3, 4, 3, 1, brightOrange) @autumn_leaf_bitmaps[1].set_pixel(6, 4, burntRed) @autumn_leaf_bitmaps[1].set_pixel(7, 4, darkBrown) @autumn_leaf_bitmaps[1].set_pixel(1, 5, orangeBrown) @autumn_leaf_bitmaps[1].fill_rect(2, 5, 2, 1, brightOrange) @autumn_leaf_bitmaps[1].set_pixel(4, 5, orangeBrown) @autumn_leaf_bitmaps[1].set_pixel(5, 5, burntRed) @autumn_leaf_bitmaps[1].fill_rect(1, 6, 2, 1, brightOrange) @autumn_leaf_bitmaps[1].fill_rect(4, 6, 2, 1, burntRed) @autumn_leaf_bitmaps[1].set_pixel(0, 7, brightOrange) @autumn_leaf_bitmaps[1].set_pixel(5, 7, darkBrown) # draw the 3rd of the leaf1 bitmaps @autumn_leaf_bitmaps.push(Bitmap.new(8, 8)) @autumn_leaf_bitmaps[2].set_pixel(7, 1, paleOrange) @autumn_leaf_bitmaps[2].set_pixel(6, 2, paleOrange) @autumn_leaf_bitmaps[2].set_pixel(7, 2, orangeBrown) @autumn_leaf_bitmaps[2].set_pixel(5, 3, paleOrange) @autumn_leaf_bitmaps[2].set_pixel(6, 3, brightOrange) @autumn_leaf_bitmaps[2].set_pixel(4, 4, paleOrange) @autumn_leaf_bitmaps[2].set_pixel(5, 4, brightOrange) @autumn_leaf_bitmaps[2].set_pixel(6, 4, orangeBrown) @autumn_leaf_bitmaps[2].fill_rect(2, 5, 2, 1, paleOrange) @autumn_leaf_bitmaps[2].set_pixel(4, 5, brightOrange) @autumn_leaf_bitmaps[2].set_pixel(5, 5, orangeBrown) @autumn_leaf_bitmaps[2].set_pixel(1, 6, paleOrange) @autumn_leaf_bitmaps[2].fill_rect(2, 6, 2, 1, brightOrange) @autumn_leaf_bitmaps[2].set_pixel(4, 6, orangeBrown) @autumn_leaf_bitmaps[2].set_pixel(0, 7, paleOrange) @autumn_leaf_bitmaps[2].set_pixel(1, 7, brightOrange) @autumn_leaf_bitmaps[2].set_pixel(2, 7, orangeBrown) # draw the 4th of the leaf1 bitmaps @autumn_leaf_bitmaps.push(Bitmap.new(8, 8)) @autumn_leaf_bitmaps[3].set_pixel(3, 0, brightOrange) @autumn_leaf_bitmaps[3].set_pixel(7, 0, brightOrange) @autumn_leaf_bitmaps[3].set_pixel(3, 1, orangeBrown) @autumn_leaf_bitmaps[3].set_pixel(4, 1, burntRed) @autumn_leaf_bitmaps[3].set_pixel(6, 1, brightOrange) @autumn_leaf_bitmaps[3].set_pixel(0, 2, paleOrange) @autumn_leaf_bitmaps[3].set_pixel(1, 2, brightOrange) @autumn_leaf_bitmaps[3].set_pixel(2, 2, orangeBrown) @autumn_leaf_bitmaps[3].set_pixel(3, 2, burntRed) @autumn_leaf_bitmaps[3].set_pixel(4, 2, orangeBrown) @autumn_leaf_bitmaps[3].set_pixel(5, 2, brightOrange) @autumn_leaf_bitmaps[3].fill_rect(1, 3, 3, 1, orangeBrown) @autumn_leaf_bitmaps[3].fill_rect(4, 3, 2, 1, brightOrange) @autumn_leaf_bitmaps[3].set_pixel(6, 3, orangeBrown) @autumn_leaf_bitmaps[3].set_pixel(2, 4, burntRed) @autumn_leaf_bitmaps[3].fill_rect(3, 4, 3, 1, brightOrange) @autumn_leaf_bitmaps[3].set_pixel(6, 4, burntRed) @autumn_leaf_bitmaps[3].set_pixel(7, 4, darkBrown) @autumn_leaf_bitmaps[3].set_pixel(1, 5, orangeBrown) @autumn_leaf_bitmaps[3].fill_rect(2, 5, 2, 1, brightOrange) @autumn_leaf_bitmaps[3].set_pixel(4, 5, orangeBrown) @autumn_leaf_bitmaps[3].set_pixel(5, 5, burntRed) @autumn_leaf_bitmaps[3].fill_rect(1, 6, 2, 1, brightOrange) @autumn_leaf_bitmaps[3].fill_rect(4, 6, 2, 1, burntRed) @autumn_leaf_bitmaps[3].set_pixel(0, 7, brightOrange) @autumn_leaf_bitmaps[3].set_pixel(5, 7, darkBrown) @green_leaf_bitmaps = [] darkGreen = Color.new(62, 76, 31, 255) midGreen = Color.new(76, 91, 43, 255) khaki = Color.new(105, 114, 66, 255) lightGreen = Color.new(128, 136, 88, 255) mint = Color.new(146, 154, 106, 255) # 1st leaf bitmap @green_leaf_bitmaps[0] = Bitmap.new(8, 8) @green_leaf_bitmaps[0].set_pixel(1, 0, darkGreen) @green_leaf_bitmaps[0].set_pixel(1, 1, midGreen) @green_leaf_bitmaps[0].set_pixel(2, 1, darkGreen) @green_leaf_bitmaps[0].set_pixel(2, 2, khaki) @green_leaf_bitmaps[0].set_pixel(3, 2, darkGreen) @green_leaf_bitmaps[0].set_pixel(4, 2, khaki) @green_leaf_bitmaps[0].fill_rect(2, 3, 3, 1, midGreen) @green_leaf_bitmaps[0].set_pixel(5, 3, khaki) @green_leaf_bitmaps[0].fill_rect(2, 4, 2, 1, midGreen) @green_leaf_bitmaps[0].set_pixel(4, 4, darkGreen) @green_leaf_bitmaps[0].set_pixel(5, 4, lightGreen) @green_leaf_bitmaps[0].set_pixel(6, 4, khaki) @green_leaf_bitmaps[0].set_pixel(3, 5, midGreen) @green_leaf_bitmaps[0].set_pixel(4, 5, darkGreen) @green_leaf_bitmaps[0].set_pixel(5, 5, khaki) @green_leaf_bitmaps[0].set_pixel(6, 5, lightGreen) @green_leaf_bitmaps[0].set_pixel(4, 6, midGreen) @green_leaf_bitmaps[0].set_pixel(5, 6, darkGreen) @green_leaf_bitmaps[0].set_pixel(6, 6, lightGreen) @green_leaf_bitmaps[0].set_pixel(6, 7, khaki) # 2nd leaf bitmap @green_leaf_bitmaps[1] = Bitmap.new(8, 8) @green_leaf_bitmaps[1].fill_rect(1, 1, 1, 2, midGreen) @green_leaf_bitmaps[1].fill_rect(2, 2, 2, 1, khaki) @green_leaf_bitmaps[1].set_pixel(4, 2, lightGreen) @green_leaf_bitmaps[1].fill_rect(2, 3, 2, 1, darkGreen) @green_leaf_bitmaps[1].fill_rect(4, 3, 2, 1, lightGreen) @green_leaf_bitmaps[1].set_pixel(2, 4, midGreen) @green_leaf_bitmaps[1].set_pixel(3, 4, darkGreen) @green_leaf_bitmaps[1].set_pixel(4, 4, khaki) @green_leaf_bitmaps[1].fill_rect(5, 4, 2, 1, lightGreen) @green_leaf_bitmaps[1].set_pixel(3, 5, midGreen) @green_leaf_bitmaps[1].set_pixel(4, 5, darkGreen) @green_leaf_bitmaps[1].set_pixel(5, 5, khaki) @green_leaf_bitmaps[1].set_pixel(6, 5, lightGreen) @green_leaf_bitmaps[1].set_pixel(5, 6, darkGreen) @green_leaf_bitmaps[1].fill_rect(6, 6, 2, 1, khaki) # 3rd leaf bitmap @green_leaf_bitmaps[2] = Bitmap.new(8, 8) @green_leaf_bitmaps[2].set_pixel(1, 1, darkGreen) @green_leaf_bitmaps[2].fill_rect(1, 2, 2, 1, midGreen) @green_leaf_bitmaps[2].set_pixel(2, 3, midGreen) @green_leaf_bitmaps[2].set_pixel(3, 3, darkGreen) @green_leaf_bitmaps[2].set_pixel(4, 3, midGreen) @green_leaf_bitmaps[2].fill_rect(2, 4, 2, 1, midGreen) @green_leaf_bitmaps[2].set_pixel(4, 4, darkGreen) @green_leaf_bitmaps[2].set_pixel(5, 4, lightGreen) @green_leaf_bitmaps[2].set_pixel(3, 5, midGreen) @green_leaf_bitmaps[2].set_pixel(4, 5, darkGreen) @green_leaf_bitmaps[2].fill_rect(5, 5, 2, 1, khaki) @green_leaf_bitmaps[2].fill_rect(4, 6, 2, 1, midGreen) @green_leaf_bitmaps[2].set_pixel(6, 6, lightGreen) @green_leaf_bitmaps[2].set_pixel(6, 7, khaki) # 4th leaf bitmap @green_leaf_bitmaps[3] = Bitmap.new(8, 8) @green_leaf_bitmaps[3].fill_rect(0, 3, 1, 2, darkGreen) @green_leaf_bitmaps[3].set_pixel(1, 4, midGreen) @green_leaf_bitmaps[3].set_pixel(2, 4, khaki) @green_leaf_bitmaps[3].set_pixel(3, 4, lightGreen) @green_leaf_bitmaps[3].set_pixel(4, 4, darkGreen) @green_leaf_bitmaps[3].set_pixel(7, 4, midGreen) @green_leaf_bitmaps[3].set_pixel(1, 5, darkGreen) @green_leaf_bitmaps[3].set_pixel(2, 5, midGreen) @green_leaf_bitmaps[3].set_pixel(3, 5, lightGreen) @green_leaf_bitmaps[3].set_pixel(4, 5, mint) @green_leaf_bitmaps[3].set_pixel(5, 5, lightGreen) @green_leaf_bitmaps[3].set_pixel(6, 5, khaki) @green_leaf_bitmaps[3].set_pixel(7, 5, midGreen) @green_leaf_bitmaps[3].fill_rect(2, 6, 2, 1, midGreen) @green_leaf_bitmaps[3].set_pixel(4, 6, lightGreen) @green_leaf_bitmaps[3].set_pixel(5, 6, khaki) @green_leaf_bitmaps[3].set_pixel(6, 6, midGreen) # 5th leaf bitmap @green_leaf_bitmaps[4] = Bitmap.new(8, 8) @green_leaf_bitmaps[4].set_pixel(6, 2, midGreen) @green_leaf_bitmaps[4].set_pixel(7, 2, darkGreen) @green_leaf_bitmaps[4].fill_rect(4, 3, 2, 1, midGreen) @green_leaf_bitmaps[4].set_pixel(6, 3, khaki) @green_leaf_bitmaps[4].set_pixel(2, 4, darkGreen) @green_leaf_bitmaps[4].fill_rect(3, 4, 2, 1, khaki) @green_leaf_bitmaps[4].set_pixel(5, 4, lightGreen) @green_leaf_bitmaps[4].set_pixel(6, 4, khaki) @green_leaf_bitmaps[4].set_pixel(1, 5, midGreen) @green_leaf_bitmaps[4].set_pixel(2, 5, khaki) @green_leaf_bitmaps[4].set_pixel(3, 5, lightGreen) @green_leaf_bitmaps[4].set_pixel(4, 5, mint) @green_leaf_bitmaps[4].set_pixel(5, 5, midGreen) @green_leaf_bitmaps[4].set_pixel(2, 6, darkGreen) @green_leaf_bitmaps[4].fill_rect(3, 6, 2, 1, midGreen) # 6th leaf bitmap @green_leaf_bitmaps[5] = Bitmap.new(8, 8) @green_leaf_bitmaps[5].fill_rect(6, 2, 2, 1, midGreen) @green_leaf_bitmaps[5].fill_rect(4, 3, 2, 1, midGreen) @green_leaf_bitmaps[5].set_pixel(6, 3, khaki) @green_leaf_bitmaps[5].set_pixel(3, 4, midGreen) @green_leaf_bitmaps[5].set_pixel(4, 4, khaki) @green_leaf_bitmaps[5].set_pixel(5, 4, lightGreen) @green_leaf_bitmaps[5].set_pixel(6, 4, mint) @green_leaf_bitmaps[5].set_pixel(1, 5, midGreen) @green_leaf_bitmaps[5].set_pixel(2, 5, khaki) @green_leaf_bitmaps[5].fill_rect(3, 5, 2, 1, mint) @green_leaf_bitmaps[5].set_pixel(5, 5, lightGreen) @green_leaf_bitmaps[5].set_pixel(2, 6, midGreen) @green_leaf_bitmaps[5].set_pixel(3, 6, khaki) @green_leaf_bitmaps[5].set_pixel(4, 6, lightGreen) # 7th leaf bitmap @green_leaf_bitmaps[6] = Bitmap.new(8, 8) @green_leaf_bitmaps[6].fill_rect(6, 1, 1, 2, midGreen) @green_leaf_bitmaps[6].fill_rect(4, 2, 2, 1, midGreen) @green_leaf_bitmaps[6].fill_rect(6, 2, 1, 2, darkGreen) @green_leaf_bitmaps[6].fill_rect(3, 3, 2, 1, midGreen) @green_leaf_bitmaps[6].set_pixel(5, 3, khaki) @green_leaf_bitmaps[6].set_pixel(2, 4, midGreen) @green_leaf_bitmaps[6].set_pixel(3, 4, khaki) @green_leaf_bitmaps[6].set_pixel(4, 4, lightGreen) @green_leaf_bitmaps[6].set_pixel(5, 4, midGreen) @green_leaf_bitmaps[6].set_pixel(1, 5, midGreen) @green_leaf_bitmaps[6].set_pixel(2, 5, khaki) @green_leaf_bitmaps[6].fill_rect(3, 5, 2, 1, midGreen) @green_leaf_bitmaps[6].set_pixel(1, 6, darkGreen) @green_leaf_bitmaps[6].set_pixel(2, 6, midGreen) # 8th leaf bitmap @green_leaf_bitmaps[7] = Bitmap.new(8, 8) @green_leaf_bitmaps[7].set_pixel(6, 1, midGreen) @green_leaf_bitmaps[7].fill_rect(4, 2, 3, 2, midGreen) @green_leaf_bitmaps[7].set_pixel(3, 3, darkGreen) @green_leaf_bitmaps[7].set_pixel(2, 4, darkGreen) @green_leaf_bitmaps[7].set_pixel(3, 4, midGreen) @green_leaf_bitmaps[7].fill_rect(4, 4, 2, 1, khaki) @green_leaf_bitmaps[7].set_pixel(1, 5, darkGreen) @green_leaf_bitmaps[7].set_pixel(2, 5, midGreen) @green_leaf_bitmaps[7].fill_rect(3, 5, 2, 1, lightGreen) @green_leaf_bitmaps[7].set_pixel(2, 6, midGreen) @green_leaf_bitmaps[7].set_pixel(3, 6, lightGreen) # 9th leaf bitmap @green_leaf_bitmaps[8] = Bitmap.new(8, 8) @green_leaf_bitmaps[8].fill_rect(6, 1, 1, 2, midGreen) @green_leaf_bitmaps[8].fill_rect(4, 2, 2, 1, midGreen) @green_leaf_bitmaps[8].fill_rect(6, 2, 1, 2, darkGreen) @green_leaf_bitmaps[8].fill_rect(3, 3, 2, 1, midGreen) @green_leaf_bitmaps[8].set_pixel(5, 3, khaki) @green_leaf_bitmaps[8].set_pixel(2, 4, midGreen) @green_leaf_bitmaps[8].set_pixel(3, 4, khaki) @green_leaf_bitmaps[8].set_pixel(4, 4, lightGreen) @green_leaf_bitmaps[8].set_pixel(5, 4, midGreen) @green_leaf_bitmaps[8].set_pixel(1, 5, midGreen) @green_leaf_bitmaps[8].set_pixel(2, 5, khaki) @green_leaf_bitmaps[8].fill_rect(3, 5, 2, 1, midGreen) @green_leaf_bitmaps[8].set_pixel(1, 6, darkGreen) @green_leaf_bitmaps[8].set_pixel(2, 6, midGreen) # 10th leaf bitmap @green_leaf_bitmaps[9] = Bitmap.new(8, 8) @green_leaf_bitmaps[9].fill_rect(6, 2, 2, 1, midGreen) @green_leaf_bitmaps[9].fill_rect(4, 3, 2, 1, midGreen) @green_leaf_bitmaps[9].set_pixel(6, 3, khaki) @green_leaf_bitmaps[9].set_pixel(3, 4, midGreen) @green_leaf_bitmaps[9].set_pixel(4, 4, khaki) @green_leaf_bitmaps[9].set_pixel(5, 4, lightGreen) @green_leaf_bitmaps[9].set_pixel(6, 4, mint) @green_leaf_bitmaps[9].set_pixel(1, 5, midGreen) @green_leaf_bitmaps[9].set_pixel(2, 5, khaki) @green_leaf_bitmaps[9].fill_rect(3, 5, 2, 1, mint) @green_leaf_bitmaps[9].set_pixel(5, 5, lightGreen) @green_leaf_bitmaps[9].set_pixel(2, 6, midGreen) @green_leaf_bitmaps[9].set_pixel(3, 6, khaki) @green_leaf_bitmaps[9].set_pixel(4, 6, lightGreen) # 11th leaf bitmap @green_leaf_bitmaps[10] = Bitmap.new(8, 8) @green_leaf_bitmaps[10].set_pixel(6, 2, midGreen) @green_leaf_bitmaps[10].set_pixel(7, 2, darkGreen) @green_leaf_bitmaps[10].fill_rect(4, 3, 2, 1, midGreen) @green_leaf_bitmaps[10].set_pixel(6, 3, khaki) @green_leaf_bitmaps[10].set_pixel(2, 4, darkGreen) @green_leaf_bitmaps[10].fill_rect(3, 4, 2, 1, khaki) @green_leaf_bitmaps[10].set_pixel(5, 4, lightGreen) @green_leaf_bitmaps[10].set_pixel(6, 4, khaki) @green_leaf_bitmaps[10].set_pixel(1, 5, midGreen) @green_leaf_bitmaps[10].set_pixel(2, 5, khaki) @green_leaf_bitmaps[10].set_pixel(3, 5, lightGreen) @green_leaf_bitmaps[10].set_pixel(4, 5, mint) @green_leaf_bitmaps[10].set_pixel(5, 5, midGreen) @green_leaf_bitmaps[10].set_pixel(2, 6, darkGreen) @green_leaf_bitmaps[10].fill_rect(3, 6, 2, 1, midGreen) # 12th leaf bitmap @green_leaf_bitmaps[11] = Bitmap.new(8, 8) @green_leaf_bitmaps[11].fill_rect(0, 3, 1, 2, darkGreen) @green_leaf_bitmaps[11].set_pixel(1, 4, midGreen) @green_leaf_bitmaps[11].set_pixel(2, 4, khaki) @green_leaf_bitmaps[11].set_pixel(3, 4, lightGreen) @green_leaf_bitmaps[11].set_pixel(4, 4, darkGreen) @green_leaf_bitmaps[11].set_pixel(7, 4, midGreen) @green_leaf_bitmaps[11].set_pixel(1, 5, darkGreen) @green_leaf_bitmaps[11].set_pixel(2, 5, midGreen) @green_leaf_bitmaps[11].set_pixel(3, 5, lightGreen) @green_leaf_bitmaps[11].set_pixel(4, 5, mint) @green_leaf_bitmaps[11].set_pixel(5, 5, lightGreen) @green_leaf_bitmaps[11].set_pixel(6, 5, khaki) @green_leaf_bitmaps[11].set_pixel(7, 5, midGreen) @green_leaf_bitmaps[11].fill_rect(2, 6, 2, 1, midGreen) @green_leaf_bitmaps[11].set_pixel(4, 6, lightGreen) @green_leaf_bitmaps[11].set_pixel(5, 6, khaki) @green_leaf_bitmaps[11].set_pixel(6, 6, midGreen) # 13th leaf bitmap @green_leaf_bitmaps[12] = Bitmap.new(8, 8) @green_leaf_bitmaps[12].set_pixel(1, 1, darkGreen) @green_leaf_bitmaps[12].fill_rect(1, 2, 2, 1, midGreen) @green_leaf_bitmaps[12].set_pixel(2, 3, midGreen) @green_leaf_bitmaps[12].set_pixel(3, 3, darkGreen) @green_leaf_bitmaps[12].set_pixel(4, 3, midGreen) @green_leaf_bitmaps[12].fill_rect(2, 4, 2, 1, midGreen) @green_leaf_bitmaps[12].set_pixel(4, 4, darkGreen) @green_leaf_bitmaps[12].set_pixel(5, 4, lightGreen) @green_leaf_bitmaps[12].set_pixel(3, 5, midGreen) @green_leaf_bitmaps[12].set_pixel(4, 5, darkGreen) @green_leaf_bitmaps[12].fill_rect(5, 5, 2, 1, khaki) @green_leaf_bitmaps[12].fill_rect(4, 6, 2, 1, midGreen) @green_leaf_bitmaps[12].set_pixel(6, 6, lightGreen) @green_leaf_bitmaps[12].set_pixel(6, 7, khaki) @rose_bitmaps = [] brightRed = Color.new(255, 0, 0, 255) midRed = Color.new(179, 17, 17, 255) darkRed = Color.new(141, 9, 9, 255) # 1st rose petal bitmap @rose_bitmaps[0] = Bitmap.new(3, 3) @rose_bitmaps[0].fill_rect(1, 0, 2, 1, brightRed) @rose_bitmaps[0].fill_rect(0, 1, 1, 2, brightRed) @rose_bitmaps[0].fill_rect(1, 1, 2, 2, midRed) @rose_bitmaps[0].set_pixel(2, 2, darkRed) # 2nd rose petal bitmap @rose_bitmaps[1] = Bitmap.new(3, 3) @rose_bitmaps[1].set_pixel(0, 1, midRed) @rose_bitmaps[1].set_pixel(1, 1, brightRed) @rose_bitmaps[1].fill_rect(1, 2, 1, 2, midRed) @feather_bitmaps = [] white = Color.new(255, 255, 255, 255) # 1st feather bitmap @feather_bitmaps[0] = Bitmap.new(3, 3) @feather_bitmaps[0].set_pixel(0, 2, white) @feather_bitmaps[0].set_pixel(1, 2, grey) @feather_bitmaps[0].set_pixel(2, 1, grey) # 2nd feather bitmap @feather_bitmaps[0] = Bitmap.new(3, 3) @feather_bitmaps[0].set_pixel(0, 0, white) @feather_bitmaps[0].set_pixel(0, 1, grey) @feather_bitmaps[0].set_pixel(1, 2, grey) # 3rd feather bitmap @feather_bitmaps[0] = Bitmap.new(3, 3) @feather_bitmaps[0].set_pixel(2, 0, white) @feather_bitmaps[0].set_pixel(1, 0, grey) @feather_bitmaps[0].set_pixel(0, 1, grey) # 4th feather bitmap @feather_bitmaps[0] = Bitmap.new(3, 3) @feather_bitmaps[0].set_pixel(2, 2, white) @feather_bitmaps[0].set_pixel(2, 1, grey) @feather_bitmaps[0].set_pixel(1, 0, grey) @blood_rain_bitmap = Bitmap.new(7, 56) for i in 0..6 @blood_rain_bitmap.fill_rect(6-i, i*8, 1, 8, darkRed) end @sparkle_bitmaps = [] lightBlue = Color.new(181, 244, 255, 255) midBlue = Color.new(126, 197, 235, 255) darkBlue = Color.new(77, 136, 225, 255) # 1st sparkle bitmap @sparkle_bitmaps[0] = Bitmap.new(7, 7) @sparkle_bitmaps[0].set_pixel(3, 3, darkBlue) # 2nd sparkle bitmap @sparkle_bitmaps[1] = Bitmap.new(7, 7) @sparkle_bitmaps[1].fill_rect(3, 2, 1, 3, darkBlue) @sparkle_bitmaps[1].fill_rect(2, 3, 3, 1, darkBlue) @sparkle_bitmaps[1].set_pixel(3, 3, midBlue) # 3rd sparkle bitmap @sparkle_bitmaps[2] = Bitmap.new(7, 7) @sparkle_bitmaps[2].set_pixel(1, 1, darkBlue) @sparkle_bitmaps[2].set_pixel(5, 1, darkBlue) @sparkle_bitmaps[2].set_pixel(2, 2, midBlue) @sparkle_bitmaps[2].set_pixel(4, 2, midBlue) @sparkle_bitmaps[2].set_pixel(3, 3, lightBlue) @sparkle_bitmaps[2].set_pixel(2, 4, midBlue) @sparkle_bitmaps[2].set_pixel(4, 4, midBlue) @sparkle_bitmaps[2].set_pixel(1, 5, darkBlue) @sparkle_bitmaps[2].set_pixel(5, 5, darkBlue) # 4th sparkle bitmap @sparkle_bitmaps[3] = Bitmap.new(7, 7) @sparkle_bitmaps[3].fill_rect(3, 1, 1, 5, darkBlue) @sparkle_bitmaps[3].fill_rect(1, 3, 5, 1, darkBlue) @sparkle_bitmaps[3].fill_rect(3, 2, 1, 3, midBlue) @sparkle_bitmaps[3].fill_rect(2, 3, 3, 1, midBlue) @sparkle_bitmaps[3].set_pixel(3, 3, lightBlue) # 5th sparkle bitmap @sparkle_bitmaps[4] = Bitmap.new(7, 7) @sparkle_bitmaps[4].fill_rect(2, 2, 3, 3, midBlue) @sparkle_bitmaps[4].fill_rect(3, 2, 1, 3, darkBlue) @sparkle_bitmaps[4].fill_rect(2, 3, 3, 1, darkBlue) @sparkle_bitmaps[4].set_pixel(3, 3, lightBlue) @sparkle_bitmaps[4].set_pixel(1, 1, darkBlue) @sparkle_bitmaps[4].set_pixel(5, 1, darkBlue) @sparkle_bitmaps[4].set_pixel(1, 5, darkBlue) @sparkle_bitmaps[4].set_pixel(5, 1, darkBlue) # 6th sparkle bitmap @sparkle_bitmaps[5] = Bitmap.new(7, 7) @sparkle_bitmaps[5].fill_rect(2, 1, 3, 5, darkBlue) @sparkle_bitmaps[5].fill_rect(1, 2, 5, 3, darkBlue) @sparkle_bitmaps[5].fill_rect(2, 2, 3, 3, midBlue) @sparkle_bitmaps[5].fill_rect(3, 1, 1, 5, midBlue) @sparkle_bitmaps[5].fill_rect(1, 3, 5, 1, midBlue) @sparkle_bitmaps[5].fill_rect(3, 2, 1, 3, lightBlue) @sparkle_bitmaps[5].fill_rect(2, 3, 3, 1, lightBlue) @sparkle_bitmaps[5].set_pixel(3, 3, white) # 7th sparkle bitmap @sparkle_bitmaps[6] = Bitmap.new(7, 7) @sparkle_bitmaps[6].fill_rect(2, 1, 3, 5, midBlue) @sparkle_bitmaps[6].fill_rect(1, 2, 5, 3, midBlue) @sparkle_bitmaps[6].fill_rect(3, 0, 1, 7, darkBlue) @sparkle_bitmaps[6].fill_rect(0, 3, 7, 1, darkBlue) @sparkle_bitmaps[6].fill_rect(2, 2, 3, 3, lightBlue) @sparkle_bitmaps[6].fill_rect(3, 2, 1, 3, midBlue) @sparkle_bitmaps[6].fill_rect(2, 3, 3, 1, midBlue) @sparkle_bitmaps[6].set_pixel(3, 3, white) @user_bitmaps = [] update_user_defined end def update_user_defined for image in @user_bitmaps image.dispose end #user-defined bitmaps for name in $WEATHER_IMAGES @user_bitmaps.push(RPG::Cache.picture(name)) end for sprite in @sprites sprite.bitmap = @user_bitmaps[rand(@user_bitmaps.size)] end end attr_reader :type attr_reader :max attr_reader :ox attr_reader :oy end end Near Fantastica's Dynamic Maps: Instructions: Nearââ¬â¢s Dynamic Maps script. You will need this is your going to use Wachungaââ¬â¢s random map generator. Put this in a class above all of your other custom scripts, but under the anti-lag script if you are using that, called Dynamic Maps, then put this into it. Dynamic Maps
#================================ # ? Dynamic Maps #================================ # ?By: Near Fantastica # Date: 05.09.05 # Version: 1 #================================ module Map #-------------------------------------------------------------- @map_data = {} #-------------------------------------------------------------------------- def Map.set_map(map, map_id) @map_data[map_id] = map end #-------------------------------------------------------------------------- def Map.data(map_id) return @map_data[map_id] end end class Map_Data #-------------------------------------------------------------- attr_accessor :map_id attr_accessor :map attr_accessor :tileset_name attr_accessor :autotile_names attr_accessor :panorama_name attr_accessor :panorama_hue attr_accessor :fog_name attr_accessor :fog_hue attr_accessor :fog_opacity attr_accessor :fog_blend_type attr_accessor :fog_zoom attr_accessor :fog_sx attr_accessor :fog_sy attr_accessor :battleback_name attr_accessor :passages attr_accessor :priorities attr_accessor :terrain_tags attr_accessor :display_x attr_accessor :display_y attr_accessor :need_refresh attr_accessor :events attr_accessor :common_events attr_accessor :fog_ox attr_accessor :fog_oy attr_accessor :fog_tone attr_accessor :fog_tone_target attr_accessor :fog_tone_duration attr_accessor :fog_opacity_duration attr_accessor :fog_opacity_target attr_accessor :scroll_direction attr_accessor :scroll_rest attr_accessor :scroll_speed attr_accessor :fow_on attr_accessor :fow_grid attr_accessor :fow_range #------------------------------------------------------------- def initialize @map_id = 0 @map = 0 @tileset_name = 0 @autotile_names = 0 @panorama_name = 0 @panorama_hue = 0 @fog_name = 0 @fog_hue = 0 @fog_opacity = 0 @fog_blend_type = 0 @fog_zoom = 0 @fog_sx = 0 @fog_sy = 0 @battleback_name = 0 @passages = 0 @priorities = 0 @terrain_tags = 0 @display_x = 0 @display_y = 0 @need_refresh = 0 @events = 0 @common_events = 0 @fog_ox = 0 @fog_oy = 0 @fog_tone = 0 @fog_tone_target = 0 @fog_tone_duration = 0 @fog_opacity_duration = 0 @fog_opacity_target = 0 @scroll_direction = 0 @scroll_rest = 0 @scroll_speed = 0 @fow_on = 0 # FOW @fow_grid = 0 # FOW @fow_range = 0 # FOW end end class Game_Map #-------------------------------------------------------------- def setup(map_id) save_map(@map_id) if Map.data(map_id) == nil setup_map(map_id) else load_map(map_id) end end #-------------------------------------------------------------- def setup_map(map_id) @map_id = map_id @map = load_data(sprintf("Data/Map%03d.rxdata", @map_id)) tileset = $data_tilesets[@map.tileset_id] @tileset_name = tileset.tileset_name @autotile_names = tileset.autotile_names @panorama_name = tileset.panorama_name @panorama_hue = tileset.panorama_hue @fog_name = tileset.fog_name @fog_hue = tileset.fog_hue @fog_opacity = tileset.fog_opacity @fog_blend_type = tileset.fog_blend_type @fog_zoom = tileset.fog_zoom @fog_sx = tileset.fog_sx @fog_sy = tileset.fog_sy @battleback_name = tileset.battleback_name @passages = tileset.passages @priorities = tileset.priorities @terrain_tags = tileset.terrain_tags @display_x = 0 @display_y = 0 @need_refresh = false @events = {} for i in @map.events.keys @events[i] = Game_Event.new(@map_id, @map.events[i]) end @common_events = {} for i in 1...$data_common_events.size @common_events[i] = Game_CommonEvent.new(i) end @fog_ox = 0 @fog_oy = 0 @fog_tone = Tone.new(0, 0, 0, 0) @fog_tone_target = Tone.new(0, 0, 0, 0) @fog_tone_duration = 0 @fog_opacity_duration = 0 @fog_opacity_target = 0 @scroll_direction = 2 @scroll_rest = 0 @scroll_speed = 4 end #----------------------------------------------------------- def load_map(map_id) map_data = Map.data(map_id) @map_id = map_data.map_id @map = map_data.map @tileset_name = map_data.tileset_name @autotile_names = map_data.autotile_names @panorama_name = map_data.panorama_name @panorama_hue = map_data.panorama_hue @fog_name = map_data.fog_name @fog_hue = map_data.fog_hue @fog_opacity = map_data.fog_opacity @fog_blend_type = map_data.fog_blend_type @fog_zoom = map_data.fog_zoom @fog_sx = map_data.fog_sx @fog_sy = map_data.fog_sy @battleback_name = map_data.battleback_name @passages = map_data.passages @priorities = map_data.priorities @terrain_tags = map_data.terrain_tags @display_x = map_data.display_x @display_y = map_data.display_y @need_refresh = map_data.need_refresh @events = map_data.events @common_events = map_data.common_events @fog_ox = map_data.fog_ox @fog_oy = map_data.fog_oy @fog_tone = map_data.fog_tone @fog_tone_target = map_data.fog_tone_target @fog_tone_duration = map_data.fog_tone_duration @fog_opacity_duration = map_data.fog_opacity_duration @fog_opacity_target = map_data.fog_opacity_target @scroll_direction = map_data.scroll_direction @scroll_rest = map_data.scroll_rest @scroll_speed = map_data.scroll_speed @fow_on = map_data.fow_on # FOW @fow_grid = map_data.fow_grid # FOW @fow_range = map_data.fow_range # FOW end #-------------------------------------------------------------- def save_map(map_id) return if map_id == 0 map_data = Map_Data.new map_data.map_id = map_id map_data.map = @map map_data.tileset_name = @tileset_name map_data.autotile_names = @autotile_names map_data.panorama_name = @panorama_name map_data.panorama_hue = @panorama_hue map_data.fog_name = @fog_name map_data.fog_hue = @fog_hue map_data.fog_opacity = @fog_opacity map_data.fog_blend_type = @fog_blend_type map_data.fog_zoom = @fog_zoom map_data.fog_sx = @fog_sx map_data.fog_sy = @fog_sy map_data.battleback_name = @battleback_name map_data.passages = @passages map_data.priorities = @priorities map_data.terrain_tags = @terrain_tags map_data.display_x = @display_x map_data.display_y = @display_y map_data.need_refresh = @need_refresh map_data.events = @events map_data.common_events = @common_events map_data.fog_ox = @fog_ox map_data.fog_oy = @fog_oy map_data.fog_tone = @fog_tone map_data.fog_tone_target = @fog_tone_target map_data.fog_tone_duration = @fog_tone_duration map_data.fog_opacity_duration = @fog_opacity_duration map_data.fog_opacity_target = @fog_opacity_target map_data.scroll_direction = @scroll_direction map_data.scroll_rest = @scroll_rest map_data.scroll_speed = @scroll_speed map_data.fow_on = @fow_on # FOW map_data.fow_grid = @fow_grid # FOW map_data.fow_range = @fow_range # FOW Map.set_map(map_data, map_id) end end See Next Post Scripts; Updated; Scripts Demo Added - Geowil - 02-17-2010 Sorry about the wait, a few posting restrictions and features were keeping me from posting anymore. Fukuyama's Custom Save Menu (With edits from Wachuga to remove < > tags): Instructions: Ok, this script will take any "<>" tags out of the map name, that was Wachunga's edit. Now, make a new class above "Main" and name it Custom Save Menu then put this into it: Custom Save Menu
#================================================ # ====Create a new script above main and put all that code in it. ====== #================================================ # # # # # # ? Window_SaveFile #------------------------------------------------------------------------------ # ???????????????????????????????????? #============================================================================== class Window_SaveFile < Window_Base #-------------------------------------------------------------------------- # ? ?????????? #-------------------------------------------------------------------------- attr_reader :filename # ????? attr_reader :selected # ???? #-------------------------------------------------------------------------- # ? ????????? # file_index : ?????????????? (0?3) # filename : ????? #-------------------------------------------------------------------------- def initialize(file_index, filename) super(0, 64 + file_index % 4 * 104, 640, 104) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = $fontface self.contents.font.size = $fontsize @file_index = file_index @filename = "Save#{@file_index + 1}.rxdata" @game_party_leader = "" #@time_stamp = Time.at(0) @file_exist = FileTest.exist?(@filename) if @file_exist file = File.open(@filename, "r") # @time_stamp = file.mtime @characters = Marshal.load(file) @frame_count = Marshal.load(file) @total_sec = @frame_count / Graphics.frame_rate @game_party = Marshal.load(file) @game_map_name = Marshal.load(file) @game_party_leader = @game_party.actors[0].name end refresh @selected = false rescue file.close @selected = false @file_exist = false refresh end #-------------------------------------------------------------------------- # ? ?????? #-------------------------------------------------------------------------- def refresh self.contents.clear # ????????? self.contents.font.color = normal_color if @game_party_leader == "" name = "File #{@file_index + 1}" else name = "File #{@file_index + 1} : " + @game_party_leader end self.contents.draw_text(4, 0, 600, 32, name) @name_width = contents.text_size(name).width # ?????????????? if @file_exist # ????????? for i in 0...@characters.size bitmap = RPG::Cache.character(@characters[i][0], @characters[i][1]) cw = bitmap.rect.width / 4 ch = bitmap.rect.height / 4 src_rect = Rect.new(0, 0, cw, ch) x = 300 - @characters.size * 32 + i * 64 - cw / 2 self.contents.blt(x, 68 - ch, bitmap, src_rect) end # ???????? hour = @total_sec / 60 / 60 min = @total_sec / 60 % 60 sec = @total_sec % 60 time_string = sprintf("%02d:%02d:%02d", hour, min, sec) self.contents.font.color = normal_color self.contents.draw_text(4, 8, 600, 32, time_string, 2) # ?????????? self.contents.font.color = normal_color # time_string = @time_stamp.strftime("%Y/%m/%d %H:%M") # self.contents.draw_text(4, 40, 600, 32, time_string, 2) self.contents.draw_text(4, 40, 600, 32, @game_map_name[0...@game_map_name.index('<')], 2) end end #-------------------------------------------------------------------------- # ? ??????? # selected : ??????? (true=?? false=???) #-------------------------------------------------------------------------- def selected=(selected) @selected = selected update_cursor_rect end #-------------------------------------------------------------------------- # ? ????????? #-------------------------------------------------------------------------- def update_cursor_rect if @selected self.cursor_rect.set(0, 0, @name_width + 8, 32) else self.cursor_rect.empty end end end #====================================================#========================== # ? Scene_Save #------------------------------------------------------------------------------ # ?????????????????? #====================================================#========================== class Scene_Save < Scene_File # ----------------------------- def initialize super("Save in which slot?") @confirm_window = Window_Base.new(120, 188, 400, 64) @confirm_window.contents = Bitmap.new(368, 32) string = "Sure you want to overwrite this file?" @confirm_window.contents.font.name = "OldEnglish" @confirm_window.contents.font.size = 20 @confirm_window.contents.draw_text(4, 0, 368, 32, string) @yes_no_window = Window_Command.new(100, ["Yes", "No"]) @confirm_window.visible = false @confirm_window.z = 1500 @yes_no_window.visible = false @yes_no_window.active = false @yes_no_window.index = 1 @yes_no_window.x = 270 @yes_no_window.y = 252 @yes_no_window.z = 1500 @mode = 0 end # ----------------------------- def on_decision(filename) if FileTest.exist?(filename) @confirm_window.visible = true @yes_no_window.visible = true @yes_no_window.active = true @mode = 1 else $game_system.se_play($data_system.save_se) file = File.open(filename, "wb") write_save_data(file) file.close if $game_temp.save_calling $game_temp.save_calling = false $scene = Scene_Map.new return end $scene = Scene_Menu.new(4) end end # ----------------------------- def update if @mode == 0 super else @help_window.update @yes_no_window.update if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) if @yes_no_window.index == 0 filename = make_filename(@file_index) $game_system.se_play($data_system.save_se) file = File.open(filename, "wb") write_save_data(file) file.close if $game_temp.save_calling $game_temp.save_calling = false $scene = Scene_Map.new else $scene = Scene_Menu.new(4) end else @confirm_window.visible = false @yes_no_window.visible = false @yes_no_window.active = false @yes_no_window.index = 1 @mode = 0 end end if Input.trigger?(Input::B) @confirm_window.visible = false @yes_no_window.visible = false @yes_no_window.active = false @yes_no_window.index = 1 @mode = 0 return end end end # ----------------------------- def on_cancel $game_system.se_play($data_system.cancel_se) if $game_temp.save_calling $game_temp.save_calling = false $scene = Scene_Map.new return end $scene = Scene_Menu.new(4) end # ----------------------------- def write_save_data(file) characters = [] for i in 0...$game_party.actors.size actor = $game_party.actors[i] characters.push([actor.character_name, actor.character_hue]) end Marshal.dump(characters, file) Marshal.dump(Graphics.frame_count, file) $game_system.save_count += 1 $game_system.magic_number = $data_system.magic_number Marshal.dump($game_party, file) Marshal.dump($game_map.name, file) Marshal.dump($game_system, file) Marshal.dump($game_switches, file) Marshal.dump($game_variables, file) Marshal.dump($game_self_switches, file) Marshal.dump($game_screen, file) Marshal.dump($game_actors, file) Marshal.dump($game_map, file) Marshal.dump($game_troop, file) Marshal.dump($game_player, file) end end #============================================================================== # ? Scene_Load #------------------------------------------------------------------------------ # ?????????????????? #============================================================================== class Scene_Load < Scene_File #-------------------------------------------------------------------------- # ? ????????? #-------------------------------------------------------------------------- def initialize # ??????????????? $game_temp = Game_Temp.new # ?????????????????? $game_temp.last_file_index = 0 latest_time = Time.at(0) for i in 0..3 filename = make_filename(i) if FileTest.exist?(filename) file = File.open(filename, "r") if file.mtime > latest_time latest_time = file.mtime $game_temp.last_file_index = i end file.close end end super("Which file do you wish to load from?") end #-------------------------------------------------------------------------- # ? ?????? #-------------------------------------------------------------------------- def on_decision(filename) # ???????????? unless FileTest.exist?(filename) # ??? SE ??? $game_system.se_play($data_system.buzzer_se) return end # ??? SE ??? $game_system.se_play($data_system.load_se) # ??????????? file = File.open(filename, "rb") read_save_data(file) file.close # BGM?BGS ??? $game_system.bgm_play($game_system.playing_bgm) $game_system.bgs_play($game_system.playing_bgs) # ?????? (????????) $game_map.update # ?????????? $scene = Scene_Map.new end #-------------------------------------------------------------------------- # ? ????????? #-------------------------------------------------------------------------- def on_cancel # ????? SE ??? $game_system.se_play($data_system.cancel_se) # ??????????? $scene = Scene_Title.new end #-------------------------------------------------------------------------- # ? ??????????? # file : ??????????????? (??????) #-------------------------------------------------------------------------- def read_save_data(file) characters = Marshal.load(file) Graphics.frame_count = Marshal.load(file) $game_party = Marshal.load(file) @game_map_name = Marshal.load(file) $game_system = Marshal.load(file) $game_switches = Marshal.load(file) $game_variables = Marshal.load(file) $game_self_switches = Marshal.load(file) $game_screen = Marshal.load(file) $game_actors = Marshal.load(file) $game_map = Marshal.load(file) $game_troop = Marshal.load(file) $game_player = Marshal.load(file) # ??????????????????? # (?????????????????) if $game_system.magic_number != $data_system.magic_number # ???????? $game_map.setup($game_map.map_id) $game_player.center($game_player.x, $game_player.y) end # ??????????????? $game_party.refresh end end #============================================================================== # ? Scene_File #------------------------------------------------------------------------------ # ????????????????????????? #============================================================================== class Scene_File #-------------------------------------------------------------------------- # ? ????????? # help_text : ???????????????? #-------------------------------------------------------------------------- def initialize(help_text) @help_text = help_text end #-------------------------------------------------------------------------- # ? ????? #-------------------------------------------------------------------------- def main # ??????????? @help_window = Window_Help.new @help_window.set_text(@help_text) # ??????????????? @savefile_windows = [] for i in 0..3 @savefile_windows.push(Window_SaveFile.new(i, make_filename(i))) end # ?????????????? @file_index = $game_temp.last_file_index @savefile_windows[@file_index].selected = true # ????????? Graphics.transition # ?????? loop do # ???????? Graphics.update # ??????? Input.update # ?????? update # ???????????????? if $scene != self break end end # ????????? Graphics.freeze # ???????? @help_window.dispose for i in @savefile_windows i.dispose end if self.is_a?(Scene_Save) @confirm_window.dispose @yes_no_window.dispose end end #-------------------------------------------------------------------------- # ? ?????? #-------------------------------------------------------------------------- def update # ???????? @help_window.update for i in @savefile_windows i.update end # C ?????????? if Input.trigger?(Input::C) # ???? on_decision (??????) ??? on_decision(make_filename(@file_index)) $game_temp.last_file_index = @file_index return end # B ?????????? if Input.trigger?(Input::B) # ???? on_cancel (??????) ??? on_cancel return end # ?????????????? if Input.repeat?(Input::DOWN) # ???????????????????????? # ?????????? 3 ?????? if Input.trigger?(Input::DOWN) or @file_index < 3 # ???? SE ??? $game_system.se_play($data_system.cursor_se) # ????????? @savefile_windows[@file_index].selected = false @file_index = (@file_index + 1) % 4 @savefile_windows[@file_index].selected = true return end end # ?????????????? if Input.repeat?(Input::UP) # ???????????????????????? # ?????????? 0 ??????? if Input.trigger?(Input::UP) or @file_index > 0 # ???? SE ??? $game_system.se_play($data_system.cursor_se) # ????????? @savefile_windows[@file_index].selected = false @file_index = (@file_index + 3) % 4 @savefile_windows[@file_index].selected = true return end end end #-------------------------------------------------------------------------- # ? ???????? # file_index : ?????????????? (0?3) #-------------------------------------------------------------------------- def make_filename(file_index) return "Save#{file_index + 1}.rxdata" end end # # Map Name Script ver.1.03.3 # by: fukuyama # Japanese Comments Removed By: K-Anator # http://www.rpg-reborn.tk # This only gives the game_map.name method #============================================================================== # Scene_Title #============================================================================== class Scene_Title #-------------------------------------------------------------------------- alias xrxs20_main main def main $map_infos = load_data("Data/MapInfos.rxdata") for key in $map_infos.keys $map_infos[key] = $map_infos[key].name end xrxs20_main end end #============================================================================== # Game_Map #============================================================================== class Game_Map #-------------------------------------------------------------------------- def name $map_infos[@map_id] end end Makeamidget's Battle Warning Script: Instructions: This script will put a bar over your head that will have an encounter bar in it. The size depends on the encounter rate and when the bar gets to the very end you will be attacked by monsters. First go to 'Scene_Map' and add this under the 'main' command: Quote:unless $game_system.encounter_disabled Now, make a new class above 'Main' and call it Encounter Bar and put this into it: Battle Warning Script
#================================================= # The amazing Battle Warning thing by makeamidget #================================================= class Encounter < Window_Base def initialize(x=0,y=0,width=200,height=45) if width > 640 width = 640 end super(x, y, width, height) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = $defaultfonttype # "Help" window font self.contents.font.size = $defaultfontsize self.opacity = 0#change if you want to see the box refresh end def refresh self.contents.clear draw_encounter(0,0) end def draw_encounter( x=200, y=200, width = $game_map.encounter_step, height=20) self.contents.font.color = normal_color self.contents.font.size = 17 self.contents.fill_rect(x-1, y+1, width+2,11, Color.new(0, 0, 0, 255)) w = width * $game_player.encounter_count / $game_map.encounter_step self.contents.fill_rect(x, y+2, w,1, Color.new(0, 0, 100,255)) self.contents.fill_rect(x, y+3, w,1, Color.new(4, 4, 106, 255)) self.contents.fill_rect(x, y+4, w,1, Color.new(8, 8, 112, 255)) self.contents.fill_rect(x, y+5, w,1, Color.new(12, 12, 118, 255)) self.contents.fill_rect(x, y+6, w,1, Color.new(16, 16, 124, 255)) self.contents.fill_rect(x, y+7, w,1, Color.new(20, 20, 130, 255)) self.contents.fill_rect(x, y+8, w,1, Color.new(24, 24, 136, 255)) self.contents.fill_rect(x, y+9, w,1, Color.new(28, 28, 142, 255)) self.contents.fill_rect(x, y+10, w,1, Color.new(32, 32, 148, 255)) end end Momomomo's Item Book Script (Translated by Mcdohl): Instructions: Installation: Make a new class called Item Book above 'Main' and put the spoiler code into it. Usage: It is a very long script indeed lol, but don't be worried, its not too hard to use. First off, go to your Database in your game after you get this script in and go to the system tab. In the bottom left hand corner in the element/attribute tab, add new slots. Now, the stuff in these lines: Quote: Is what you put in those new elements/attributes you just made. Note that I have customized this to my needs, if you want to get rid of the quest items, and quests, just delete all instances of each out of those lines above that are in the script. You can add new ones in the same way as well. Now, go to the items and armor tabs in your database and, lets say were in the armor tab, we go to Bronze Shield and check the 'armor' element/attribute. We go to Power Ring and check the accessories element/attribute. this places that item in that section. You do the same for items. Common Items are what the defaults are, or what you want of course, then you can add sections or other items, and armors. Weapons are already listed, you don't need to make an element/attribute for them. Now, to call this from the menu or a call script use this: Quote: $scene = Scene_ItemBook.new Item Book Script
#================================ # Item_Book by momomomo? # http://f53.aaa.livedoor.jp/%7Emomomo/source/itembook_source.html #---------------------------------------------------------------- #-Translated by Mcdohl #---------------------------------------------------------------- #================================ # English is not my main language, so I'm sorry if you can't understand some of my comments. # 11.18.2005 # Script translated, known bugs: # -Won't display items you have equipped at start until you unequip them. This is because the # script detects items until you get them on the "item" menu, not the Equipment menu. A way # to fix this is to start with nothing equipped, then add the items and equip them in an auto-start # event. # This script will add all the items you acquire throughout the game into a "Book." # In this book you can see the stats, price, element, etc. Works great with KGC's Item # Grouping Script. module Item_Book_Config # The following line (SHOW_COMPLETE_TYPE =) is very important. It will define how are # the items counted. (The item count appears on the upper right corner, in the help window. # Use "0" to display nothing. # Use "1" to display it in a "items found so far/total" format. # Use "2" to use percentage completion. # Use "3" Method 1+2 SHOW_COMPLETE_TYPE = 1 end class Data_ItemBook attr_reader :item_kind_name attr_reader :weapon_kind_name attr_reader :armor_kind_name attr_reader :kind_row attr_reader :item_id_data attr_reader :weapon_id_data attr_reader :armor_id_data attr_reader :item_kind_element_name attr_reader :weapon_kind_element_name attr_reader :armor_kind_element_name #-------------------------------------------------------------------------- # ? Setup #-------------------------------------------------------------------------- def initialize # Name the item, weapon and armor categories. If your key items are in the Item index in the # database, then type it inside the item_kind_name brackets and so on. Got it? I hope so. ^^ @item_kind_name = ["Items", "Quest_Items", "Quests", "Status_Inflicting_Items", "Status Increasing Items"] @weapon_kind_name = ["Weapons"] @armor_kind_name = ["Armor", "Accessories"] # Next is the menu setup. It's a vertical list. List the categories in any order you want. # Note: The categories below must coincide with the categories you listed above. @kind_row = ["Items", "Status_Inflicting_Items", "Status Increasing Items", "Quest_Items", "Weapons", "Armor", "Accessories", "Quests"] # Now write the element setups. It's easier to understand this if you're already using KGC's # item grouping script. You need to add elements in the Database (in the System Tab). For # example, if you want to use a Key Item category, go make an element called "Key Item" and # then apply it to all the items you want them to appear under the Key Item category! # If you're not going to categorize a kind of item, like in this case "Weapons" then just type the # brackets with nothing inside. @item_kind_element_name = ["Common Items", "Quest_Items", "Quests", "Status_Inflicting_Items", "Status Increasing Items"] @weapon_kind_element_name = [] @armor_kind_element_name = ["Armor", "Accessories"] # Reading Database data. @item_id_data = item_book_id_set @weapon_id_data = weapon_book_id_set @armor_id_data = armor_book_id_set end #-------------------------------------------------------------------------- # ? Defining Kinds #-------------------------------------------------------------------------- def kind_search(name) if @item_kind_name.include?(name) return [0, @item_kind_name.index(name)] elsif @weapon_kind_name.include?(name) return [1, @weapon_kind_name.index(name)] elsif @armor_kind_name.include?(name) return [2, @armor_kind_name.index(name)] end end #-------------------------------------------------------------------------- # ? ??????????? <----No idea #-------------------------------------------------------------------------- def no_add_element no_add = 0 # ???????ID??? for i in 1...$data_system.elements.size if $data_system.elements[i] =~ /??????/ no_add = i break end end return no_add end #-------------------------------------------------------------------------- # ? ?????????ID??? <-----No idea #-------------------------------------------------------------------------- def element_search(element_name) return nil if element_name == nil for i in 1...$data_system.elements.size if $data_system.elements[i] =~ /^#{element_name}/ return i end end end #-------------------------------------------------------------------------- # ? Item Database #-------------------------------------------------------------------------- def item_book_id_set data = [] no_add = no_add_element if @item_kind_element_name.size == 0 data[0] = [0] for i in 1...$data_items.size item = $data_items[i] next if item.name == "" next if item.element_set.include?(no_add) data[0].push(item.id) end else for i in 0...@item_kind_element_name.size data[i] = [0] element_id = element_search(@item_kind_element_name[i]) for j in 1...$data_items.size item = $data_items[j] next if item.name == "" next if item.element_set.include?(no_add) if item.element_set.include?(element_id) data[i].push(item.id) end end end end return data end #-------------------------------------------------------------------------- # ? Weapon Database #-------------------------------------------------------------------------- def weapon_book_id_set data = [] no_add = no_add_element if @weapon_kind_element_name.size == 0 data[0] = [0] for i in 1...$data_weapons.size item = $data_weapons[i] next if item.name == "" next if item.element_set.include?(no_add) data[0].push(item.id) end else for i in 0...@weapon_kind_element_name.size data[i] = [0] element_id = element_search(@weapon_kind_element_name[i]) for j in 1...$data_weapons.size item = $data_weapons[j] next if item.name == "" next if item.element_set.include?(no_add) if item.element_set.include?(element_id) data[i].push(item.id) end end end end return data end #-------------------------------------------------------------------------- # ? Armor Database #-------------------------------------------------------------------------- def armor_book_id_set data = [] no_add = no_add_element if @armor_kind_element_name.size == 0 data[0] = [0] for i in 1...$data_armors.size item = $data_armors[i] next if item.name == "" next if item.guard_element_set.include?(no_add) data[0].push(item.id) end else for i in 0...@armor_kind_element_name.size data[i] = [0] element_id = element_search(@armor_kind_element_name[i]) for j in 1...$data_armors.size item = $data_armors[j] next if item.name == "" next if item.guard_element_set.include?(no_add) if item.guard_element_set.include?(element_id) data[i].push(item.id) end end end end return data end end class Window_Base < Window #-------------------------------------------------------------------------- # ? Element Set Up # NOTE: Default RTP elements were used. #-------------------------------------------------------------------------- def draw_attack_element(x, y, element_set) elem_temp = [] for i in element_set elem = $data_system.elements[i] elem_temp.push("Fire") if elem == "Fire" elem_temp.push("Ice") if elem == "Ice" elem_temp.push("Thunder") if elem == "Thunder" elem_temp.push("Water") if elem == "Water" elem_temp.push("Earth") if elem == "Earth" elem_temp.push("Wind") if elem == "Wind" elem_temp.push("Light") if elem == "Light" elem_temp.push("Darkness") if elem == "Darkness" end if elem_temp.size == 0 self.contents.draw_text(x, y, 64, 32, "None") return end ox = 0 for name in elem_temp cx = self.contents.text_size(name).width self.contents.draw_text(x+ox, y, cx, 32, name) ox += cx+8 end end #-------------------------------------------------------------------------- # ? ?????? <---No idea #-------------------------------------------------------------------------- def draw_attack_wp_element(x, y, element_set) elem_temp = [] for i in element_set elem = $data_system.elements[i] elem_temp.push("") if elem == "" elem_temp.push("") if elem == "" elem_temp.push("") if elem == "" elem_temp.push("?") if elem == "?" elem_temp.push("?") if elem == "?" end if elem_temp.size == 0 self.contents.draw_text(x, y, 64, 32, "??") return end ox = 0 for name in elem_temp cx = self.contents.text_size(name).width self.contents.draw_text(x+ox, y, cx, 32, name) ox += cx+8 end end #-------------------------------------------------------------------------- # ? ?????? <-------No idea #-------------------------------------------------------------------------- def draw_attack_weak_element(x, y, element_set) elem_temp = [] for i in element_set elem = $data_system.elements[i] elem_temp.push("") if elem == "" elem_temp.push("") if elem == "" elem_temp.push("") if elem == "" elem_temp.push("") if elem == "" elem_temp.push("") if elem == "" elem_temp.push("") if elem == "" elem_temp.push("") if elem == "" elem_temp.push("") if elem == "" end if elem_temp.size == 0 self.contents.draw_text(x, y, 64, 32, "") return end ox = 0 for name in elem_temp cx = self.contents.text_size(name).width self.contents.draw_text(x+ox, y, cx, 32, name) ox += cx+8 end end #-------------------------------------------------------------------------- # ? States (Status Abnormalities, like Poison, etc.) #-------------------------------------------------------------------------- def draw_attack_add_state(x, y, plus_state_set) state_temp = [] for i in plus_state_set state = $data_states[i] state_temp.push(state.name) if state.name != "" end if state_temp.size == 0 self.contents.draw_text(x, y, 64, 32, "None") return end ox = 0 oy = 0 for name in state_temp cx = self.contents.text_size(name).width if ox + cx + 4 >= self.contents.width - 128 ox = 0 oy += 1 end self.contents.draw_text(x+ox, y+oy*32, cx, 32, name) ox += cx+8 end end #-------------------------------------------------------------------------- # ? ??????? <-------No idea #-------------------------------------------------------------------------- def draw_scope(scope) case scope when 0 return "" when 1 return "???" when 2 return "???" when 3 return "????" when 4 return "????" when 5 return "????" when 6 return "????" when 7 return "???" end end end class Game_Temp attr_accessor :item_book_data alias temp_item_book_data_initialize initialize def initialize temp_item_book_data_initialize @item_book_data = Data_ItemBook.new end end class Game_Party attr_accessor :item_count # ????????(???) attr_accessor :weapon_count # ??????(???) attr_accessor :armor_count # ??????(???) #-------------------------------------------------------------------------- # ? Registers items when you obtain them #-------------------------------------------------------------------------- alias item_book_info_initialize initialize def initialize item_book_info_initialize @item_count = {} @weapon_count = {} @armor_count = {} end alias item_book_gain_item gain_item def gain_item(item_id, n) add_item_count(item_id, 0) if n > 0 item_book_gain_item(item_id, n) end alias item_book_gain_weapon gain_weapon def gain_weapon(item_id, n) add_weapon_count(item_id, 0) if n > 0 item_book_gain_weapon(item_id, n) end alias item_book_gain_armor gain_armor def gain_armor(item_id, n) add_armor_count(item_id, 0) if n > 0 item_book_gain_armor(item_id, n) end def add_item_count(item_id, type = 0) if type == -1 @item_count[item_id] = 0 else @item_count[item_id] = 1 end end def add_weapon_count(weapon_id, type = 0) if type == -1 @weapon_count[weapon_id] = 0 else @weapon_count[weapon_id] = 1 end end def add_armor_count(armor_id, type = 0) if type == -1 @armor_count[armor_id] = 0 else @armor_count[armor_id] = 1 end end #-------------------------------------------------------------------------- # ? ??????????????? #-------------------------------------------------------------------------- def item_book_max kind_data = [] kind_data[0] = $game_temp.item_book_data.item_kind_name kind_data[1] = $game_temp.item_book_data.weapon_kind_name kind_data[2] = $game_temp.item_book_data.armor_kind_name size = 0 for i in 0..2 for kind in kind_data[i] size += item_book_category_max(kind) end end return size end #-------------------------------------------------------------------------- # ? ??????????????? #-------------------------------------------------------------------------- def item_book_now kind_data = [] kind_data[0] = $game_temp.item_book_data.item_kind_name kind_data[1] = $game_temp.item_book_data.weapon_kind_name kind_data[2] = $game_temp.item_book_data.armor_kind_name size = 0 for i in 0..2 for kind in kind_data[i] size += item_book_category_now(kind) end end return size end #-------------------------------------------------------------------------- # ? ????????????? #-------------------------------------------------------------------------- def item_book_complete_percentage i_max = item_book_max.to_f i_now = item_book_now.to_f comp = i_now / i_max * 100 return comp.truncate end #-------------------------------------------------------------------------- # ? ????????????????????? # category:?????? #-------------------------------------------------------------------------- def item_book_category_max(category) kind_data = $game_temp.item_book_data.kind_search(category) case kind_data[0] when 0 id_data = $game_temp.item_book_data.item_id_data.dup when 1 id_data = $game_temp.item_book_data.weapon_id_data.dup when 2 id_data = $game_temp.item_book_data.armor_id_data.dup end index = kind_data[1] size = id_data[index].size - 1 return size end #-------------------------------------------------------------------------- # ? ????????????????????? # category:?????? #-------------------------------------------------------------------------- def item_book_category_now(category) kind_data = $game_temp.item_book_data.kind_search(category) index = kind_data[1] case kind_data[0] when 0 now_item_info = @item_count.keys elename = $game_temp.item_book_data.item_kind_element_name[index] item_set = $data_items when 1 now_item_info = @weapon_count.keys elename = $game_temp.item_book_data.weapon_kind_element_name[index] item_set = $data_weapons when 2 now_item_info = @armor_count.keys elename = $game_temp.item_book_data.armor_kind_element_name[index] item_set = $data_armors end # ???????ID??? no_add = $game_temp.item_book_data.no_add_element element_id = $game_temp.item_book_data.element_search(elename) new_item_info = [] for i in now_item_info item = item_set[i] next if item == nil next if item.name == "" case item when RPG::Item ele_set = item.element_set when RPG::Weapon ele_set = item.element_set when RPG::Armor ele_set = item.guard_element_set end next if ele_set.include?(no_add) if element_id == nil or ele_set.include?(element_id) new_item_info.push(item.id) end end return new_item_info.size end #-------------------------------------------------------------------------- # ? ??????????????????? # category:?????? #-------------------------------------------------------------------------- def item_book_category_complete_percentage(category) i_max = item_book_category_max(category).to_f i_now = item_book_category_now(category).to_f comp = i_now / i_max * 100 end end class Interpreter def item_book_max(category=nil) if category == nil return $game_party.item_book_max else return $game_party.item_book_category_max(category) end end def item_book_now(category=nil) if category == nil return $game_party.item_book_now else return $game_party.item_book_category_now(category) end end def item_book_comp(category=nil) if category == nil return $game_party.item_book_complete_percentage else return $game_party.item_book_category_complete_percentage(category) end end end class Window_ItemBook < Window_Selectable attr_reader :data attr_reader :item_kind attr_reader :item_index #-------------------------------------------------------------------------- # ? ????????? #-------------------------------------------------------------------------- def initialize(index=0) super(0, 64, 640, 416) @column_max = 2 @book_data = $game_temp.item_book_data @data = data_set(index) @data.shift #@data.sort! @item_max = @data.size @item_kind = index self.index = 0 #refresh end def new_data_set(index) @data = data_set(index) @data.shift #@data.sort! @item_max = @data.size end #-------------------------------------------------------------------------- # ? ???????? #-------------------------------------------------------------------------- def data_set(index) kind_row_data = @book_data.kind_search(@book_data.kind_row[index]) @item_kind = kind_row_data[0] @item_index = kind_row_data[1] data = [] case @item_kind when 0 data = @book_data.item_id_data[@item_index].dup when 1 data = @book_data.weapon_id_data[@item_index].dup when 2 data = @book_data.armor_id_data[@item_index].dup end return data end #-------------------------------------------------------------------------- # ? ?????? #-------------------------------------------------------------------------- def show?(kind, id) case kind when 0 if $game_party.item_count[id] == 0 or $game_party.item_count[id] == nil return false else return true end when 1 if $game_party.weapon_count[id] == 0 or $game_party.weapon_count[id] == nil return false else return true end when 2 if $game_party.armor_count[id] == 0 or $game_party.armor_count[id] == nil return false else return true end end end #-------------------------------------------------------------------------- # ? ?????? #-------------------------------------------------------------------------- def item return @data[self.index] end #-------------------------------------------------------------------------- # ? ?????? #-------------------------------------------------------------------------- def refresh if self.contents != nil self.contents.dispose self.contents = nil end #???? 0 ?????????????????????? return if @item_max == 0 self.contents = Bitmap.new(width - 32, row_max * 32) for i in 0...@item_max draw_item(i) end end #-------------------------------------------------------------------------- # ? ????? # index : ???? #-------------------------------------------------------------------------- def draw_item(index) case @item_kind when 0 item = $data_items[@data[index]] id = @book_data.item_id_data[@item_index].index(item.id) when 1 item = $data_weapons[@data[index]] id = @book_data.weapon_id_data[@item_index].index(item.id) when 2 item = $data_armors[@data[index]] id = @book_data.armor_id_data[@item_index].index(item.id) end return if item == nil x = 4 + index % 2 * (288 + 32) y = index / 2 * 32 rect = Rect.new(x, y, self.width / @column_max - 32, 32) self.contents.fill_rect(rect, Color.new(0, 0, 0, 0)) self.contents.font.color = normal_color self.contents.draw_text(x, y, 32, 32, id.to_s) if show?(@item_kind, item.id) bitmap = RPG::Cache.icon(item.icon_name) opacity = 255 self.contents.blt(x+48, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity) self.contents.draw_text(x+48 + 28, y, 212, 32, item.name, 0) else # The "??" are used for the blank spaces. (The spaces of the items you have not obtained yet.) self.contents.draw_text(x+48 + 28, y, 212, 32, "??", 0) return end end end class Window_ItemBook_Info < Window_Selectable #-------------------------------------------------------------------------- # ? ????????? #-------------------------------------------------------------------------- def initialize super(0, 0+64+64, 640, 480-64-64) @book_data = $game_temp.item_book_data self.contents = Bitmap.new(width - 32, height - 32) self.index = -1 end #-------------------------------------------------------------------------- # ? ?????? #-------------------------------------------------------------------------- def refresh(item_id, item_kind, item_index) self.contents.clear self.contents.font.size = 22 case item_kind when 0 draw_item_info(item_id, item_index) when 1 draw_weapon_info(item_id, item_index) when 2 draw_armor_info(item_id, item_index) end end #-------------------------------------------------------------------------- # ? ?????? #-------------------------------------------------------------------------- def draw_item_info(item_id, item_index) item = $data_items[item_id] rect = Rect.new(4, 0, 160, 32) self.contents.fill_rect(rect, Color.new(0, 0, 0, 0)) bitmap = RPG::Cache.icon(item.icon_name) opacity = 255 self.contents.blt(4+48, 0 + 4, bitmap, Rect.new(0, 0, 24, 24), opacity) self.contents.font.color = normal_color id = @book_data.item_id_data[item_index].index(item.id) self.contents.draw_text(4, 0, 32, 32, id.to_s) self.contents.draw_text(4+48 + 28, 0, 212, 32, item.name, 0) self.contents.draw_text(640-128-88-4, 0, 88, 32, item.price.to_s, 2) self.contents.font.color = system_color self.contents.draw_text(640-128, 0, 128, 32, $data_system.words.gold, 0) self.contents.font.color = normal_color @help_window.set_text(item.description) end #-------------------------------------------------------------------------- # ? ???? #-------------------------------------------------------------------------- def draw_weapon_info(item_id, item_index) item = $data_weapons[item_id] rect = Rect.new(4, 0, 160, 32) self.contents.fill_rect(rect, Color.new(0, 0, 0, 0)) bitmap = RPG::Cache.icon(item.icon_name) opacity = 255 self.contents.blt(4+48, 0 + 4, bitmap, Rect.new(0, 0, 24, 24), opacity) self.contents.font.color = normal_color id = @book_data.weapon_id_data[item_index].index(item.id) self.contents.draw_text(4, 0, 32, 32, id.to_s) self.contents.draw_text(4+48 + 28, 0, 212, 32, item.name, 0) self.contents.draw_text(640-128-88-4, 0, 88, 32, item.price.to_s, 2) self.contents.font.color = system_color self.contents.draw_text(640-128, 0, 128, 32, $data_system.words.gold, 0) self.contents.font.color = text_color(2) self.contents.draw_text(4, 32, 48, 32, "ATK", 0) self.contents.font.color = text_color(4) self.contents.draw_text(4+128, 32, 48, 32, "DEF", 0) self.contents.font.color = text_color(6) self.contents.draw_text(4+256, 32, 48, 32, "MDF", 0) self.contents.font.color = normal_color self.contents.draw_text(4+48, 32, 48, 32, item.atk.to_s, 2) self.contents.draw_text(4+48+128, 32, 48, 32, item.pdef.to_s, 2) self.contents.draw_text(4+48+256, 32, 48, 32, item.mdef.to_s, 2) self.contents.font.color = system_color self.contents.draw_text(4, 64, 48, 32, "STR", 0) self.contents.draw_text(4+128, 64, 48, 32, "DEX", 0) self.contents.draw_text(4+256, 64, 48, 32, "SPD", 0) self.contents.draw_text(4+384, 64, 48, 32, "MAT", 0) self.contents.font.color = normal_color self.contents.draw_text(4+48, 64, 48, 32, item.str_plus.to_s, 2) self.contents.draw_text(4+48+128, 64, 48, 32, item.dex_plus.to_s, 2) self.contents.draw_text(4+48+256, 64, 48, 32, item.agi_plus.to_s, 2) self.contents.draw_text(4+48+384, 64, 48, 32, item.int_plus.to_s, 2) self.contents.font.color = system_color self.contents.draw_text(4, 96, 96, 32, "Element Add") # I don't understand Line 815!!! self.contents.draw_text(4, 128, 96, 32, "") self.contents.draw_text(4, 160, 96, 32, "State Add") #self.contents.draw_text(4, 128, 96, 32, "????") self.contents.font.color = normal_color draw_attack_element(4+96+16, 96, item.element_set) draw_attack_weak_element(4+96+16, 128, item.element_set) draw_attack_add_state(4+96+16, 160, item.plus_state_set) #draw_attack_wp_element(4+96+16, 128, item.element_set) @help_window.set_text(item.description) end #-------------------------------------------------------------------------- # ? ???? #-------------------------------------------------------------------------- def draw_armor_info(item_id, item_index) item = $data_armors[item_id] rect = Rect.new(4, 0, 160, 32) self.contents.fill_rect(rect, Color.new(0, 0, 0, 0)) bitmap = RPG::Cache.icon(item.icon_name) opacity = 255 self.contents.blt(4+48, 0 + 4, bitmap, Rect.new(0, 0, 24, 24), opacity) self.contents.font.color = normal_color id = @book_data.armor_id_data[item_index].index(item.id) self.contents.draw_text(4, 0, 32, 32, id.to_s) self.contents.draw_text(4+48 + 28, 0, 212, 32, item.name, 0) self.contents.draw_text(640-128-88-4, 0, 88, 32, item.price.to_s, 2) self.contents.font.color = system_color self.contents.draw_text(640-128, 0, 128, 32, $data_system.words.gold, 0) self.contents.font.color = text_color(4) self.contents.draw_text(4, 32, 48, 32, "DEF", 0) self.contents.font.color = text_color(6) self.contents.draw_text(4+128, 32, 48, 32, "MDF", 0) self.contents.font.color = system_color self.contents.draw_text(4+256, 32, 48, 32, "EVA", 0) self.contents.font.color = normal_color self.contents.draw_text(4+48, 32, 48, 32, item.pdef.to_s, 2) self.contents.draw_text(4+48+128, 32, 48, 32, item.mdef.to_s, 2) self.contents.draw_text(4+48+256, 32, 48, 32, item.eva.to_s, 2) self.contents.font.color = system_color self.contents.draw_text(4, 64, 48, 32, "STR", 0) self.contents.draw_text(4+128, 64, 48, 32, "DEX", 0) self.contents.draw_text(4+256, 64, 48, 32, "SPD", 0) self.contents.draw_text(4+384, 64, 48, 32, "MAT", 0) self.contents.font.color = normal_color self.contents.draw_text(4+48, 64, 48, 32, item.str_plus.to_s, 2) self.contents.draw_text(4+48+128, 64, 48, 32, item.dex_plus.to_s, 2) self.contents.draw_text(4+48+256, 64, 48, 32, item.agi_plus.to_s, 2) self.contents.draw_text(4+48+384, 64, 48, 32, item.int_plus.to_s, 2) self.contents.font.color = system_color self.contents.draw_text(4, 96, 96, 32, "Element Guard") # I don't understand line 868!!! self.contents.draw_text(4, 128, 96, 32, "") self.contents.draw_text(4, 160, 96, 32, "State Guard") #self.contents.draw_text(4, 128, 96, 32, "????") self.contents.font.color = normal_color draw_attack_element(4+96+16, 96, item.guard_element_set) draw_attack_weak_element(4+96+16, 128, item.guard_element_set) draw_attack_add_state(4+96+16, 160, item.guard_state_set) #draw_attack_wp_element(4+96+16, 128, item.guard_element_set) @help_window.set_text(item.description) end #-------------------------------------------------------------------------- # ? ????????? #-------------------------------------------------------------------------- def update_help #??? end end class Scene_ItemBook include Item_Book_Config #-------------------------------------------------------------------------- # ? ????? #-------------------------------------------------------------------------- def main # ???????? @title_window = Window_Base.new(0, 0, 640, 64) @title_window.contents = Bitmap.new(640 - 32, 64 - 32) # Your book's title. @title_window.contents.draw_text(4, 0, 320, 32, "Item Book", 0) draw_comp @main_window = Window_ItemBook.new @main_window.active = false @main_window.index = -1 @help_window = Window_Help.new @help_window.z = 110 @help_window.y = 64 @help_window.visible = false command = $game_temp.item_book_data.kind_row @kind_window = Window_Command.new(160, command) @kind_window.z = 110 @kind_window.x = 320 - @kind_window.width / 2 @kind_window.y = 240 - @kind_window.height / 2 @kind_window.active = true # ???????????? (?????????????) @info_window = Window_ItemBook_Info.new @info_window.z = 110 @info_window.visible = false @info_window.active = false # ????????????? @info_window.help_window = @help_window @visible_index = 0 @now_kind = nil # ????????? Graphics.transition # ?????? loop do # ???????? Graphics.update # ??????? Input.update # ?????? update # ???????????????? if $scene != self break end end # ????????? Graphics.freeze # ???????? @title_window.dispose @help_window.dispose @main_window.dispose @kind_window.dispose @info_window.dispose end #-------------------------------------------------------------------------- # ? ?????? #-------------------------------------------------------------------------- def update # ???????? #@help_window.update @main_window.update @kind_window.update @info_window.update if @info_window.active update_info return end # ?????????????????: update_target ??? if @main_window.active update_main return end # ????????????????: update_kind ??? if @kind_window.active update_kind return end end #-------------------------------------------------------------------------- # ? ?????? (????????????????) #-------------------------------------------------------------------------- def update_kind # C ?????????? if Input.trigger?(Input::C) # ?? SE ??? $game_system.se_play($data_system.decision_se) if @now_kind != @kind_window.index @main_window.new_data_set(@kind_window.index) @main_window.refresh @now_kind = @kind_window.index end subtitle = $game_temp.item_book_data.kind_row[@kind_window.index] # This is, when you enter a sub-menu. (for example Armors). Armors is the subtitle, so you # write a text to go before Armors. The default said "Item Book:" that way it would look this # way when you scroll through the Armor Section..."Item Book: Armors." title = ""+subtitle @title_window.contents.clear @title_window.contents = Bitmap.new(640 - 32, 64 - 32) @title_window.contents.draw_text(4, 0, 320, 32, title, 0) draw_comp(subtitle) @kind_window.active = false @kind_window.visible = false @main_window.active = true @main_window.index = 0 return end # B ?????????? if Input.trigger?(Input::B) # ????? SE ??? $game_system.se_play($data_system.cancel_se) $scene = Scene_Map.new return end end #-------------------------------------------------------------------------- # ? ?????? (?????????????????) #-------------------------------------------------------------------------- def update_main # B ?????????? if Input.trigger?(Input::B) # ????? SE ??? $game_system.se_play($data_system.cancel_se) @main_window.active = false @kind_window.active = true @kind_window.visible = true @main_window.index = -1 @title_window.contents.clear @title_window.contents = Bitmap.new(640 - 32, 64 - 32) @title_window.contents.draw_text(4, 0, 320, 32, "??????", 0) draw_comp return end # C ?????????? if Input.trigger?(Input::C) if @main_window.item == nil or @main_window.show?(@main_window.item_kind, @main_window.item) == false # ??? SE ??? $game_system.se_play($data_system.buzzer_se) return end # ?? SE ??? $game_system.se_play($data_system.decision_se) @main_window.active = false @info_window.active = true @info_window.visible = true @visible_index = @main_window.index @info_window.refresh(@main_window.item, @main_window.item_kind, @main_window.item_index) return end end #-------------------------------------------------------------------------- # ? ?????? (??????????????????) #-------------------------------------------------------------------------- def update_info # B ?????????? if Input.trigger?(Input::B) # ????? SE ??? $game_system.se_play($data_system.cancel_se) @main_window.active = true @info_window.active = false @info_window.visible = false @help_window.visible = false return end # C ?????????? if Input.trigger?(Input::C) # ?? SE ??? $game_system.se_play($data_system.decision_se) return end if Input.trigger?(Input::L) # ?? SE ??? $game_system.se_play($data_system.decision_se) loop_end = false while loop_end == false if @visible_index != 0 @visible_index -= 1 else @visible_index = @main_window.data.size - 1 end loop_end = true if @main_window.show?(@main_window.item_kind,@main_window.data[@visible_index]) end id = @main_window.data[@visible_index] @info_window.refresh(id, @main_window.item_kind, @main_window.item_index) return end if Input.trigger?(Input::R) # ?? SE ??? $game_system.se_play($data_system.decision_se) loop_end = false while loop_end == false if @visible_index != @main_window.data.size - 1 @visible_index += 1 else @visible_index = 0 end loop_end = true if @main_window.show?(@main_window.item_kind,@main_window.data[@visible_index]) end id = @main_window.data[@visible_index] @info_window.refresh(id, @main_window.item_kind, @main_window.item_index) return end end def draw_comp(category=nil) if SHOW_COMPLETE_TYPE != 0 if category == nil case SHOW_COMPLETE_TYPE when 1 i_now = $game_party.item_book_now i_max = $game_party.item_book_max text = i_now.to_s + "/" + i_max.to_s when 2 comp = $game_party.item_book_complete_percentage text = comp.to_s + "%" when 3 i_now = $game_party.item_book_now i_max = $game_party.item_book_max comp = $game_party.item_book_complete_percentage text = i_now.to_s + "/" + i_max.to_s + " " + comp.to_s + "%" end else case SHOW_COMPLETE_TYPE when 1 i_now = $game_party.item_book_category_now(category) i_max = $game_party.item_book_category_max(category) text = i_now.to_s + "/" + i_max.to_s when 2 comp = $game_party.item_book_category_complete_percentage(category) text = comp.to_s + "%" when 3 i_now = $game_party.item_book_category_now(category) i_max = $game_party.item_book_category_max(category) comp = $game_party.item_book_category_complete_percentage(category) text = i_now.to_s + "/" + i_max.to_s + " " + comp.to_s + "%" end end if text != nil @title_window.contents.draw_text(320, 0, 288, 32, text, 2) end end end end Scripts; Updated; Scripts Demo Added - Geowil - 02-17-2010 Momomomo's Skill Book (Translated by Mcdohl): Instructions: Installation: Create a new class above "Main" and place the spoiler code into it. Usage: First off, go to your Database in your game after you get this script in and go to the system tab. In the bottom left hand corner in the element/attribute tab, add new slots. Now, the stuff in these lines: Quote:# Name the skill categories. Is what you put in those new elements/attributes you just made. Note that I have customized this to my needs, if you want to get rid of the stuff you don't want just delete all instances of each out of those lines above that are in the script. You new ones in the same way as well. Now, go to the skills tab, and go to the 'Fire' spell. Now, check the Elemental element/attribute to place this spell into the Elemental section of the skill book. Then just do the same for the rest of the skills by selecting to proper element/attribute for them. Now, to call this script from the main menu or from a call script, use this: Quote: $scene = Scene_SkillBook.new Skill Book Script
#================================= # Item_Book by momomomo? # http://f53.aaa.livedoor.jp/%7Emomomo/source/skillbook_source.html #---------------------------------------------------------------- #-Translated by Mcdohl #---------------------------------------------------------------- #================================ # English is not my main language, so I'm sorry if you can't understand some of my comments. # 11.18.2005 # Script translated, known bugs: # -Doesn't seem to work with some custom-skill learning scripts. # This script will add all the skills you learn throughout the game into a "Book." # In this book you can see the stats, MP cost, element and states of each skill. module Skill_Book_Config # The following line (SHOW_COMPLETE_TYPE =) is very important. It will define how are # the items counted. (The item count appears on the upper right corner, in the help window. # Use "0" to display nothing. # Use "1" to display it in a "items found so far/total" format. # Use "2" to use percentage completion. # Use "3" for...a weird item counting method... SHOW_COMPLETE_TYPE = 3 DRAW_POW_ZERO = false ZERO_POW_TEXT = "" end class Window_SkillBook_Info < Window_Selectable include Skill_Book_Config end class Data_SkillBook attr_reader :skill_kind_name attr_reader :kind_row attr_reader :skill_id_data attr_reader :skill_kind_element_name #-------------------------------------------------------------------------- # ? Setup #-------------------------------------------------------------------------- def initialize # Name the skill categories. @skill_kind_name = ["Physical", "Elemental", "Non-Elemental", "Curative", "Status"] # Next is the menu setup. It's a vertical list. List the categories in any order you want. # Note: The categories below must coincide with the categories you listed above. @kind_row = ["Physical", "Elemental", "Non-Elemental", "Curative", "Status"] # Now write the element setups.You need to add elements in the Database (in the System Tab). For # example, if you want to use a "Physical" category, go make an element called "Physical" and # then apply it to all the skills you want them to appear under the Physical category! @skill_kind_element_name = ["Physical", "Elemental", "Curative", "Status", "Non-Elemental"] @skill_id_data = skill_book_id_set end #-------------------------------------------------------------------------- # ? Defining Kinds #-------------------------------------------------------------------------- def kind_search(name) if @skill_kind_name.include?(name) return [0, @skill_kind_name.index(name)] end end #-------------------------------------------------------------------------- # ? ??????????? #-------------------------------------------------------------------------- def no_add_element no_add = 0 # ???????ID??? for i in 1...$data_system.elements.size if $data_system.elements[i] =~ /??????/ no_add = i break end end return no_add end #-------------------------------------------------------------------------- # ? ?????????ID??? #-------------------------------------------------------------------------- def element_search(element_name) return nil if element_name == nil for i in 1...$data_system.elements.size if $data_system.elements[i] =~ /^#{element_name}/ return i end end end #-------------------------------------------------------------------------- # ? ??????ID?? #-------------------------------------------------------------------------- def skill_book_id_set data = [] no_add = no_add_element if @skill_kind_element_name.size == 0 data[0] = [0] for i in 1...$data_skills.size skill = $data_skills[i] next if skill.name == "" next if skill.element_set.include?(no_add) data[0].push(skill.id) end else for i in 0...@skill_kind_element_name.size data[i] = [0] element_id = element_search(@skill_kind_element_name[i]) for j in 1...$data_skills.size skill = $data_skills[j] next if skill.name == "" next if skill.element_set.include?(no_add) if skill.element_set.include?(element_id) data[i].push(skill.id) end end end end return data end end class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # ? ??????? # skill_id : ??? ID # This seems to be how the script detects a new skill, this may be the key to making it compatible # with custom-learning skills scripts, not sure tho. #-------------------------------------------------------------------------- alias game_actor_skill_book_learn_skill learn_skill def learn_skill(skill_id) game_actor_skill_book_learn_skill(skill_id) $game_system.add_skill_count(skill_id) end end class Window_Base < Window #-------------------------------------------------------------------------- # ? Element Set Up # NOTE: Default RTP elements were used. #-------------------------------------------------------------------------- def draw_attack_element(x, y, element_set) elem_temp = [] for i in element_set elem = $data_system.elements[i] elem_temp.push("Fire") if elem == "Fire" elem_temp.push("Ice") if elem == "Ice" elem_temp.push("Thunder") if elem == "Thunder" elem_temp.push("Water") if elem == "Water" elem_temp.push("Earth") if elem == "Earth" elem_temp.push("Wind") if elem == "Wind" elem_temp.push("Light") if elem == "Light" elem_temp.push("Darkness") if elem == "Darkness" end if elem_temp.size == 0 self.contents.draw_text(x, y, 64, 32, "None") return end ox = 0 for name in elem_temp cx = self.contents.text_size(name).width self.contents.draw_text(x+ox, y, cx, 32, name) ox += cx+8 end end #-------------------------------------------------------------------------- # ? ?????? #-------------------------------------------------------------------------- def draw_attack_wp_element(x, y, element_set) elem_temp = [] for i in element_set elem = $data_system.elements[i] elem_temp.push("?") if elem == "?" elem_temp.push("?") if elem == "?" elem_temp.push("?") if elem == "?" elem_temp.push("?") if elem == "?" elem_temp.push("?") if elem == "?" end if elem_temp.size == 0 self.contents.draw_text(x, y, 64, 32, "??") return end ox = 0 for name in elem_temp cx = self.contents.text_size(name).width self.contents.draw_text(x+ox, y, cx, 32, name) ox += cx+8 end end #-------------------------------------------------------------------------- # ? ?????? #-------------------------------------------------------------------------- def draw_attack_weak_element(x, y, element_set) elem_temp = [] for i in element_set elem = $data_system.elements[i] elem_temp.push("??") if elem == "? ??" elem_temp.push("?") if elem == "? ?" elem_temp.push("??") if elem == "? ??" elem_temp.push("?") if elem == "? ?" elem_temp.push("?") if elem == "? ?" elem_temp.push("?") if elem == "? ?" elem_temp.push("??") if elem == "? ??" elem_temp.push("??") if elem == "? ??" end if elem_temp.size == 0 self.contents.draw_text(x, y, 64, 32, "??") return end ox = 0 for name in elem_temp cx = self.contents.text_size(name).width self.contents.draw_text(x+ox, y, cx, 32, name) ox += cx+8 end end #-------------------------------------------------------------------------- # ? States (Status Abnormalities like Poison, Sleep, etc.) #-------------------------------------------------------------------------- def draw_attack_add_state(x, y, plus_state_set) state_temp = [] for i in plus_state_set state = $data_states[i] state_temp.push(state.name) if state.name != "" end if state_temp.size == 0 self.contents.draw_text(x, y, 64, 32, "None") return end ox = 0 oy = 0 for name in state_temp cx = self.contents.text_size(name).width if ox + cx + 4 >= self.contents.width - 128 ox = 0 oy += 1 end self.contents.draw_text(x+ox, y+oy*32, cx, 32, name) ox += cx+8 end end #-------------------------------------------------------------------------- # ? ??????? #-------------------------------------------------------------------------- def draw_scope(scope) case scope when 0 return "" when 1 return "" when 2 return "" when 3 return "" when 4 return "" when 5 return "" when 6 return "" when 7 return "" end end end class Game_Temp attr_accessor :skill_book_data alias temp_skill_book_data_initialize initialize def initialize temp_skill_book_data_initialize @skill_book_data = Data_SkillBook.new end end class Game_System attr_accessor :skill_count # ???????(???) #-------------------------------------------------------------------------- # ? ????????? #-------------------------------------------------------------------------- alias game_system_skill_book_initialize initialize def initialize game_system_skill_book_initialize @skill_count = {} end #-------------------------------------------------------------------------- # ? ???????????(???) # 0:??? 1:??? #-------------------------------------------------------------------------- def add_skill_count(skill_id, type=0) if type == -1 @skill_count[skill_id] = 0 else @skill_count[skill_id] = 1 end end #-------------------------------------------------------------------------- # ? ?????????????? #-------------------------------------------------------------------------- def skill_book_max kind_data = $game_temp.skill_book_data.skill_kind_name size = 0 for kind in kind_data size += skill_book_category_max(kind) end return size end #-------------------------------------------------------------------------- # ? ?????????????? #-------------------------------------------------------------------------- def skill_book_now kind_data = $game_temp.skill_book_data.skill_kind_name size = 0 for kind in kind_data size += skill_book_category_now(kind) end return size end #-------------------------------------------------------------------------- # ? ???????????? #-------------------------------------------------------------------------- def skill_book_complete_percentage s_max = skill_book_max.to_f s_now = skill_book_now.to_f comp = s_now / s_max * 100 return comp.truncate end #-------------------------------------------------------------------------- # ? ???????????????????? # category:?????? #-------------------------------------------------------------------------- def skill_book_category_max(category) id_data = $game_temp.skill_book_data.skill_id_data.dup index = $game_temp.skill_book_data.kind_search(category)[1] size = id_data[index].size - 1 return size end #-------------------------------------------------------------------------- # ? ???????????????????? # category:?????? #-------------------------------------------------------------------------- def skill_book_category_now(category) now_skill_info = @skill_count.keys index = $game_temp.skill_book_data.kind_search(category)[1] # ???????ID??? no_add = $game_temp.skill_book_data.no_add_element elename = $game_temp.skill_book_data.skill_kind_element_name[index] element_id = $game_temp.skill_book_data.element_search(elename) new_skill_info = [] for i in now_skill_info skill = $data_skills[i] next if skill == nil next if skill.name == "" next if skill.element_set.include?(no_add) if element_id == nil or skill.element_set.include?(element_id) new_skill_info.push(skill.id) end end return new_skill_info.size end #-------------------------------------------------------------------------- # ? ?????????????????? # category:?????? #-------------------------------------------------------------------------- def skill_book_category_complete_percentage(category) s_max = skill_book_category_max(category).to_f s_now = skill_book_category_now(category).to_f comp = s_now / s_max * 100 end end class Interpreter def skill_book_max(category=nil) if category == nil return $game_system.skill_book_max else return $game_system.skill_book_category_max(category) end end def skill_book_now(category=nil) if category == nil return $game_system.skill_book_now else return $game_system.skill_book_category_now(category) end end def skill_book_comp(category=nil) if category == nil return $game_system.skill_book_complete_percentage else return $game_system.skill_book_category_complete_percentage(category) end end end class Window_SkillBook < Window_Selectable attr_reader :data attr_reader :item_kind attr_reader :item_index #-------------------------------------------------------------------------- # ? ????????? #-------------------------------------------------------------------------- def initialize(index=0) super(0, 64, 640, 416) @column_max = 2 @book_data = $game_temp.skill_book_data @data = data_set(index) @data.shift #@data.sort! @item_max = @data.size @item_kind = index self.index = 0 #refresh end def new_data_set(index) @data = data_set(index) @data.shift #@data.sort! @item_max = @data.size end #-------------------------------------------------------------------------- # ? ???????? #-------------------------------------------------------------------------- def data_set(index) kind_row_data = @book_data.kind_search(@book_data.kind_row[index]) @item_kind = kind_row_data[0] @item_index = kind_row_data[1] data = [] case @item_kind when 0 data = @book_data.skill_id_data[@item_index].dup end return data end #-------------------------------------------------------------------------- # ? ?????? #-------------------------------------------------------------------------- def show?(kind, id) case kind when 0 if $game_system.skill_count[id] == 0 or $game_system.skill_count[id] == nil return false else return true end end end #-------------------------------------------------------------------------- # ? ?????? #-------------------------------------------------------------------------- def item return @data[self.index] end #-------------------------------------------------------------------------- # ? ?????? #-------------------------------------------------------------------------- def refresh if self.contents != nil self.contents.dispose self.contents = nil end #???? 0 ?????????????????????? return if @item_max == 0 self.contents = Bitmap.new(width - 32, row_max * 32) for i in 0...@item_max draw_item(i) end end #-------------------------------------------------------------------------- # ? ????? # index : ???? #-------------------------------------------------------------------------- def draw_item(index) case @item_kind when 0 item = $data_skills[@data[index]] id = @book_data.skill_id_data[@item_index].index(item.id) end return if item == nil x = 4 + index % 2 * (288 + 32) y = index / 2 * 32 rect = Rect.new(x, y, self.width / @column_max - 32, 32) self.contents.fill_rect(rect, Color.new(0, 0, 0, 0)) self.contents.font.color = normal_color self.contents.draw_text(x, y, 32, 32, id.to_s) if show?(@item_kind, item.id) bitmap = RPG::Cache.icon(item.icon_name) opacity = 255 self.contents.blt(x+48, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity) self.contents.draw_text(x+48 + 28, y, 212, 32, item.name, 0) else # The "??" are used in blank spaces. (the skills you haven't learned yet) self.contents.draw_text(x+48 + 28, y, 212, 32, "??", 0) return end end end class Window_SkillBook_Info < Window_Selectable #-------------------------------------------------------------------------- # ? ????????? #-------------------------------------------------------------------------- def initialize super(0, 0+64+64, 640, 480-64-64) @book_data = $game_temp.skill_book_data self.contents = Bitmap.new(width - 32, height - 32) self.index = -1 end #-------------------------------------------------------------------------- # ? ?????? #-------------------------------------------------------------------------- def refresh(item_id, item_kind, item_index) self.contents.clear self.contents.font.size = 22 case item_kind when 0 draw_skill_info(item_id, item_index) end end #-------------------------------------------------------------------------- # ? ????? #-------------------------------------------------------------------------- def draw_skill_info(item_id, item_index) item = $data_skills[item_id] rect = Rect.new(4, 0, 160, 32) self.contents.fill_rect(rect, Color.new(0, 0, 0, 0)) bitmap = RPG::Cache.icon(item.icon_name) opacity = 255 self.contents.blt(4+48, 0 + 4, bitmap, Rect.new(0, 0, 24, 24), opacity) self.contents.font.color = normal_color id = @book_data.skill_id_data[item_index].index(item.id) self.contents.draw_text(4, 0, 32, 32, id.to_s) self.contents.draw_text(4+48 + 28, 0, 212, 32, item.name, 0) cost = item.sp_cost.to_s # Change "MP" to whatever you want. Like "SP" for example, or just leave it in MP. self.contents.draw_text(4+20 + 28 + 232, 0, 48, 32, "MP:", 2) self.contents.draw_text(4+48 + 28 + 232, 0, 48, 32, cost.to_s, 2) #skill_kind = skill_kind_name(item.element_set) #self.contents.draw_text(320+96, 0, 160, 32, skill_kind, 0) self.contents.font.color = text_color(2) self.contents.draw_text(4, 32, 48, 32, "DMG", 0) self.contents.font.color = normal_color if item.power == 0 and DRAW_POW_ZERO == false pow = ZERO_POW_TEXT else pow = item.power.to_s end self.contents.draw_text(4+48, 32, 48, 32, pow, 2) self.contents.font.color = system_color self.contents.draw_text(4, 64, 48, 32, "", 0) self.contents.font.color = normal_color self.contents.draw_text(4+96+16, 64, 128, 32, draw_scope(item.scope), 0) self.contents.font.color = system_color self.contents.draw_text(4, 96, 96, 32, "Element") self.contents.draw_text(4, 128, 96, 32, "") self.contents.draw_text(4, 160, 96, 32, "State") self.contents.font.color = normal_color draw_attack_element(4+96+16, 96, item.element_set) draw_attack_weak_element(4+96+16, 128, item.element_set) draw_attack_add_state(4+96+16, 160, item.plus_state_set) @help_window.set_text(item.description) end #-------------------------------------------------------------------------- # ? ????????? #-------------------------------------------------------------------------- def update_help #??? end end class Scene_SkillBook include Skill_Book_Config #-------------------------------------------------------------------------- # ? ????? #-------------------------------------------------------------------------- def main # ???????? @title_window = Window_Base.new(0, 0, 640, 64) @title_window.contents = Bitmap.new(640 - 32, 64 - 32) @title_window.contents.draw_text(4, 0, 320, 32, "Skill Book", 0) draw_comp @main_window = Window_SkillBook.new @main_window.active = false @main_window.index = -1 @help_window = Window_Help.new @help_window.z = 110 @help_window.y = 64 @help_window.visible = false command = $game_temp.skill_book_data.kind_row @kind_window = Window_Command.new(160, command) @kind_window.z = 110 @kind_window.x = 320 - @kind_window.width / 2 @kind_window.y = 240 - @kind_window.height / 2 @kind_window.active = true # ???????????? (?????????????) @info_window = Window_SkillBook_Info.new @info_window.z = 110 @info_window.visible = false @info_window.active = false # ????????????? @info_window.help_window = @help_window @visible_index = 0 @now_kind = nil # ????????? Graphics.transition # ?????? loop do # ???????? Graphics.update # ??????? Input.update # ?????? update # ???????????????? if $scene != self break end end # ????????? Graphics.freeze # ???????? @title_window.dispose @help_window.dispose @main_window.dispose @kind_window.dispose @info_window.dispose end #-------------------------------------------------------------------------- # ? ?????? #-------------------------------------------------------------------------- def update # ???????? #@help_window.update @main_window.update @kind_window.update @info_window.update if @info_window.active update_info return end # ?????????????????: update_target ??? if @main_window.active update_main return end # ????????????????: update_kind ??? if @kind_window.active update_kind return end end #-------------------------------------------------------------------------- # ? ?????? (????????????????) #-------------------------------------------------------------------------- def update_kind # C ?????????? if Input.trigger?(Input::C) # ?? SE ??? $game_system.se_play($data_system.decision_se) if @now_kind != @kind_window.index @main_window.new_data_set(@kind_window.index) @main_window.refresh @now_kind = @kind_window.index end subtitle = $game_temp.skill_book_data.kind_row[@kind_window.index] # This is, when you enter a sub-menu. (for example Physical). Physical is the subtitle, so you # write a text to go before Armors. The default said "Skill Book:" that way it would look this # way when you scroll through the Physical Section..."Skill Book: Physical." title = ""+subtitle @title_window.contents.clear @title_window.contents = Bitmap.new(640 - 32, 64 - 32) @title_window.contents.draw_text(4, 0, 320, 32, title, 0) draw_comp(subtitle) @kind_window.active = false @kind_window.visible = false @main_window.active = true @main_window.index = 0 return end # B ?????????? if Input.trigger?(Input::B) # ????? SE ??? $game_system.se_play($data_system.cancel_se) $scene = Scene_Map.new return end end #-------------------------------------------------------------------------- # ? ?????? (?????????????????) #-------------------------------------------------------------------------- def update_main # B ?????????? if Input.trigger?(Input::B) # ????? SE ??? $game_system.se_play($data_system.cancel_se) @main_window.active = false @kind_window.active = true @kind_window.visible = true @main_window.index = -1 @title_window.contents.clear @title_window.contents = Bitmap.new(640 - 32, 64 - 32) @title_window.contents.draw_text(4, 0, 320, 32, "Skill Book", 0) draw_comp return end # C ?????????? if Input.trigger?(Input::C) if @main_window.item == nil or @main_window.show?(@main_window.item_kind, @main_window.item) == false # ??? SE ??? $game_system.se_play($data_system.buzzer_se) return end # ?? SE ??? $game_system.se_play($data_system.decision_se) @main_window.active = false @info_window.active = true @info_window.visible = true @visible_index = @main_window.index @info_window.refresh(@main_window.item, @main_window.item_kind, @main_window.item_index) return end end #-------------------------------------------------------------------------- # ? ?????? (??????????????????) #-------------------------------------------------------------------------- def update_info # B ?????????? if Input.trigger?(Input::B) # ????? SE ??? $game_system.se_play($data_system.cancel_se) @main_window.active = true @info_window.active = false @info_window.visible = false @help_window.visible = false return end # C ?????????? if Input.trigger?(Input::C) # ?? SE ??? $game_system.se_play($data_system.decision_se) return end if Input.trigger?(Input::L) # ?? SE ??? $game_system.se_play($data_system.decision_se) loop_end = false while loop_end == false if @visible_index != 0 @visible_index -= 1 else @visible_index = @main_window.data.size - 1 end loop_end = true if @main_window.show?(@main_window.item_kind,@main_window.data[@visible_index]) end id = @main_window.data[@visible_index] @info_window.refresh(id, @main_window.item_kind, @main_window.item_index) return end if Input.trigger?(Input::R) # ?? SE ??? $game_system.se_play($data_system.decision_se) loop_end = false while loop_end == false if @visible_index != @main_window.data.size - 1 @visible_index += 1 else @visible_index = 0 end loop_end = true if @main_window.show?(@main_window.item_kind,@main_window.data[@visible_index]) end id = @main_window.data[@visible_index] @info_window.refresh(id, @main_window.item_kind, @main_window.item_index) return end end def draw_comp(category=nil) if SHOW_COMPLETE_TYPE != 0 if category == nil case SHOW_COMPLETE_TYPE when 1 s_now = $game_system.skill_book_now s_max = $game_system.skill_book_max text = s_now.to_s + "/" + s_max.to_s when 2 comp = $game_system.skill_book_complete_percentage text = comp.to_s + "%" when 3 s_now = $game_system.skill_book_now s_max = $game_system.skill_book_max comp = $game_system.skill_book_complete_percentage text = s_now.to_s + "/" + s_max.to_s + " " + comp.to_s + "%" end else case SHOW_COMPLETE_TYPE when 1 s_now = $game_system.skill_book_category_now(category) s_max = $game_system.skill_book_category_max(category) text = s_now.to_s + "/" + s_max.to_s when 2 comp = $game_system.skill_book_category_complete_percentage(category) text = comp.to_s + "%" when 3 s_now = $game_system.skill_book_category_now(category) s_max = $game_system.skill_book_category_max(category) comp = $game_system.skill_book_category_complete_percentage(category) text = s_now.to_s + "/" + s_max.to_s + " " + comp.to_s + "%" end end if text != nil @title_window.contents.draw_text(320, 0, 288, 32, text, 2) end end end end Wachuga's Maze Generator: **BEFORE YOU PUT THIS IN, BE SURE TO PUT NEAR FANTASTICA'S DYNAMIC MAPS SCRIPT IN YOUR GAME!!!** Instructions: Installation: This script has a lot of components to it, so I formatted it slightly differently then my other scripts as far as in the class browser goes. I made an empty class and called it Maze Generator then under that I made a new empty class called ----------------------. This is because there are four classes to this script, it organizes it a bit to do it like that. Quote:Maze Generator I will list installation instructions along side the spoiler tags this time around. Usage: Now in order to use this you must place <rand> in the map name but there are other things as well. First of all these maps can be saved by putting <save> in the name before <rand>. Now, if you want to control the randomness of the maze (this only does mazes for now, but Wachunga is now working on a full map generator) you have 3 options. the first <#> after <rand> controls the chances of curves and twists. the second <#> after <rand> decreases the number of dead ends. And the last <#> after <rand> increases the chance that dead ends will connect to another pathway. Examples: Quote:My Map <rand> Each time you enter or exit a map that doesnt have <save> in it, it will change, so keep that in mind, also, you must place <start> in an event (I put it in the teleport) name where the begging of the maze is, carful though, the entrance and exits have to be in certain areas, otherwise your going to get a warning message when you try to enter it. Same thing with the exit, put <end> in an event name where you want the end to be at (again, I would put it in the teleport). Make a new one called Game_Map*** and put this in it: Game_Map***
=begin ====================== Random Map Generator - version 0.51 ====================== by Wachunga, based on Jamis Buck's D&D dungeon generator ============== Instructions ============== To indicate a map is to be randomly generated, include <rand> in its name. You may also optionally specify custom randomness, sparsity and dead end removal parameters to guide how the map is generated (see comments within for more details). These may also be included in the map name, as in this example: "XYZ <rand><0.8><5><0.8>" (from left to right, randomness, sparsity and deadend removal in that order). Finally, the optional parameter <save> may immediately follow <rand> to indicate that the map should be generated randomly the first time but then saved and remain the same thereafter instead of randomizing again. Events are not erased on the map which will be randomly generated, but there is no way to guarantee they'll be positioned correctly. (The only exceptions to this are two events which determine the start and end of the maze.) Place an event named <start> to specify a location you'd like the player to begin the maze (else a default is chosen). To avoid appearing inside a wall, the start location should not be at any of the four corners of the map nor any tile where x is even or y is odd (exceptions occur along an edge of the map, i.e. when x=0, x=width-1, y=0 or y=height-1). The diagram below may clarify, where discouraged starting points are marked with an X: y\x 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 0 X X X X X X X X X X X 1 X X X X X X X X X X X X X X X X X X X X 2 X X X X X X X X X 3 X X X X X X X X X X X X X X X X X X X X 4 X X X X X X X X X 5 X X X X X X X X X X X X X X X X X X X X 6 X X X X X X X X X 7 X X X X X X X X X X X X X X X X X X X X 8 X X X X X X X X X 9 X X X X X X X X X X X X X X X X X X X X 10 X X X X X X X X X 11 X X X X X X X X X X X X X X X X X X X X 12 X X X X X X X X X 13 X X X X X X X X X X X X X X X X X X X X 14 X X X X X X X X X X X (These restrictions are unfortunate, but necessary. Note as well that if you're not using a wall face then y SHOULD BE even. Either way, you should get a warning message if you've placed a start/end incorrectly.) If you want there to be a passage leading off the map, the start location must be placed on an edge (i.e. x=0, y=0, x=width-1 or y=height-1). Alternatively, the start and/or exit locations can be somewhere in the interior of the map... in this case the player arrives/exits by magic, falling, climbing, etc. All the above also applies for the exit location, except the event is named <end>. Again, a default end is chosen if one is not supplied. Of course, if the player is to be able to exit the map from either of these two points, you must make the event teleport appropriately. Also, the teleport into the maze should point at same square as the <start> event, or else you may get stuck in a wall. You can specify which tiles to use for the floor, walls, etc in the Maze class (just add an appropriate 'elsif'). Questions and feedback should be directed to the thread in the "User-Submitted RGSS Scripts" forum at http://www.rmxp.net/forums =end $save_map_list = [] class Game_Map alias old_setup_map setup_map def setup_map(map_id) old_setup_map(map_id) tags = map_name.delete(' ').scan(/<[A-Za-z0-9_.]+>/) # get all the tags if not tags.empty? and tags[0].upcase == '<RAND>' tags.shift # remove the first element if not tags.empty? and tags[0].upcase == '<SAVE>' $save_map_list.push(@map_id) tags.shift end if not tags.empty? for i in 0...tags.length tags[i] = tags[i].delete("<>").to_f end end startX = 0; startY = 2 # default starting position endX = @map.width-1; endY = @map.height-1 # default ending position # note that these defaults haven't yet been tested much for i in @map.events.keys if @map.events[i].name.upcase == '<START>' startX = @map.events[i].x startY = @map.events[i].y elsif @map.events[i].name.upcase == '<END>' endX = @map.events[i].x endY = @map.events[i].y end end # note that *tags will expand the array, passing individual elements # (if any) as arguments (randomness, sparsity and chance to remove deadends) # e.g. if map name includes "<rand><0.5><10><0.6>", then the call is: # maze = Maze.new( @map.width, @map.height, startX, startY, endX, endY, 0.5, 10, 0.6) maze = Maze.new( @map.tileset_id, @map.width, @map.height, startX, startY, endX, endY, *tags) # set these up for teleports into the maze maze.draw end end def data=(newdata) @map.data = newdata end def map_name return load_data("Data/MapInfos.rxdata")[@map_id].name end end Now, under that class make a new one called 'Maze' and put this into it: Maze
class Maze WALL = 0 PASSAGE = 1 attr_reader :width attr_reader :height attr_reader :startX attr_reader :startY attr_reader :endX attr_reader :endY def initialize(pTileset, pWidth, pHeight, pStartX, pStartY, pEndX, pEndY, pRandomness=0.5, pSparsity=3, pRemovalChance=0.5) @tileset = pTileset @width = pWidth @height = pHeight @startX = pStartX @startY = pStartY @endX = pEndX @endY = pEndY # prepare the base matrix @base = Direction_Matrix.new(@width, @height, @startX, @startY, @endX, @endY, pRandomness, pSparsity, pRemovalChance) # reset everything in the Tile module to 0 Tile.floor = 0 Tile.wall = 0 Tile.wallFace = 0 # prepare the tiles depending on the tileset if @tileset == 27 Tile.setFloor(2,1) # 384 Tile.setWall(1,2) # 48-95 Tile.setWallFace(4,2) # 401 elsif @tileset == 51 Tile.setFloor(2,2) # 384 Tile.setWall(2,1) # 385 #elsif @tileset == 'y' # others go here else # nothing specified so just use default Tile.setFloor(2,1) # 384 Tile.setWall(1,2) # 48-95 end # if no wall face is being used, then Y locations should be ODD (opposite of # when using a wall face) if (@startX % 2) == 0 and @startX != 0 and @startX != @width-1 print 'Warning: player may start in a wall (starting X location is even).' end if Tile.wallFace != 0 if (@startY % 2) != 0 and @startY != 0 and @startY != @height-1 print 'Warning: player may start in a wall (starting Y location is odd).' end else if (@startY % 2) == 0 and @startY != 0 and @startY != @height-1 print 'Warning: player may start in a wall (starting Y location is even).' end end if (@endX % 2) == 0 and @endX != 0 and @endX != @width-1 print 'Warning: maze end may be unreachable (X location is even).' end if Tile.wallFace != 0 if (@endY % 2) != 0 and @endY != 0 and @endY != @height-1 print 'Warning: maze end may be unreachable (Y location is odd).' end else if (@endY % 2) == 0 and @endY != 0 and @endY != @height-1 print 'Warning: maze end may be unreachable (Y location is even).' end end # initialized with all walls @matrix = Array.new(@width, WALL) for i in 0...@width @matrix[i] = Array.new(@height, WALL) end setup end =begin Sets up the actual maze from a base matrix of only directions. (Basic algorithm from Jamis Buck's D&D dungeon generator.) =end def setup for x in 0...@base.width for y in 0...@base.height dir = @base.matrix[x][y] if (dir != 0) # not sparsified @matrix[x*2+1][y*2+1] = PASSAGE end if ((dir & Direction_Matrix::NORTH) != 0) @matrix[x*2+1][y*2] = PASSAGE end if ((dir & Direction_Matrix::WEST) != 0) @matrix[x*2][y*2+1] = PASSAGE end # only necessary for right edge start/exit if ((dir & Direction_Matrix::EAST) != 0) @matrix[x*2+2][y*2+1] = PASSAGE # if extra wall is there, need to "dig deeper" if (@width % 2) == 0 and x*2+3 == @width-1 @matrix[x*2+3][y*2+1] = PASSAGE end end # only necessary for bottom edge start/exit if ((dir & Direction_Matrix::SOUTH) != 0) @matrix[x*2+1][y*2+2] = PASSAGE # if extra wall is there, need to "dig deeper" if (@height % 2) == 0 and y*2+3 == @height-1 @matrix[x*2+1][y*2+3] = PASSAGE end end end end end =begin Display the matrix in an ASCII table (useful for debugging). (Much more readable if you're using a monospaced font for dialog boxes.) =end def display char_array = Array.new(@width, 0) for i in 0...@width char_array[i] = Array.new(@height, 0) end for x in 0...@width for y in 0...@height tile = @matrix[x][y] char = ' ' if ((tile == WALL)) then char << '#' end if ((tile == PASSAGE)) then char << ' ' end char_array[y][x] = char end end display = '' for i in 0...@height display << char_array[i].flatten.to_s << "\n" end print display end =begin Draw the maze using the map's tileset. =end def draw newdata = Table.new(@width, @height, 3) # put down the floor on the first layer (z=0) z = 0 for x in 0...@width for y in 0...@height newdata[x,y,z] = Tile.floor end end # now for the walls on the second layer (z=1) z = 1 if Tile.wall.type.to_s.upcase != "HASH" # not autotiles for x in 0...@width for y in 0...@height newdata[x,y,z] = Tile.wall if (@matrix[x][y] == WALL) end end else # autotiles... for x in 0...@width for y in 0...@height # skip passages if (@matrix[x][y] == PASSAGE) then next end # calculate adjacent walls adj = '' if (x == 0) adj << '147' else if (y == 0) then adj << '1' else if (@matrix[x-1][y-1] == WALL) then adj << '1' end end if (@matrix[x-1][y] == WALL) then adj << '4' end if (y == @height-1) then adj << '7' else if (@matrix[x-1][y+1] == WALL) then adj << '7' end end end if (x == @width-1) adj << '369' else if (y == 0) then adj << '3' else if (@matrix[x+1][y-1] == WALL) then adj << '3' end end if (@matrix[x+1][y] == WALL) then adj << '6' end if (y == @height-1) then adj << '9' else if (@matrix[x+1][y+1] == WALL) then adj << '9' end end end if (y == 0) adj << '2' else if (@matrix[x][y-1] == WALL) then adj << '2' end end if (y == @height-1) adj << '8' else if (@matrix[x][y+1] == WALL) then adj << '8' end end # if no adjacent walls, set it as 0 if (adj == '') then adj = '0' end # convert to an array, sort, and then back to a string adj = adj.split(//).sort.join newdata[x,y,z] = eval 'Tile.wall[adj.to_i]' # show single wall tile beneath bottom-facing walls if Tile.wallFace > 0 if not adj.include?('8') newdata[x,y+1,z] = Tile.wallFace end end end # for end # for end # if-else $game_map.data = newdata end # draw method end Under this class make another new one called 'Direction Matrix' and put this into it: Directional Matrix
=begin A matrix whose elements each contains 1-4 directions (north, east, south, west) forming the basis for a maze or dungeon. (Basic algorithms from Jamis Buck's D&D dungeon generator.) =end class Direction_Matrix NORTH = 0b00001 EAST = 0b00010 SOUTH = 0b00100 WEST = 0b01000 ALL_DIRS = NORTH | EAST | SOUTH | WEST FLAG = 0b10000 attr_reader :width attr_reader :height attr_reader :matrix def initialize(pWidth, pHeight, pStartX, pStartY, pEndX, pEndY, pRandomness, pSparsity, pRemovalChance) @width = pWidth/2 @height = pHeight/2 # convert to Direction_Matrix's dimensions @startX = pStartX/2 @startY = pStartY/2 @endX = pEndX/2 @endY = pEndY/2 # if even, decrement by 1 @width -= 1 if (pWidth % 2 == 0) @height -= 1 if (pHeight % 2 == 0) if @startX != 0 @startX -= 1 if (pStartX % 2 == 0) end if @startY != 0 @startY -= 1 if (pStartY % 2 == 0) end if @endX != 0 @endX -= 1 if (pEndX % 2 == 0) end if @endY != 0 @endY -= 1 if (pEndY % 2 == 0) end # handle a weird situation if @startX >= @width then @startX = @width-1 end if @endX >= @width then @endX = @width-1 end @randomness = pRandomness @sparsity = pSparsity @removalChance = pRemovalChance @matrix = Array.new(@width, 0) for i in 0...@width @matrix[i] = Array.new(@height, 0) end generate # we need the original start/end locations and width/height in these cases if pStartY == 0 @matrix[@startX][@startY] |= NORTH elsif pStartX == 0 @matrix[@startX][@startY] |= WEST elsif (pStartX == @width*2+1 and (pWidth % 2) == 0) or (pStartX == @width*2 and (pWidth % 2) != 0) @matrix[@startX][@startY] |= EAST elsif (pStartY == @height*2+1 and (pHeight % 2) == 0) or (pStartY == @height*2 and (pHeight % 2) != 0) @matrix[@startX][@startY] |= SOUTH end if pEndY == 0 @matrix[@endX][@endY] |= NORTH elsif pEndX == 0 @matrix[@endX][@endY] |= WEST elsif (pEndX == @width*2+1 and (pWidth % 2) == 0) or (pEndX == @width*2 and (pWidth % 2) != 0) @matrix[@endX][@endY] |= EAST elsif (pEndY == @height*2+1 and (pHeight % 2) == 0) or (pEndY == @height*2 and (pHeight % 2) != 0) @matrix[@endX][@endY] |= SOUTH end sparsify removeDeadends end =begin The algorithm for generating random mazes is as follows: (1) randomly pick a starting tile from the map (2) pick a random direction and move that way as long as there is a new tile in that direction and hasn't been visited yet (3) perform (2) until there is no valid direction to move in, then pick a new tile that HAS been visited before and perform (2) and (3) until all the tiles have been visited =end def generate testedDirs = lastDir = straightStretch = 0 x = @startX y = @startY remaining = @width * @height - 1 # loop for all remaining tiles while (remaining > 0) if (testedDirs == ALL_DIRS) # we're stuck so choose an already-visited tile while true x = rand(@width) y = rand(@height) break if @matrix[x][y] != 0 end testedDirs = @matrix[x][y] end # eliminate impossible directions if (x < 1) then testedDirs |= WEST elsif (x+1 > @width) then testedDirs |= EAST end if (y < 1) then testedDirs |= NORTH elsif (y+1 > @height) then testedDirs |= SOUTH end randomSelection = false # depending on randomness parameter of map, # either select direction randomly or continue straight # (but no stretch can be longer than half the width/height) if ( rand < @randomness) randomSelection = true else case lastDir when NORTH if ( y>0 and straightStretch < @height/2 and @matrix[x][y-1]==0 ) direction = lastDir else randomSelection = true end when EAST if ( x+1<@width and straightStretch < @width/2 and @matrix[x+1][y]==0 ) direction = lastDir else randomSelection = true end when SOUTH if ( y+1<@height and straightStretch < @height/2 and @matrix[x][y+1]==0 ) direction = lastDir else randomSelection = true end when WEST if ( x>0 and straightStretch < @width/2 and @matrix[x-1][y]==0 ) direction = lastDir else randomSelection = true end else randomSelection = true end end if (randomSelection) # reset direction = 0 straightStretch = 0 # pick random direction # keep trying until a valid one is found while ( (direction == 0) or ((testedDirs & direction) != 0) ) temp_x = x temp_y = y case rand(4) when 0 # north if (y > 0) then direction = NORTH; temp_y-=1 else testedDirs |= NORTH end when 1 # east if (x+1 < @width) then direction = EAST; temp_x+=1 else testedDirs |= EAST end when 2 # south if (y+1 < @height) then direction = SOUTH; temp_y+=1 else testedDirs |= SOUTH end when 3 # west if (x > 0) then direction = WEST; temp_x-=1 else testedDirs |= WEST end end # check next square to ensure it's valid if ( @matrix[temp_x][temp_y] != 0 ) # record direction as tested testedDirs |= direction # if all directions are invalid, impossible to # select random direction so break out if (testedDirs == ALL_DIRS) then break end direction = 0 end end else straightStretch+=1 end # if all directions are tested, move on to next # iteration where an already-visited tile will be picked if (testedDirs == ALL_DIRS) then next end lastDir = direction # set selected direction in maze at both current tile # and destination tile @matrix[x][y] |= direction case direction when NORTH then y-=1; direction = SOUTH when EAST then x+=1; direction = WEST when SOUTH then y+=1; direction = NORTH when WEST then x-=1; direction = EAST end @matrix[x][y] |= direction testedDirs = @matrix[x][y] remaining-=1 end end =begin Sparsify the maze by the given amount ("sparsity") representing the number of times to sparsify (i.e. shorten deadends, creating empty areas so the maze isn't perfectly dense). A smaller maze will sparsify faster than a larger maze, so the smaller the maze, the smaller the number should be to accomplish the same relative amount of "sparsification". =end def sparsify for i in 0...@sparsity for x in 0...@width for y in 0...@height # don't sparsify from the beginning or end points -- # this guarantees a solution to the maze if (x == @startX) and (y == @startY) then next end if (x == @endX) and (y == @endY) then next end dir = @matrix[x][y] # if only one direction, found a deadend # so otherwise, go to next tile if not [NORTH, EAST, SOUTH, WEST].include?(dir) next end # remove deadend @matrix[x][y] = 0 # for previous tile, remove direction to removed deadend # also temporarily flag it as visited so any new deadends # created aren't sparsified in the same pass case dir when NORTH @matrix[x][y-1] &= ~SOUTH @matrix[x][y-1] |= FLAG when EAST @matrix[x+1][y] &= ~WEST @matrix[x+1][y] |= FLAG when SOUTH @matrix[x][y+1] &= ~NORTH @matrix[x][y+1] |= FLAG when WEST @matrix[x-1][y] &= ~EAST @matrix[x-1][y] |= FLAG end end end # clear the flags for the next sparsifying pass for x in 0...@width for y in 0...@height @matrix[x][y] &= ~FLAG end end end end =begin Display the matrix in an ASCII table (useful for debugging) (Much more readable if you're using a monospaced font for dialog boxes.) =end def display char_array = Array.new(@width, 0) for i in 0...@width char_array[i] = Array.new(@height, 0) end for x in 0...@width for y in 0...@height dir = @matrix[x][y] char = '[' if ((dir & NORTH) != 0) then char << 'N' else char << ' ' end if ((dir & EAST) != 0) then char << 'E' else char << ' ' end if ((dir & WEST) != 0) then char << 'W' else char << ' ' end if ((dir & SOUTH) != 0) then char << 'S' else char << ' ' end char << ']' char_array[y][x] = char end end display = '' for i in 0...@height display << char_array[i].flatten.to_s << "\n" end print display end =begin Clears the given percentage ("removalChance") of deadends from the maze by causing the deadends to extend until they hit another passage. As this causes cycles in the maze, it can result in multiple possible solutions to the maze (but makes it seem more natural). =end def removeDeadends for x in 0...@width for y in 0...@height dir = @matrix[x][y] # if only one direction, found a deadend # so otherwise, go to next tile if not [NORTH, EAST, SOUTH, WEST].include?(dir) next end # random roll to see if this deadend is skipped if (rand > @removalChance) then next end cur_x = x; cur_y = y back_dir = dir # continue as long as new corridor not reached while (@matrix[cur_x][cur_y] == back_dir) direction = 0 testedDirs = 0 # pick random direction # keep trying until a valid one is found while (direction == 0) temp_x = cur_x temp_y = cur_y case rand(4) when 0 # north if (cur_y > 0) then direction = NORTH; back_dir = SOUTH; temp_y-=1 else testedDirs |= NORTH end when 1 # east if (cur_x+1 < @width) then direction = EAST; back_dir = WEST; temp_x+=1 else testedDirs |= EAST end when 2 # south if (cur_y+1 < @height) then direction = SOUTH; back_dir = NORTH; temp_y+=1 else testedDirs |= SOUTH end when 3 # west if (cur_x > 0) then direction = WEST; back_dir = EAST; temp_x-=1 else testedDirs |= WEST end end # check if deadend tile already goes this way if ( @matrix[cur_x][cur_y] == direction ) # record direction as tested testedDirs |= direction direction = 0 end # if all directions are invalid, impossible to # select random direction so break out if (testedDirs == ALL_DIRS) then break end end if (testedDirs == ALL_DIRS) then break end # add new direction to deadend @matrix[cur_x][cur_y] |= direction # add new direction to tile adjacent to deadend @matrix[temp_x][temp_y] |= back_dir # move on to next tile cur_x = temp_x; cur_y = temp_y end end end end end Now, under this class put one more called 'Tile' and then put this script into that: Tile
module Tile @floor = 0 @wallFace = 0 @wall = 0 # to be extended with others to make maps "pretty", e.g. random ground features =begin The following array lists systematic keys which are based on adjacent walls (where 'W' is the wall itself): 1 2 3 4 W 6 7 8 9 e.g. 268 is the key that will be used to refer to the autotile which has adjacent walls north, east, and south. For the Castle Prison tileset (autotile #1), this is 67. (It's a bit unwieldy, but it works.) =end Autotile_Keys = [ 12346789, 2346789, 1246789, 246789, 1234678, 234678, 124678, 24678, 1234689, 234689, 124689, 24689, 123468, 23468, 12468, 2468, 23689, 2689, 2368, 268, 46789, 4678, 4689, 468, 12478, 1248, 2478, 248, 12346, 2346, 1246, 246, 28, 46, 689, 68, 478, 48, 124, 24, 236, 26, 8, 6, 2, 4, 0 ] # many autotiles handle multiple situations # this hash keeps track of which keys are identical # to ones already defined above Duplicate_Keys = { 123689 => 23689, 236789 => 23689, 1236789 => 23689, 34689 => 4689, 14689 => 4689, 134689 => 4689, 14678 => 4678, 34678 => 4678, 134678 => 4678, 146789 => 46789, 346789 => 46789, 1346789 => 46789, 23467 => 2346, 23469 => 2346, 234679 => 2346, 123467 => 12346, 123469 => 12346, 1234679 => 12346, 12467 => 1246, 12469 => 1246, 124679 => 1246, 124789 => 12478, 123478 => 12478, 1234789 => 12478, 146 => 46, 346 => 46, 467 => 46, 469 => 46, 1346 => 46, 1467 => 46, 1469 => 46, 3467 => 46, 3469 => 46, 4679 => 46, 13467 => 46, 13469 => 46, 14679 => 46, 34679 => 46, 134679 => 46, 128 => 28, 238 => 28, 278 => 28, 289 => 28, 1238 => 28, 1278 => 28, 1289 => 28, 2378 => 28, 2389 => 28, 2789 => 28, 12378 => 28, 12389 => 28, 12789 => 28, 23789 => 28, 123789 => 28, 1247 => 124, 2369 => 236, 147 => 4, 247 => 24, 14 => 4, 47 => 4, 1478 => 478, 3478 => 478, 4789 => 478, 134789 => 478, 14789 => 478, 13478 => 478, 34789 => 478, 1234 => 124, 1247 => 124, 1249 => 124, 12347 => 124, 12349 => 124, 12479 => 124, 123479 => 124, 1236 => 236, 2367 => 236, 2369 => 236, 12367 => 236, 12369 => 236, 23679 => 236, 123679 => 236, 12368 => 2368, 23678 => 2368, 123678 => 2368, 12348 => 1248, 12489 => 1248, 123489 => 1248, 1689 => 689, 3689 => 689, 6789 => 689, 13689 => 689, 16789 => 689, 36789 => 689, 136789 => 689, 12689 => 2689, 26789 => 2689, 126789 => 2689, 23478 => 2478, 24789 => 2478, 234789 => 2478 } def Tile.setFloor(row, col) if row > 1 @floor = Tile.index(row, col) else # autotiles @floor = Hash.new(0) j = Tile.index(row, col) for i in Autotile_Keys @floor[i] = j j += 1 end # add duplicates for i in Duplicate_Keys.keys @floor[i] = @floor[Duplicate_Keys[i]] end end end def Tile.floor @floor end def Tile.floor=(value) @floor = value end def Tile.wall=(value) @wall = value end def Tile.wallFace=(value) @wallFace = value end def Tile.setWallFace(row, col) if row > 1 @wallFace = Tile.index(row, col) else # autotiles @wallFace = Hash.new(0) j = Tile.index(row, col) for i in Autotile_Keys @wallFace[i] = j j += 1 end # add duplicates for i in Duplicate_Keys.keys @wallFace[i] = @wallFace[Duplicate_Keys[i]] end end end def Tile.wallFace @wallFace end def Tile.setWall(row, col) if row > 1 @wall = Tile.index(row, col) else # autotiles @wall = Hash.new(0) j = Tile.index(row, col) for i in Autotile_Keys @wall[i] = j j += 1 end # add duplicates for i in Duplicate_Keys.keys @wall[i] = @wall[Duplicate_Keys[i]] end end end def Tile.wall @wall end =begin This method returns the index of a specific tile in the tileset, or the base index for one of the 7 autotiles. Parameters: row - row where the tile is found within the tileset ( 1+ ) col - column where the tile is found within the tileset ( 1-8 ) Note: this method is NOT zero-indexed, i.e. rows and columns start at 1 e.g. index(1,2) returns 48 index(2,1) returns 384 index(4,8) returns 407 By the way, here's an example of how autotile indexes work... Autotile in column 2: row\col| 1 2 3 4 5 6 7 8 --------------------------- 1 | 48 49 50 51 52 53 54 55 2 | 56 57 58 59 60 61 62 63 3 | 64 65 66 67 68 69 70 71 4 | 72 73 74 75 76 77 78 79 5 | 80 81 82 83 84 85 86 87 6 | 88 89 90 91 92 93 94 95 The function to return the index of a single tile within an autotile (given by at_index) is (at_index-1)*48 + col-1 + (row-1)*8 (where row, col, and at_index are again NOT zero-indexed) =end def Tile.index(row, col) if row > 1 # if not autotiles return 383 + col + 8*(row-2) else return (col-1)*48 end end end Scripts; Updated; Scripts Demo Added - basketball jones - 02-17-2010 not sure what you mean by "destroyed" -- the old rmxp.org is still going under a different name, and this is a fairly recent newcomer. the other places have been fairly turmoil-free, too. unless you're talking about this site being hacked, but that didn't really delete that much! cool finds, though. the maze generator sounds particularly interesting, although I hope it's not just a reprise of VX's silly dungeon generator. Scripts; Updated; Scripts Demo Added - Geowil - 02-17-2010 Rataime's Dynamic Shadow Script: Instructions: Installation: Put this script in a new class called Dynamic Shadows. Put it over both the Sun Effects Script and Wachungaââ¬â¢s Fog of War script if you are using it. Script is in the spoiler tags. Usage: Ok, jusââ¬â¢ an FYI, this script is caterpillar compatible. Its quite simple to use actually. I find it easier though to write down all the different commands to the scripts I have implemented, for easy reference, so I suggest you do the same. Now, here are the commands that you will need to use in order to use this script: **All of these commands go into comments in the events, also, donââ¬â¢t capitalize any of the commands at any point, otherwise it wont work** Quote:begin shadow source ââ¬â starts a source of light in an event Now, put these in comments only if you have selected the event to be a source: Quote:anglemin (number between 0 and 360. Example: anglemin 0)- sets angle of rotation And thatââ¬â¢s all there is to it. Just remember Geometry; this script works in angles, 180 being half way around, and 360 being all the way around. There is currently a bug that causes shadows to get ââ¬Åstuckââ¬Â on the top of the window as you move down away from them. Dynamic Shadows
#============================================================================== # ? Sprite_Shadow (Sprite_Ombre ) # Based on Genzai Kawakami's shadows, dynamisme&features by Rataime, extra features Boushy #============================================================================== CATERPILLAR_COMPATIBLE = true SHADOW_WARN = true class Game_Party attr_reader :characters end class Sprite_Shadow < RPG::Sprite attr_accessor :character def initialize(viewport, character = nil,id=0) super(viewport) params=$shadow_spriteset.shadows[id] @source=params[0] @anglemin=0 @anglemin=params[1] if params.size>1 @anglemax=0 @anglemax=params[2] if params.size>2 @self_opacity=100 @self_opacity=params[4] if params.size>4 @distancemax=350 @distancemax=params[3] if params.size>3 @character = character update end def update if !in_range?(@character, @source, @distancemax) self.opacity=0 return end super if @tile_id != @character.tile_id or @character_name != @character.character_name or @character_hue != @character.character_hue @tile_id = @character.tile_id @character_name = @character.character_name @character_hue = @character.character_hue if @tile_id >= 384 self.bitmap = RPG::Cache.tile($game_map.tileset_name, @tile_id, @character.character_hue) self.src_rect.set(0, 0, 32, 32) self.ox = 16 self.oy = 32 else self.bitmap = RPG::Cache.character(@character.character_name, @character.character_hue) @cw = bitmap.width / 4 @ch = bitmap.height / 4 self.ox = @cw / 2 self.oy = @ch end end self.visible = (not @character.transparent) if @tile_id == 0 sx = @character.pattern * @cw sy = (@character.direction - 2) / 2 * @ch if self.angle>90 or angle<-90 if @character.direction== 6 sy = ( 4- 2) / 2 * @ch end if @character.direction== 4 sy = ( 6- 2) / 2 * @ch end if @character.direction== 2 sy = ( 8- 2) / 2 * @ch end if @character.direction== 8 sy = ( 2- 2) / 2 * @ch end end self.src_rect.set(sx, sy, @cw, @ch) end self.x = @character.screen_x self.y = @character.screen_y-5 self.z = @character.screen_z(@ch)-1 self.blend_type = @character.blend_type self.bush_depth = @character.bush_depth if @character.animation_id != 0 animation = $data_animations[@character.animation_id] animation(animation, true) @character.animation_id = 0 end @deltax=@source.screen_x-self.x @deltay= @source.screen_y-self.y self.color = Color.new(0, 0, 0) @distance = ((@deltax ** 2) + (@deltay ** 2)) self.opacity = @self_opacity*13000/((@distance*370/@distancemax)+6000) self.angle = 57.3*Math.atan2(@deltax, @deltay ) @angle_trigo=self.angle+90 if @angle_trigo<0 @angle_trigo=360+@angle_trigo end if @anglemin !=0 or @anglemax !=0 if (@angle_trigo<@anglemin or @angle_trigo>@anglemax) and @anglemin<@anglemax self.opacity=0 return end if (@angle_trigo<@anglemin and @angle_trigo>@anglemax) and @anglemin>@anglemax self.opacity=0 return end end end def in_range?(element, object, range)# From Near's Anti Lag Script, edited x = (element.screen_x - object.screen_x) * (element.screen_x - object.screen_x) y = (element.screen_y - object.screen_y) * (element.screen_y - object.screen_y) r = x + y if r <= (range * range) return true else return false end end end #=================================================== # ? CLASS Sprite_Character edit #=================================================== class Sprite_Character < RPG::Sprite alias shadow_initialize initialize def initialize(viewport, character = nil) @character = character super(viewport) @ombrelist=[] if character.is_a?(Game_Event) and $shadow_spriteset.shadows!=[] params = XPML_read("Shadow",@character.id,4) if params!=nil for i in 0...$shadow_spriteset.shadows.size @ombrelist.push(Sprite_Shadow.new(viewport, @character,i)) end end end if character.is_a?(Game_Player) and $shadow_spriteset.shadows!=[] for i in 0...$shadow_spriteset.shadows.size @ombrelist.push(Sprite_Shadow.new(viewport, $game_player,i)) end #=================================================== # ? Compatibility with fukuyama's caterpillar script #=================================================== if CATERPILLAR_COMPATIBLE and $game_party.characters!=nil for member in $game_party.characters for i in 0...$shadow_spriteset.shadows.size @ombrelist.push(Sprite_Shadow.new(viewport, member,i)) end end end #=================================================== # ? End of the compatibility #=================================================== end shadow_initialize(viewport, @character) end alias shadow_update update def update shadow_update if @ombrelist!=[] for i in 0...@ombrelist.size @ombrelist[i].update end end end end #=================================================== # ? CLASS Game_Event edit #=================================================== class Game_Event attr_accessor :id end #=================================================== # ? CLASS Spriteset_Map edit #=================================================== class Spriteset_Map attr_accessor :shadows alias shadow_initialize initialize def initialize $shadow_spriteset=self @shadows=[] warn=false for k in $game_map.events.keys.sort warn=true if ($game_map.events[k].list!=nil and $game_map.events[k].list[0].code == 108 and ($game_map.events[k].list[0].parameters == ["s"] or $game_map.events[k].list[0].parameters == ["o"])) params = XPML_read("Shadow Source",k,4) $shadow_spriteset.shadows.push([$game_map.events[k]]+params) if params!=nil end p "Warning : At least one event on this map uses the obsolete way to add shadows" if warn == true and SHADOW_WARN shadow_initialize end end #=================================================== # ? XPML Definition, by Rataime, using ideas from Near Fantastica # # Returns nil if the markup wasn't present at all, # returns [] if there wasn't any parameters, else # returns a parameters list with "int" converted as int # eg : # begin first # begin second # param1 1 # param2 two # begin third # anything 3 # # p XPML_read("first", event_id) -> [] # p XPML_read("second", event_id) -> [1,"two"] # p XPML_read("third", event_id) -> [3] # p XPML_read("forth", event_id) -> nil #=================================================== def XPML_read(markup,event_id,max_param_number=0) parameter_list = nil event=$game_map.events[event_id] return if event.list==nil for i in 0...event.list.size if event.list[i].code == 108 and event.list[i].parameters[0].downcase == "begin "+markup.downcase parameter_list = [] if parameter_list == nil for j in i+1...event.list.size if event.list[j].code == 108 parts = event.list[j].parameters[0].split if parts.size!=1 and parts[0].downcase!="begin" if parts[1].to_i!=0 or parts[1]=="0" parameter_list.push(parts[1].to_i) else parameter_list.push(parts[1]) end else return parameter_list end else return parameter_list end return parameter_list if max_param_number!=0 and j==i+max_param_number end end end return parameter_list end Rataime's Sun Effects Script : Instructions: Installation: Put this script in a new class called Dynamic Shadows. Put it under the Dynamic Shadows Script and over Wachungaââ¬â¢s Fog of War script if you are using it. Script is in the spoiler tags. Usage: Same as before, this script is Caterpillar compatible. Place this in a class under the Dynamic Shadows script (you should use both of them). Again, some commands, make sure you put them in comments inside an empty event in maps where you want a sun: Quote:begin sun ââ¬â starts a sun You can also have 2 suns or more by making another even using begin sun and setting an angle for the second, third, ect. Sun Effects
#============================================================================== # ? Sprite_Sun # # Based on Sprite_Shadow, modified by Rataime #============================================================================== CATERPILLAR_COMPATIBLE = true SUN_WARN =true class Game_Party attr_reader :characters end class Sprite_Sun < RPG::Sprite attr_accessor :character def initialize(viewport, character = nil,id=0) super(viewport) @character = character params=$sun_spriteset.sun[id] self_angle=45 self_angle=params[0] if params.size>0 self_opacity=128 self_opacity=params[1] if params.size>1 @self_angle=self_angle @self_opacity=self_opacity update end def update super if @tile_id != @character.tile_id or @character_name != @character.character_name or @character_hue != @character.character_hue @tile_id = @character.tile_id @character_name = @character.character_name @character_hue = @character.character_hue if @tile_id >= 384 self.bitmap = RPG::Cache.tile($game_map.tileset_name, @tile_id, @character.character_hue) self.src_rect.set(0, 0, 32, 32) self.ox = 16 self.oy = 32 else self.bitmap = RPG::Cache.character(@character.character_name, @character.character_hue) @cw = bitmap.width / 4 @ch = bitmap.height / 4 self.ox = @cw / 2 self.oy = @ch end end self.visible = (not @character.transparent) if @tile_id == 0 sx = @character.pattern * @cw @direct=@character.direction if self.angle>90 or angle<-90 if @direct== 6 sy = ( 4- 2) / 2 * @ch end if @direct== 4 sy = ( 6- 2) / 2 * @ch end if @direct != 4 and @direct !=6 sy = (@character.direction - 2) / 2 * @ch end else sy = (@character.direction - 2) / 2 * @ch end self.src_rect.set(sx, sy, @cw, @ch) end self.x = @character.screen_x self.y = @character.screen_y-5 self.z = @character.screen_z(@ch)-1 self.opacity = @self_opacity self.blend_type = @character.blend_type self.bush_depth = @character.bush_depth if @character.animation_id != 0 animation = $data_animations[@character.animation_id] animation(animation, true) @character.animation_id = 0 end self.angle = @self_angle.to_i-90 self.color = Color.new(0, 0, 0) end end #=================================================== # ? CLASS Sprite_Character edit #=================================================== class Sprite_Character < RPG::Sprite alias sun_initialize initialize def initialize(viewport, character = nil) @character = character super(viewport) @sunlist=[] if character.is_a?(Game_Event) and $sun_spriteset.sun!=[] params = XPML_read("Shadow",@character.id,2) if params!=nil for i in 0...$sun_spriteset.sun.size @sunlist.push(Sprite_Sun.new(viewport, @character,i)) end end end if character.is_a?(Game_Player) and $sun_spriteset.sun!=[] for i in 0...$sun_spriteset.sun.size @sunlist.push(Sprite_Sun.new(viewport, $game_player,i)) end #=================================================== # ? Compatibility with fukuyama's caterpillar script #=================================================== if CATERPILLAR_COMPATIBLE and $game_party.characters!=nil for member in $game_party.characters for i in 0...$sun_spriteset.sun.size @sunlist.push(Sprite_Sun.new(viewport, member,i)) end end end #=================================================== # ? End of the compatibility #=================================================== end sun_initialize(viewport, @character) end alias sun_update update def update sun_update if @sunlist!=[] for i in 0...@sunlist.size @sunlist[i].update end end end end #=================================================== # ? CLASS Game_Event edit #=================================================== class Game_Event attr_accessor :id end #=================================================== # ? CLASS Spriteset_Map edit #=================================================== class Spriteset_Map attr_accessor :sun alias sun_initialize initialize def initialize @sun=[] $sun_spriteset=self warn=false for k in $game_map.events.keys.sort warn=true if ($game_map.events[k].list!=nil and $game_map.events[k].list[0].code == 108 and ($game_map.events[k].list[0].parameters == ["sun"] or $game_map.events[k].list[0].parameters == ["o"])) params = XPML_read("Sun",k,2) $sun_spriteset.sun.push(params) if params!=nil end p "Warning : At least one event on this map uses the obsolete way to add a sun effect" if warn == true and SUN_WARN sun_initialize end end #=================================================== # ? XPML Definition, by Rataime, using ideas from Near Fantastica # # Returns nil if the markup wasn't present at all, # returns [] if there wasn't any parameters, else # returns a parameters list with "int" converted as int # eg : # begin first # begin second # param1 1 # param2 two # begin third # anything 3 # # p XPML_read("first", event_id) -> [] # p XPML_read("second", event_id) -> [1,"two"] # p XPML_read("third", event_id) -> [3] # p XPML_read("forth", event_id) -> nil #=================================================== def XPML_read(markup,event_id,max_param_number=0) parameter_list = nil event=$game_map.events[event_id] return if event.list==nil for i in 0...event.list.size if event.list[i].code == 108 and event.list[i].parameters[0].downcase == "begin "+markup.downcase parameter_list = [] if parameter_list == nil for j in i+1...event.list.size if event.list[j].code == 108 parts = event.list[j].parameters[0].split if parts.size!=1 and parts[0].downcase!="begin" if parts[1].to_i!=0 or parts[1]=="0" parameter_list.push(parts[1].to_i) else parameter_list.push(parts[1]) end else return parameter_list end else return parameter_list end return parameter_list if max_param_number!=0 and j==i+max_param_number end end end return parameter_list end SephirothSpawn's Dynamic bank Script: Instructions: Installation: Now, make a new class above 'Main' and cal it Dynamic Banks then add the spoilered script into it. Usage: This is a very interesting little script. It calculates interest so whenever you leave money in the bank, it will accrue interest. Now, to call this use this in a call script: Quote:$scene = Scene_Bank.new Now, to adjust this to your needs you can edit these lines: Quote:@account_balance = 0 these lines effect your initial balance, and interest rate, what savings bonds you already have, and the amount of time that has passed for your bonds and interest: Quote:interest_time = (Graphics.frame_count / Graphics.frame_rate - @last_interest_time) / 3600.0 These lines affect the amount of time it takes to update your balance with the interest, and how much the interest adds to your total amount of money. Note that the 3600 is in seconds: Quote:bonds = [ Savings_Bond.new("CD-7", 100, 7.5, 7), Savings_Bond.new("CD-14", 500, 15, 14)]) finally, these allow you to modify the bonds. Hereââ¬â¢s a break down of how the bonds are set up above: Quote:bonds = [ Savings_Bond.new("Bond Name", Bond Cost, Bond Intrest, Time for Bond to Mature )]) Now, if you want each bank to be different, then you can do this in the call script: Quote:bonds = [ Savings_Bond.new("Bond Name", Bond Cost, Bond Intrest, Time for Bond to Mature )]) so, in this exapmle, we want 2 custom bonds and a new intrest rate: Quote:bonds = [Savings_Bond.new("Custom Bond 1", 10000, 30, 5), Savings_Bond.new("Custom Bond 2", 20000, 60, 10)]) we now have 2 custom bonds and the interest rate will be set to 10%. Custom bond 1 will cost 10,000 gold, increase by 30% at maturity and take 5 hours of game play to mature, while custom bond 2 will cost 20,000 gold, increase by 60% at maturity and take 10 hours of game play to mature. Dynamic Banks
#============================================================================== # Banking System #-------------------------------------------------------------------------- # Created By SephirothSpawn (12.05.05) # Last Updated: 12.06.05 #============================================================================== #============================================================================== # ** Scene_Title #============================================================================== class Scene_Title #-------------------------------------------------------------------------- # * Alias Command: New Game #-------------------------------------------------------------------------- alias bank_command_new_game command_new_game #-------------------------------------------------------------------------- # * Command: New Game #-------------------------------------------------------------------------- def command_new_game $game_bank = Game_BankSystem.new bank_command_new_game end end #============================================================================== # ** Window_RefreshCommand #============================================================================== class Window_RefreshCommand < Window_Selectable #-------------------------------------------------------------------------- # * Object Initialization # width : window width # commands : command text string array #-------------------------------------------------------------------------- def initialize(width, commands) # Compute window height from command quantity super(0, 0, width, commands.size * 32 + 32) @item_max = commands.size @commands = commands refresh self.index = 0 end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh(commands = @commands) @commands = commands @item_max = commands.size if self.contents != nil self.contents.dispose self.contents = nil end self.contents = Bitmap.new(width - 32, @item_max * 32) for i in 0...@item_max draw_item(i, normal_color) end end #-------------------------------------------------------------------------- # * Draw Item # index : item number # color : text color #-------------------------------------------------------------------------- def draw_item(index, color) self.contents.font.color = color self.contents.draw_text(0, 32 * index, self.contents.width - 8, 32, @commands[index], 1) end #-------------------------------------------------------------------------- # * Disable Item # index : item number #-------------------------------------------------------------------------- def disable_item(index) draw_item(index, disabled_color) end #-------------------------------------------------------------------------- # * Undisable Item # index : item number #-------------------------------------------------------------------------- def undisable_item(index) draw_item(index, normal_color) end end #============================================================================== # ** Game_BankSystem #============================================================================== class Game_BankSystem #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_accessor :account_balance attr_accessor :interest_rate attr_accessor :saving_bonds #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize @account_balance = 0 @interest_rate = 1 @saving_bonds = [] @last_interest_time = 0 end #-------------------------------------------------------------------------- # * Update #-------------------------------------------------------------------------- def update # Updates Deposited Amount interest_time = (Graphics.frame_count / Graphics.frame_rate - @last_interest_time) / 3600.0 interest_amt = (@account_balance * @interest_rate / 100.0 * interest_time).to_i if interest_amt > 0 @last_interest_time = Graphics.frame_count / Graphics.frame_rate @account_balance += interest_amt # Refreshes Data Windows $scene.refresh_windows end end #-------------------------------------------------------------------------- # * Deposit #-------------------------------------------------------------------------- def deposit(amount) $game_party.lose_gold(amount) @account_balance += amount end #-------------------------------------------------------------------------- # * Withdraw #-------------------------------------------------------------------------- def withdraw(amount) @account_balance -= amount $game_party.gain_gold(amount) end #-------------------------------------------------------------------------- # * Add Savings Bond #-------------------------------------------------------------------------- def add_bond(bond) @saving_bonds.push(bond) @saving_bonds.sort! {|a, b| a.name <=> b.name} end end #============================================================================== # ** Savings_Bond #============================================================================== class Savings_Bond #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_accessor :name attr_accessor :cost attr_accessor :interest_rate attr_accessor :length attr_accessor :time_bought attr_accessor :time_finished attr_accessor :mature_value #-------------------------------------------------------------------------- # * Object Initialization # name : Savings Bond Name # cost : Savings Bond Cost # interest_rate : Savings Bond Interest Rate (In Percent) # length : Length of Hours until Mature #-------------------------------------------------------------------------- def initialize(name, cost, interest_rate, length) @name = name @cost = cost @interest_rate = interest_rate @length = length @mature_value = (@cost * (1+ @interest_rate / 100.0)).to_i end #-------------------------------------------------------------------------- # * Set Times #-------------------------------------------------------------------------- def set_times @time_bought = Graphics.frame_count / Graphics.frame_rate @time_finished = @time_bought + @length * 3600 end #-------------------------------------------------------------------------- # * Make Time to HH:MM:SS #-------------------------------------------------------------------------- def return_time(time) hours = time / 60 / 60 minutes = time / 60 % 60 seconds = time % 60 return sprintf("%02d:%02d:%02d", hours, minutes, seconds) end end #============================================================================== # ** Window_BankNumber #============================================================================== class Window_BankNumber < Window_Base #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize super(640, 272, 240, 192) self.opacity = 175 self.contents = Bitmap.new(width - 32, height - 32) end #-------------------------------------------------------------------------- # * Refresh # money : Gold being... # type : Deposit or Withdraw #-------------------------------------------------------------------------- def refresh(money, type) contents.clear # Deposit or Withdraw contents.font.color = system_color contents.draw_text(0, 0, contents.width, 24, "Amount to #{type}", 1) if type == "Deposit" # Draws Game Party Gold contents.draw_text(4, 48, contents.width, 24, "Current #{$data_system.words.gold}:") contents.font.color = normal_color contents.draw_text(-4, 48, contents.width, 24, $game_party.gold.to_s, 2) else # Draws Account Balance contents.draw_text(4, 48, contents.width, 24, "Account Balance:") contents.font.color = normal_color contents.draw_text(-4, 48, contents.width, 24, $game_bank.account_balance.to_s, 2) end # Draws Money Being Deposited or Withdrawn contents.font.color = system_color contents.draw_text(4, 72, contents.width, 24, "#{type} Amount:") contents.font.color = normal_color contents.draw_text(-4, 72, contents.width, 24, "- #{money}", 2) # Draws Line line = "" while contents.text_size(line).width < contents.width line += "-" end contents.draw_text(0, 96, contents.width, 24, line, 2) # Draws Game Party Gold Amont contents.font.color = system_color contents.draw_text(4, 112, contents.width, 32, "#{$data_system.words.gold} After:") amount = $game_party.gold amount += type == "Deposit" ? -money : money contents.font.color = normal_color contents.draw_text(-4, 112, contents.width, 32, amount.to_s, 2) # Draws Deposit Amont amount = $game_bank.account_balance amount += type == "Deposit" ? money : -money contents.font.color = system_color contents.draw_text(4, 136, contents.width, 32, "Balance After:") contents.font.color = normal_color contents.draw_text(-4, 136, contents.width, 32, amount.to_s, 2) end end #============================================================================== # ** Window_BankBio #============================================================================== class Window_BankBio < Window_Base #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize super(-240, 272, 240, 192) self.opacity = 175 self.contents = Bitmap.new(width - 32, height - 32) refresh end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh contents.clear # Deposit or Withdraw contents.font.color = system_color # Draws Actor Name in Postition 1 contents.font.color = normal_color contents.draw_text(0, 0, contents.width, 24, "#{$game_party.actors[0].name}", 1) # Draws Game Party Gold contents.font.color = system_color contents.draw_text(4, 32, contents.width, 24, "Current #{$data_system.words.gold}:") contents.font.color = normal_color contents.draw_text(-4, 32, contents.width, 24, $game_party.gold.to_s, 2) # Draws Account Balance contents.font.color = system_color contents.draw_text(4, 56, contents.width, 24, "Account Balance:") contents.font.color = normal_color contents.draw_text(-4, 56, contents.width, 24, $game_bank.account_balance.to_s, 2) # Draws Number of Savings Bond's contents.font.color = system_color contents.draw_text(4, 80, contents.width, 24, "Bonds Owned:") contents.font.color = normal_color contents.draw_text(-4, 80, contents.width, 24, $game_bank.saving_bonds.size.to_s, 2) # Draws Value of Savings Bond's value = 0 $game_bank.saving_bonds.each { |x| value += x.mature_value} contents.font.color = system_color contents.draw_text(4, 104, contents.width, 24, "Bonds Value:") contents.font.color = normal_color contents.draw_text(-4, 104, contents.width, 24, value.to_s, 2) # Draws Current Interest Rate contents.font.color = system_color contents.draw_text(4, 136, contents.width, 24, "Interest Rate:") contents.font.color = normal_color contents.draw_text(-4, 136, contents.width, 24, "#{$game_bank.interest_rate} %", 2) end end #============================================================================== # ** Window_Bond #============================================================================== class Window_Bond < Window_Base #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize super(-240, 264, 240, 200) self.opacity = 175 self.contents = Bitmap.new(width - 32, height - 32) end #-------------------------------------------------------------------------- # * Refresh # bond : Savings Bond #-------------------------------------------------------------------------- def refresh(bond, bought = false) contents.clear unless bond == nil # Draws Bond Name contents.font.color = system_color contents.draw_text(0, 0, contents.width, 24, bond.name, 1) # Draws Bond Cost contents.font.color = system_color contents.draw_text(4, 24, contents.width, 24, "Bond Cost:") contents.font.color = normal_color contents.draw_text(-4, 24, contents.width, 24, bond.cost.to_s, 2) # Draws Bond Mature Value contents.font.color = system_color contents.draw_text(4, 48, contents.width, 24, "Mature Value:") contents.font.color = normal_color contents.draw_text(-4, 48, contents.width, 24, "#{bond.mature_value}", 2) # Draws Bond Interest Rate contents.font.color = system_color contents.draw_text(4, 72, contents.width, 24, "Interest Rate:") contents.font.color = normal_color contents.draw_text(-4, 72, contents.width, 24, "#{bond.interest_rate} %", 2) # Draws Length until Maturity contents.font.color = system_color contents.draw_text(4, 96, contents.width, 24, "Maturity Time:") contents.font.color = normal_color contents.draw_text(-4, 96, contents.width, 24, "#{bond.length} Hours", 2) # Display only if Purchased CD if bought # Draws Time Bought contents.font.color = system_color contents.draw_text(4, 120, contents.width, 24, "Time Bought:") contents.font.color = normal_color contents.draw_text(-4, 120, contents.width, 24, bond.return_time(bond.time_bought), 2) # Draws Time Finished contents.font.color = system_color contents.draw_text(4, 144, contents.width, 24, "Time Finished:") contents.font.color = normal_color contents.draw_text(-4, 144, contents.width, 24, bond.return_time(bond.time_finished), 2) end end end end #============================================================================== # ** Scene_Bank #============================================================================== class Scene_Bank #-------------------------------------------------------------------------- # * Object Initialization # interest rate : Changes Current Interest Rate (Leave 0 for no Change) # bonds : Avaliable CD's For Purchasing #-------------------------------------------------------------------------- def initialize(interest_rate = $game_bank.interest_rate, bonds = [ Savings_Bond.new("CD-7", 100, 7.5, 7), Savings_Bond.new("CD-14", 500, 15, 14)]) $game_bank.interest_rate = interest_rate unless interest_rate == 0 @bonds = bonds end #-------------------------------------------------------------------------- # * Main Processing #-------------------------------------------------------------------------- def main # Current Phase @phase = -1 # Refreshing Variables @amount, @depositing = 0, true @current_bond, @bond_bought = nil, false # Make sprite set @spriteset = Spriteset_Map.new # Help Window @help_window = Window_Help.new @help_window.y, @help_window.opacity = -64, 175 @help_window.set_text("Welcome to the Bank", 1) # Bank Bio @bank_bio_window = Window_BankBio.new # Avaliable Bond Information Display Window @av_bond_display_window = Window_Bond.new # Owned Bond Information Display Window @own_bond_display_window = Window_Bond.new # Main Command @main_command = Window_RefreshCommand.new(180, [ "Deposit #{g_word = $data_system.words.gold}", "Withdraw #{g_word}", "Purchase Bond", "Get Mature Bond", "Exit"]) @main_command.x, @main_command.y, @main_command.opacity = 644, 272, 175 @main_command.active = false # Bank Number Window @bank_number_window = Window_BankNumber.new # Avaliable Bonds Command commands = [] @bonds.each {|x| commands.push(x.name)}; commands.push("Back") @av_bond_command = Window_RefreshCommand.new(180, commands) @av_bond_command.x, @av_bond_command.y = 644, 272 @av_bond_command.height, @av_bond_command.opacity = 192, 175 @av_bond_command.active = false # CD's Have @own_bond_command = Window_RefreshCommand.new(180, get_cd_list) @own_bond_command.x, @own_bond_command.y = 644, 272 @own_bond_command.height, @own_bond_command.opacity = 192, 175 @own_bond_command.active = false # Scene Objects @objects = [@spriteset, @help_window, @bank_bio_window, @av_bond_display_window, @own_bond_display_window, @main_command, @bank_number_window, @av_bond_command, @own_bond_command] # Execute transition Graphics.transition # Main loop while $scene == self # Update game screen Graphics.update # Update input information Input.update # Update Objects @objects.each {|x| x.update} # Updates Bank System $game_bank.update # Frame update update end # Prepare for transition Graphics.freeze # Dispose of windows @objects.each {|x| x.dispose} end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update # Splits Phases Up case @phase when -1 # Intro Phase intro_update when 0 # Main Phase main_update when 1 # Deposit or Withdraw Phase account_update when 2 # Buy CD Phase buy_bond_update when 3 # Get Mature CD Phse get_bond_update when 99 # Exit Phase exit_update end end #-------------------------------------------------------------------------- # * Intro Update #-------------------------------------------------------------------------- def intro_update # Moves Window Down @help_window.y += 4 if @help_window.y < 0 if @help_window.y == 0 # Input Processing if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) # Returns to Scene @phase = 99 elsif Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) # Switchs to Main Phase @phase = 0 end end end #-------------------------------------------------------------------------- # * Main Update #-------------------------------------------------------------------------- def main_update # Turns On Main Command @main_command.active = true # Turns Off Other Command Windows @av_bond_command.active = @own_bond_command.active = false # Moves In Active Windows @bank_bio_window.z = @main_command.z = 9999 @bank_bio_window.x += 32 if @bank_bio_window.x < 16 @main_command.x -= 25 if @main_command.x > 444 # Moves Out Inactive Windows @av_bond_display_window.x -= 32 if @av_bond_display_window.x > - 240 [@av_bond_display_window, @own_bond_display_window, @bank_number_window, @av_bond_command, @own_bond_command].each {|window| window.z = 9995} [@av_bond_command, @own_bond_command].each {|command| command.x += 25 if command.x < 644} @own_bond_display_window.x -= 25 if @own_bond_display_window.x > - 240 @bank_number_window.x += 32 if @bank_number_window.x < 640 # Sets Help Window case @main_command.index when 0; @help_window.set_text("Deposit Money Into your Account", 1) when 1; @help_window.set_text("Withdraw Money From your Account", 1) when 2; @help_window.set_text("Purchase a Savings Bond", 1) when 3; @help_window.set_text("Take Out Mature Savings Bond", 1) when 4; @help_window.set_text("Exit Bank", 1) end # Input Processing if Input.trigger?(Input::B) # Returns to Map $game_system.se_play($data_system.cancel_se) @phase = 99 elsif Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) case @main_command.index when 0 # Deposit @amount, @depositing = 0, true refresh_windows @help_window.set_text("Deposit #{@amount} #{$data_system.words.gold}", 1) @phase = 1 when 1 # Withdraw @amount, @depositing = 0, false refresh_windows @help_window.set_text("Withdraw #{@amount} #{$data_system.words.gold}", 1) @phase = 1 when 2 # Buy CD @current_bond = @bonds[@av_bond_command.index] @bond_bought = false refresh_windows @phase = 2 when 3 # Get CD @current_bond = $game_bank.saving_bonds[@own_bond_command.index] @bond_bought = true refresh_windows @phase = 3 when 4 # Exit Bank @phase = 99 end end end #-------------------------------------------------------------------------- # * Accpunt Update #-------------------------------------------------------------------------- def account_update # Turns Off Command Windows @main_command.active = @av_bond_command.active = @own_bond_command.active = false # Moves In Active Windows @bank_bio_window.z = @bank_number_window.z = 9999 @bank_bio_window.x += 32 if @bank_bio_window.x < 16 @bank_number_window.x -= 32 if @bank_number_window.x > 384 # Moves Out Inactive Windows @av_bond_display_window.z = @own_bond_display_window.z = @main_command.z = @av_bond_command.z = @own_bond_command.z = 9995 @av_bond_display_window.x -= 32 if @av_bond_display_window.x > - 240 [@own_bond_display_window].each {|window| window.x -= 25 if window.x > - 240} [@main_command, @av_bond_command, @own_bond_command].each {|command| command.x += 25 if command.x < 644} # Input Processing if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) @phase = 0 elsif Input.trigger?(Input::C) $game_system.se_play($data_system.shop_se) if @depositing $game_bank.deposit(@amount) refresh_windows @phase = 0 else $game_bank.withdraw(@amount) refresh_windows @phase = 0 end elsif Input.repeat?(Input::LEFT) && Input.press?(Input::LEFT) if @amount > 0 $game_system.se_play($data_system.cursor_se) @amount -= 1 refresh_windows @help_window.set_text("#{@depositing ? 'Deposit' : 'Withdraw'} #{@amount} #{$data_system.words.gold}", 1) else $game_system.se_play($data_system.buzzer_se) end elsif Input.repeat?(Input::RIGHT) && Input.press?(Input::RIGHT) if @depositing if @amount < $game_party.gold $game_system.se_play($data_system.cursor_se) @amount += 1 refresh_windows @help_window.set_text("#{@depositing ? 'Deposit' : 'Withdraw'} #{@amount} #{$data_system.words.gold}", 1) else $game_system.se_play($data_system.buzzer_se) end else if @amount < $game_bank.account_balance $game_system.se_play($data_system.cursor_se) @amount += 1 refresh_windows @help_window.set_text("#{@depositing ? 'Deposit' : 'Withdraw'} #{@amount} #{$data_system.words.gold}", 1) else $game_system.se_play($data_system.buzzer_se) end end elsif Input.repeat?(Input::UP) && Input.press?(Input::UP) if @amount == 0 $game_system.se_play($data_system.buzzer_se) else $game_system.se_play($data_system.cursor_se) @amount > 10 ? @amount -= 10 : @amount = 0 refresh_windows @help_window.set_text("#{@depositing ? 'Deposit' : 'Withdraw'} #{@amount} #{$data_system.words.gold}", 1) end elsif Input.repeat?(Input::DOWN) && Input.press?(Input::DOWN) if @depositing if @amount < $game_party.gold $game_system.se_play($data_system.cursor_se) @amount < $game_party.gold - 10 ? @amount += 10 : @amount = $game_party.gold refresh_windows @help_window.set_text("#{@depositing ? 'Deposit' : 'Withdraw'} #{@amount} #{$data_system.words.gold}", 1) else $game_system.se_play($data_system.buzzer_se) end else if @amount < $game_bank.account_balance $game_system.se_play($data_system.cursor_se) @amount < $game_bank.account_balance - 10 ? @amount += 10 : @amount = $game_bank.account_balance refresh_windows @help_window.set_text("#{@depositing ? 'Deposit' : 'Withdraw'} #{@amount} #{$data_system.words.gold}", 1) else $game_system.se_play($data_system.buzzer_se) end end elsif Input.repeat?(Input::L) && Input.press?(Input::L) if @amount == 0 $game_system.se_play($data_system.buzzer_se) else $game_system.se_play($data_system.cursor_se) @amount > 100 ? @amount -= 100 : @amount = 0 refresh_windows @help_window.set_text("#{@depositing ? 'Deposit' : 'Withdraw'} #{@amount} #{$data_system.words.gold}", 1) end elsif Input.repeat?(Input::R) && Input.press?(Input::R) if @depositing if @amount < $game_party.gold $game_system.se_play($data_system.cursor_se) @amount < $game_party.gold - 100 ? @amount += 100 : @amount = $game_party.gold refresh_windows @help_window.set_text("#{@depositing ? 'Deposit' : 'Withdraw'} #{@amount} #{$data_system.words.gold}", 1) else $game_system.se_play($data_system.buzzer_se) end else if @amount < $game_bank.account_balance $game_system.se_play($data_system.cursor_se) @amount < $game_bank.account_balance - 100 ? @amount += 100 : @amount = $game_bank.account_balance refresh_windows @help_window.set_text("#{@depositing ? 'Deposit' : 'Withdraw'} #{@amount} #{$data_system.words.gold}", 1) else $game_system.se_play($data_system.buzzer_se) end end end end #-------------------------------------------------------------------------- # * Buy Bond Update #-------------------------------------------------------------------------- def buy_bond_update # Turns On Avaliable Bond Window @av_bond_command.active = true # Turns Off Other Command Windows @main_command.active = @own_bond_command.active = false # Moves In Active Windows @av_bond_display_window.z = @av_bond_command.z = 9999 @av_bond_display_window.x += 32 if @av_bond_display_window.x < 16 @av_bond_command.x -= 25 if @av_bond_command.x > 444 # Moves Out Inactive Windows [@bank_bio_window, @bank_number_window, @own_bond_display_window, @main_command, @own_bond_command].each {|window| window.z = 9995} @bank_bio_window.x -= 32 if @bank_bio_window.x > - 240 @bank_number_window.x += 32 if @bank_number_window.x < 640 @own_bond_display_window.x -= 25 if @own_bond_display_window.x > - 240 [@main_command, @own_bond_command].each {|command| command.x += 25 if command.x < 644} # Input Processing if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) @phase = 0 elsif Input.trigger?(Input::C) if @av_bond_command.index == @bonds.size $game_system.se_play($data_system.cancel_se) @phase = 0 else current_bond = @bonds[@av_bond_command.index].dup if current_bond.cost > $game_party.gold $game_system.se_play($data_system.buzzer_se) else $game_system.se_play($data_system.decision_se) $game_party.lose_gold(current_bond.cost) current_bond.set_times $game_bank.add_bond(current_bond) refresh_windows @phase = 0 end end # Updates Current Bond elsif Input.trigger?(Input::UP) or Input.trigger?(Input::DOWN) @current_bond = @bonds[@av_bond_command.index] refresh_windows end end #-------------------------------------------------------------------------- # * Get Bond Update #-------------------------------------------------------------------------- def get_bond_update # Turns On Avaliable Bond Window @own_bond_command.active = true # Turns Off Other Command Windows @main_command.active = @av_bond_command.active = false # Moves In Active Windows [@own_bond_display_window, @own_bond_command].each {|window| window.z = 9999} @own_bond_display_window.x += 32 if @own_bond_display_window.x < 16 @own_bond_command.x -= 25 if @own_bond_command.x > 444 # Moves Out Inactive Windows [@bank_bio_window, @av_bond_display_window, @main_command, @bank_number_window, @av_bond_command].each {|window| window.z = 9995} [@bank_bio_window, @av_bond_display_window].each {|window| window.x -= 32 if window.x > - 240} [@main_command, @av_bond_command].each {|window| window.x += 25 if window.x < 640} @bank_number_window.x += 32 if @bank_number_window.x < 640 # Input Processing if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) @phase = 0 elsif Input.trigger?(Input::C) if @own_bond_command.index == $game_bank.saving_bonds.size $game_system.se_play($data_system.cancel_se) @phase = 0 else current_bond = $game_bank.saving_bonds[@own_bond_command.index] if current_bond.time_finished > Graphics.frame_count / Graphics.frame_rate $game_system.se_play($data_system.buzzer_se) @help_window.set_text("Savings Bond Not Mature Yet!", 1) else $game_system.se_play($data_system.decision_se) $game_party.gain_gold(current_bond.mature_value) $game_bank.saving_bonds.delete_at[@own_bond_command.index] refresh_windows @phase = 0 end end elsif Input.trigger?(Input::UP) or Input.trigger?(Input::DOWN) @current_bond = $game_bank.saving_bonds[@own_bond_command.index] refresh_windows end end #-------------------------------------------------------------------------- # * Exit Update #-------------------------------------------------------------------------- def exit_update # Moves Out Windows @help_window.y -= 4 if @help_window.y > - 64 [@bank_bio_window, @av_bond_display_window].each {|window| window.x -= 32 if window.x > - 240} [@own_bond_display_window].each {|window| window.x -= 25 if window.x > - 240} [@main_command, @bank_number_window, @av_bond_command, @own_bond_command].each {|window| window.x += 25 if window.x < 640} # Checks To Make Sure All Windows Are Out if @help_window.y <= - 64 && @bank_bio_window.x <= - 240 && @av_bond_display_window.x <= - 240 && @own_bond_display_window.x <= - 240 && @main_command.x >= 644 && @bank_number_window.x >= 640 && @av_bond_command.x >= 640 && @own_bond_command.x >= 640 $scene = Scene_Map.new end end #-------------------------------------------------------------------------- # * Get CD List #-------------------------------------------------------------------------- def get_cd_list commands = [] $game_bank.saving_bonds.each {|x| commands.push(x.name)} commands.push("Back") return commands end #-------------------------------------------------------------------------- # * Refresh Windows #-------------------------------------------------------------------------- def refresh_windows @bank_bio_window.refresh @av_bond_display_window.refresh(@current_bond, @bond_bought) @own_bond_display_window.refresh(@current_bond, @bond_bought) @bank_number_window.refresh(@amount, @depositing ? "Deposit" : "Withdraw") @own_bond_command.refresh(get_cd_list) end end Scripts; Updated; Scripts Demo Added - Geowil - 02-17-2010 mawk Wrote:not sure what you mean by "destroyed" -- the old rmxp.org is still going under a different name, and this is a fairly recent newcomer. the other places have been fairly turmoil-free, too. hmm, I did not know that (about the old RMXP, I tried rmxp.net but the site is gone. Last I knew that is where they were at.) Scripts; Updated; Scripts Demo Added - basketball jones - 02-17-2010 oh wow you're a real oldie, then. :O rmxp.net went through tons of administration changes and is now called hbgames.org. this is a fairly new site using the old domain name, but a lot of the members are longtime rm users. Scripts; Updated; Scripts Demo Added - Geowil - 02-17-2010 Wachunga's Fog of War Script: Instructions: Installation: Create a new class above ââ¬ÅMainââ¬Â and place the spoiler script into it. If you are using Rataime's Sun/Shadow scripts, please place the new class for this under those. Next right click on the following image and save asââ¬Â¦ Then import it into your database in RMXP. This is the FOW tile, its required for the script to work. My ââ¬ÅSmokeââ¬Â edit: Usage: Ok, now, before we get into too much here, please be aware that there is a newer version of this but I am using this older one. Now to use this place <FOW> into the map name of the map that you want to use it on. You can customize it a bit by adding a <#> after the <FOW> (# = 1-3). Each sequential number adds more view tiles to the area that you uncover as you walk through the FOW. Fog of War
=begin ============ Fog of War - version 1.01 (2005-11-04) ============ by Wachunga 0.8 - original release 0.85 - added colour parameter to map names - fixed bug where map grids overlapped 0.9 - switched over to a tilemap (from a sprite) - now more compatible with minimap scripts (but they'll have to take extra tilemap into account) 1.0 - switched over to an autotile instead of using a custom tileset * edges looks nicer, but gradual fading had to be removed * colour parameter no longer possible (set by autotile) - move event (including jumping and speed changes) bug fixed - teleportation bug fixed - some optimization - made compatible with Cogwheel's Pixel Movement script (see http://www.rmxp.net/forums/index.php?showtopic=24716 for details) 1.01 - fixed bug when teleporting from map without FoW to a map with FoW Note: There's no need to add the autotile via the database. Just place the file in the autotile folder, import it, and change the FOW_AT_NAME constant to the appropriate filename. To change the colour of the fog of war, create a new autotile. To indicate a map is to have fog of war (i.e. its tiles are dark until the player gets within visual range), include <FoW> in its name. You may also optionally specify a range between 0 and 3. This may also be included in the map name, as in this example: "your-map-name <FoW><2>" (range is 2) The ranges work as follows: range = 0 reveals just the square on which the player stands range = 1 is the same as range 0 plus four adjacent tiles i.e. @ @P@ @ range = 2 is the same as range 1 plus eight additional tiles i.e. @ @@@ @@P@@ @@@ @ range = 3 (default) is the same as range 2 plus twelve additional tiles i.e. @ @@@ @@@@@ @@@P@@@ @@@@@ @@@ @ =end #------------------------------------------------------------------------------- FOW = 0b00 REVEALED = 0b01 # tiles with no surrounding fog are flagged "SKIP" for efficiency SKIP = 0b10 FOW_AT_NAME = "fow_default" #------------------------------------------------------------------------------- class Game_Map attr_reader :fow_on attr_reader :fow_grid attr_reader :fow_range alias dm_setup setup_map def setup_map(map_id) dm_setup(map_id) # set defaults @fow_on = false @fow_grid = nil @fow_range = 3 # get any tags from the map name tags = $game_map.map_name.delete(' ').scan(/<[A-Za-z0-9_.,]+>/) if not tags.empty? and tags[0].upcase == '<FOW>' tags.shift # remove FOW tag @fow_on = true if @fow_grid == nil # only if not already defined @fow_grid = Array.new(@map.width, FOW) for i in 0...@map.width @fow_grid[i] = Array.new(@map.height, FOW) end end # check if range specified, else default to 3 if not tags.empty? x = tags[0].delete("<>").to_i @fow_range = x if x >= 0 and x < 4 end end end =begin Updates the underlying grid which keeps track of which tiles have been "discovered" (i.e. no fog of war) based on where player has already explored. =end def update_fow_grid px = $game_player.x py = $game_player.y @fow_grid[px][py] |= REVEALED # reveal more, depending on range if @fow_range > 0 if px > 0 @fow_grid[px-1][py] |= REVEALED end if py < @map.height-1 @fow_grid[px][py+1] |= REVEALED end if py > 0 @fow_grid[px][py-1] |= REVEALED end if px < @map.width-1 @fow_grid[px+1][py] |= REVEALED end if @fow_range > 1 if px > 0 if py > 0 @fow_grid[px-1][py-1] |= REVEALED end if py < @map.height-1 @fow_grid[px-1][py+1] |= REVEALED end if px > 1 @fow_grid[px-2][py] |= REVEALED end end if px < @map.width-1 if py > 0 @fow_grid[px+1][py-1] |= REVEALED end if py < @map.height-1 @fow_grid[px+1][py+1] |= REVEALED end end if px < @map.width-2 @fow_grid[px+2][py] |= REVEALED end if py > 1 @fow_grid[px][py-2] |= REVEALED end if py < @map.height-2 @fow_grid[px][py+2] |= REVEALED end if @fow_range > 2 if px > 0 if py > 1 @fow_grid[px-1][py-2] |= REVEALED end if py < @map.height-2 @fow_grid[px-1][py+2] |= REVEALED end if px > 1 if py > 0 @fow_grid[px-2][py-1] |= REVEALED end if py < @map.height-1 @fow_grid[px-2][py+1] |= REVEALED end if px > 2 @fow_grid[px-3][py] |= REVEALED end end end if px < @map.width-1 if py > 1 @fow_grid[px+1][py-2] |= REVEALED end if py < @map.height-2 @fow_grid[px+1][py+2] |= REVEALED end if px < @map.width-2 if py > 0 @fow_grid[px+2][py-1] |= REVEALED end if py < @map.height-1 @fow_grid[px+2][py+1] |= REVEALED end if px < @map.width-3 @fow_grid[px+3][py] |= REVEALED end end end if py > 2 @fow_grid[px][py-3] |= REVEALED end if py < @map.height-3 @fow_grid[px][py+3] |= REVEALED end end end end end def map_name return load_data("Data/MapInfos.rxdata")[@map_id].name end end #------------------------------------------------------------------------------- class Spriteset_Map def initialize @viewport1 = Viewport.new(0, 0, 640, 480) @viewport2 = Viewport.new(0, 0, 640, 480) @viewport3 = Viewport.new(0, 0, 640, 480) @viewport2.z = 200 @viewport3.z = 5000 @tilemap = Tilemap.new(@viewport1) @tilemap.tileset = RPG::Cache.tileset($game_map.tileset_name) for i in 0..6 autotile_name = $game_map.autotile_names[i] @tilemap.autotiles[i] = RPG::Cache.autotile(autotile_name) end @tilemap.map_data = $game_map.data @tilemap.priorities = $game_map.priorities @panorama = Plane.new(@viewport1) @panorama.z = -1000 @fog = Plane.new(@viewport1) @fog.z = 3000 @character_sprites = [] for i in $game_map.events.keys.sort sprite = Sprite_Character.new(@viewport1, $game_map.events[i]) @character_sprites.push(sprite) end @character_sprites.push(Sprite_Character.new(@viewport1, $game_player)) @weather = RPG::Weather.new(@viewport1) @picture_sprites = [] for i in 1..50 @picture_sprites.push(Sprite_Picture.new(@viewport2, $game_screen.pictures[i])) end @timer_sprite = Sprite_Timer.new # add fog of war tilemap... if $game_map.fow_on for m in 0...$game_map.width for n in 0...$game_map.height # reset SKIP flag $game_map.fow_grid[m][n] &= ~SKIP end end @fow_tilemap = Tilemap.new(@viewport1) @fow_tilemap.autotiles[0] = RPG::Cache.autotile(FOW_AT_NAME) @fow_autotiles = Hash.new(0) j = 48 # starting autotile index for i in Autotile_Keys @fow_autotiles[i] = j j += 1 end # add duplicates for i in Duplicate_Keys.keys @fow_autotiles[i] = @fow_autotiles[Duplicate_Keys[i]] end data = Table.new($game_map.width, $game_map.height, 3) # set everything to fog for x in 0...$game_map.width for y in 0...$game_map.height data[x,y,2] = 48 # fog end end @fow_tilemap.map_data = data priorities = Table.new(96) # set to highest priority to ensure everything is covered for i in 48...96 priorities[i] = 5 end @fow_tilemap.priorities = priorities $game_map.update_fow_grid update_fow_tilemap # reveal any explored tiles end update end =begin Updates the fog of war tilemap based on the map's underlying grid. This method is called by Game_Player.update whenever the player moves. =end def update_fow_tilemap checked = Array.new($game_map.width,0) for k in 0...$game_map.width checked[k] = Array.new($game_map.height,0) end for x in (($game_map.display_x/128)-1).round .. (($game_map.display_x/128)+21).round for y in (($game_map.display_y/128)-1).round .. (($game_map.display_y/128)+16).round # check boundaries if x > $game_map.width - 1 or x < 0 then next end if y > $game_map.height - 1 or y < 0 then next end if $game_map.fow_grid[x][y] == REVEALED # (but not SKIP) others = false @fow_tilemap.map_data[x,y,2] = 0 if @fow_tilemap.map_data[x,y,2] != 0 for i in x-1 .. x+1 for j in y-1 .. y+1 # check new boundaries if i > $game_map.width - 1 or i < 0 then next end if j > $game_map.height - 1 or j < 0 then next end if $game_map.fow_grid[i][j] == FOW others = true # can't flag as SKIP because there's nearby fog if checked[i][j] == 0 checked[i][j] = 1 # only fill if not already revealed if @fow_tilemap.map_data[i,j,2] != 0 # calculate adjacent fog adj = '' if (i == 0) adj << '147' else if (j == 0) then adj << '1' else if ($game_map.fow_grid[i-1][j-1] == FOW) then adj << '1' end end if ($game_map.fow_grid[i-1][j] == FOW) then adj << '4' end if (j == $game_map.height-1) then adj << '7' else if ($game_map.fow_grid[i-1][j+1] == FOW) then adj << '7' end end end if (i == $game_map.width-1) adj << '369' else if (j == 0) then adj << '3' else if ($game_map.fow_grid[i+1][j-1] == FOW) then adj << '3' end end if ($game_map.fow_grid[i+1][j] == FOW) then adj << '6' end if (j == $game_map.height-1) then adj << '9' else if ($game_map.fow_grid[i+1][j+1] == FOW) then adj << '9' end end end if (j == 0) adj << '2' else if ($game_map.fow_grid[i][j-1] == FOW) then adj << '2' end end if (j == $game_map.height-1) adj << '8' else if ($game_map.fow_grid[i][j+1] == FOW) then adj << '8' end end # if no adjacent fog, set it as 0 if (adj == '') then adj = '0' end # convert to an array, sort, and then back to a string adj = adj.split(//).sort.join @fow_tilemap.map_data[i,j,2] = eval '@fow_autotiles[adj.to_i]' end end end end end if not others # no adjacent fog found, so flag tile to prevent processing again $game_map.fow_grid[x][y] |= SKIP end end end end end alias old_dispose dispose def dispose if @fow_tilemap != nil @fow_tilemap.dispose end old_dispose end alias old_update update def update if $game_map.fow_on == true @fow_tilemap.ox = $game_map.display_x / 4 @fow_tilemap.oy = $game_map.display_y / 4 @fow_tilemap.update end old_update end end #------------------------------------------------------------------------------- class Game_Player def initialize super @last_x = @x @last_y = @y end def update_jump super # only update when about to land, not revealing anything jumped over if $game_map.fow_on and @jump_count == 0 $game_map.update_fow_grid $scene.spriteset.update_fow_tilemap end end def update_move super if $game_map.fow_on and (@x != @last_x or @y != @last_y) unless jumping? $game_map.update_fow_grid $scene.spriteset.update_fow_tilemap end end @last_x = @x @last_y = @y end end #------------------------------------------------------------------------------- class Scene_Map attr_reader :spriteset end =begin Autotile in column 2: row\col| 1 2 3 4 5 6 7 8 --------------------------- 1 | 48 49 50 51 52 53 54 55 2 | 56 57 58 59 60 61 62 63 3 | 64 65 66 67 68 69 70 71 4 | 72 73 74 75 76 77 78 79 5 | 80 81 82 83 84 85 86 87 6 | 88 89 90 91 92 93 94 95 The function to return the index of a single tile within an autotile (given by at_index) is (at_index-1)*48 + col-1 + (row-1)*8 (where row, col, and at_index are again NOT zero-indexed) =end =begin The following array lists systematic keys which are based on adjacent walls (where 'W' is the wall itself): 1 2 3 4 W 6 7 8 9 e.g. 268 is the key that will be used to refer to the autotile which has adjacent walls north, east, and south. For the Castle Prison tileset (autotile #1), this is 67. (It's a bit unwieldy, but it works.) =end Autotile_Keys = [ 12346789, 2346789, 1246789, 246789, 1234678, 234678, 124678, 24678, 1234689, 234689, 124689, 24689, 123468, 23468, 12468, 2468, 23689, 2689, 2368, 268, 46789, 4678, 4689, 468, 12478, 1248, 2478, 248, 12346, 2346, 1246, 246, 28, 46, 689, 68, 478, 48, 124, 24, 236, 26, 8, 6, 2, 4, 0 ] # many autotiles handle multiple situations # this hash keeps track of which keys are identical # to ones already defined above Duplicate_Keys = { 123689 => 23689, 236789 => 23689, 1236789 => 23689, 34689 => 4689, 14689 => 4689, 134689 => 4689, 14678 => 4678, 34678 => 4678, 134678 => 4678, 146789 => 46789, 346789 => 46789, 1346789 => 46789, 23467 => 2346, 23469 => 2346, 234679 => 2346, 123467 => 12346, 123469 => 12346, 1234679 => 12346, 12467 => 1246, 12469 => 1246, 124679 => 1246, 124789 => 12478, 123478 => 12478, 1234789 => 12478, 146 => 46, 346 => 46, 467 => 46, 469 => 46, 1346 => 46, 1467 => 46, 1469 => 46, 3467 => 46, 3469 => 46, 4679 => 46, 13467 => 46, 13469 => 46, 14679 => 46, 34679 => 46, 134679 => 46, 128 => 28, 238 => 28, 278 => 28, 289 => 28, 1238 => 28, 1278 => 28, 1289 => 28, 2378 => 28, 2389 => 28, 2789 => 28, 12378 => 28, 12389 => 28, 12789 => 28, 23789 => 28, 123789 => 28, 1247 => 124, 2369 => 236, 147 => 4, 247 => 24, 14 => 4, 47 => 4, 1478 => 478, 3478 => 478, 4789 => 478, 134789 => 478, 14789 => 478, 13478 => 478, 34789 => 478, 1234 => 124, 1247 => 124, 1249 => 124, 12347 => 124, 12349 => 124, 12479 => 124, 123479 => 124, 1236 => 236, 2367 => 236, 2369 => 236, 12367 => 236, 12369 => 236, 23679 => 236, 123679 => 236, 12368 => 2368, 23678 => 2368, 123678 => 2368, 12348 => 1248, 12489 => 1248, 123489 => 1248, 1689 => 689, 3689 => 689, 6789 => 689, 13689 => 689, 16789 => 689, 36789 => 689, 136789 => 689, 12689 => 2689, 26789 => 2689, 126789 => 2689, 23478 => 2478, 24789 => 2478, 234789 => 2478, 12 => 2, 23 => 2, 27 => 2, 29 => 2, 123 => 2, 127 => 2, 129 => 2, 237 => 2, 239 => 2, 279 => 2, 1237 => 2, 1239 => 2, 1279 => 2, 2379 => 2, 12379 => 2, 14 => 4, 47 => 4, 34 => 4, 49 => 4, 147 => 4, 134 => 4, 347 => 4, 349 => 4, 149 => 4, 479 => 4, 1347 => 4, 1479 => 4, 1349 => 4, 3479 => 4, 13479 => 4, 16 => 6, 36 => 6, 67 => 6, 69 => 6, 136 => 6, 167 => 6, 169 => 6, 367 => 6, 369 => 6, 679 => 6, 1369 => 6, 3679 => 6, 1367 => 6, 1679 => 6, 13679 => 6, 78 => 8, 89 => 8, 18 => 8, 38 => 8, 138 => 8, 789 => 8, 178 => 8, 189 => 8, 378 => 8, 389 => 8, 1789 => 8, 3789 => 8, 1378 => 8, 1389 => 8, 13789 => 8, 1468 => 468, 3468 => 468, 13468 => 468, 2467 => 246, 2469 => 246, 24679 => 246, 2348 => 248, 2489 => 248, 23489 => 248, 1268 => 268, 2678 => 268, 12678 => 268, 148 => 48, 348 => 48, 489 => 48, 1348 => 48, 1489 => 48, 3489 => 48, 13489 => 48, 168 => 68, 368 => 68, 678 => 68, 1368 => 68, 1678 => 68, 3678 => 68, 13678 => 68, 234 => 24, 247 => 24, 249 => 24, 2347 => 24, 2349 => 24, 2479 => 24, 23479 => 24, 126 => 26, 267 => 26, 269 => 26, 1267 => 26, 1269 => 26, 2679 => 26, 12679 => 26, } Xsilverblade's/Advocate's Floating Location Window: Instructions: Installation: Alright, first thing to do here is find this in Scene_Map: Quote:@message_window = Window_Message.new Put this directly underneath it: Quote: @location_window = Window_Location.new Next find these and place the following lines of code under them as well: Quote:@message_window.update Quote:@location_window.update Ok, next go to the very end of it where you see this: Quote:# ??????????? BGM ? BGS ?????????? Add this after that end command: Quote: def set_location(location) Now, create a new class above 'Main' and call it Floating Location Window, then add the spoiler code to it. Usage: Now, for how to use this. I like this location window script because you input the map name manually, so if your using a script that has you put <text> in the map name it wont show up lol. So, how do we go about using this you ask? In a Call Script in an empty event set to 'auto start' in the trigger options we put this: Quote:$scene.set_location ("Map Name") Replace map name with the name of your map. Now, we want this to work every time we enter or exit this map, so, in that same event, create a new switch operation and call it Location Switch, well I did that but you can call it what you will. Now, every time you make a teleport, under the teleport command, put in the location switch operation and set it to off so that it will turn on and process the call script. You must do this for every Teleport event that you make, otherwise the location window wont show. So your teleport events should look like this: Quote: Teleport [map #: map name], (coordinates) Floating Location Window
class Window_Location < Window_Base #------------------------------ attr_accessor :location #-------------------------------------------------------------------------- # Initialize the Object. #-------------------------------------------------------------------------- def initialize super(144, 4, 352, 64) self.contents = Bitmap.new(width - 32, height - 32) self.back_opacity = 255 self.contents.font.name = "OldEnglish" self.contents.font.size = 20 self.opacity = 0 self.z = 1050 @dummy_window = Window_Base.new(144, 10, 352, 52) @dummy_window.z = 1000 @dummy_window.opacity = 255 @dummy_window.visible = false @location = "" @frames = -1 refresh end #---------------------------------- def location=(location) if location != "" @location = location @frames = 120 @dummy_window.visible = true self.visible = true refresh else @location = "" @dummy_window.visible = false self.visible = false end end #-------------------------------------------------------------------------- # Refresh. #-------------------------------------------------------------------------- def refresh self.contents.clear self.contents.draw_text(0, 0, self.width - 32, 32, @location, 1) end # ------------- def dispose super @dummy_window.dispose end #-------------------------------------------------------------------------- # Frame Update. #-------------------------------------------------------------------------- def update super if @frames > 0 @frames -= 1 end if @frames == 0 @frames = -1 self.visible = false @dummy_window.visible = false end end end That's all the scripts that I have installation instructions for at the moment. I will post up some more when I get the instructions made. If you want to see all of the scripts at work, download this Scripts Demo: Scripts Demo It contains around 28 scripts in total, some of them, namely KGCââ¬â¢s limit breaker, had to be modified to work properly with each other. You may need to change the font for the demo, I think I may have left it set as Olde English, a custom font I was using. Scripts; Updated; Scripts Demo Added - PK8 - 03-04-2010 SephirtohSpawn's Enemies that Level Up Script: Instructions: Installation: If you are using KGCââ¬â¢s Limit Breaker script be aware that this script does not work well with it. Now, make a new class called Enemies that Level Up above 'Main' and Put the spoiler code into it. Usage: All right, this script is jus like it sounds. Like in FF8 the enemies level up as you do, so in the database, set the stats of your monsters to their lvl 99 stats, other wise they will be very weak. Sephiroth decided to add Tricksters Boss Monster script so there are a few things you must do. First off as I said before, make the stats of your monsters at their lvl 99 forms. Also, if you have a boss monster add (BOSS) to the name in the database like this: Quote:Boss Monster Name(BOSS) This will tell the script not to work its magic on these monsters marked as (BOSS) and also the word (BOSS) wont show up in the names in case you were wondering. And thatââ¬â¢s all there is to it. Enemies that Level Up
#============================================================================== # Enemies That Level UP #-------------------------------------------------------------------------- # Created By SephirothSpawn (11.17.05) # Last Updated: 11.18.05 # Updated: Can Make Enemies Bosses (They Do Not Level Up) 11.18.05 #============================================================================== #============================================================================== # Module RPG #============================================================================== module RPG #========================================================================= # Class Weapon #========================================================================= class Enemy #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- # Base Statistics attr_accessor :b_maxhp, :b_maxsp, :b_str, :b_dex, :b_agi, :b_int attr_accessor :b_atk, :b_pdef, :b_mdef, :b_eva, :b_exp, :b_gold # Boss Check attr_accessor :boss #-------------------------------------------------------------------------- # * Set Bases #-------------------------------------------------------------------------- def set_bases @b_maxhp, @b_maxsp = @maxhp, @maxsp @b_str, @b_dex, @b_agi, @b_int = @str, @dex, @agi, @int @b_atk, @b_pdef, @b_mdef, @b_eva = @atk, @pdef, @mdef, @eva @b_exp, @b_gold = @exp, @gold # Checks to See if there's a boss if @name.include?("(BOSS)") @boss = true @name.slice!("(BOSS)") else @boss = false end end #-------------------------------------------------------------------------- # * Update Level #-------------------------------------------------------------------------- def update_level unless @boss # Calulates Average Level of Party average = 0 for actor in $game_party.actors average += actor.level end average /= $game_party.actors.size # Adds 1 (So when you're at level 99, 100% of the Stats are used) average += 5 # Set to a percent average /= 200.000 # Update Stats @maxhp = (@b_maxhp * average).to_i @maxsp = (@b_maxsp * average).to_i @str = (@b_str * average).to_i @dex = (@b_dex * average).to_i @agi = (@b_agi * average).to_i @int = (@b_int * average).to_i @atk = (@b_atk * average).to_i @pdef = (@b_pdef * average).to_i @mdef = (@b_mdef * average).to_i @eva = (@b_eva * average).to_i @exp = (@b_exp * average + 1).to_i @gold = (@b_gold * average + 1).to_i end end end end #============================================================================== # Class Scene Title #============================================================================== class Scene_Title #-------------------------------------------------------------------------- # * Alias' New Game Method #-------------------------------------------------------------------------- alias new_game command_new_game #-------------------------------------------------------------------------- # * Adds Base Stats For Enemies #-------------------------------------------------------------------------- def command_new_game for i in 1...$data_enemies.size $data_enemies[i].set_bases end new_game end end #============================================================================== # Class Scene Battle #============================================================================== class Scene_Battle #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize for i in 1...$data_enemies.size $data_enemies[i].update_level end end end #Trickster & SephirothSpawn Squall789's FF7 Credits Script: Instructions: Installation: Make a new class above ââ¬ÅMainââ¬Â and place the spoiler code into it. Usage: This script creates a credits roll similar to the ones used at the beginning of FF7. You can call this a couple of ways. You can make it run from the start of your game by replacing this in ââ¬ÅMainââ¬Â: Quote:$scene = Scene_Title.new with this: Quote: $scene = FFVII_Credits.new Or you can make then run from any point in your game by putting the code above ($scene = FFVII_Credits.new) into a call script in an event. If you are going to take sections out, make sure you take everything out related to that section. So if you want to take all of section 15 out, find everything related to 15 and delete it. Ok, these lines are for the background and sound: Quote:@Background.bitmap = RPG::Cache.picture(" ") put the name of the song you are going to use in the ". Also the 100,100 elements are for volume and pitch, so edit those accordingly. FF7 Credits Script
#===================================================== # - Final Fantasy VII opening Credits Script # - Written By Squall789 #===================================================== # - To use this script in another Project copy the script into a new Page on # - The script Editor. # - Then in Main replace "$scene = Scene_Title.new" with "$scene = FFVII_Credits.new" class FFVII_Credits # - Setting the class def main $data_system = load_data("Data/System.rxdata") $game_system = Game_System.new # - Drawing up the Background for Scene FFVII_Credits @Background = Sprite.new @Background.bitmap = RPG::Cache.picture(" ") @Background.opacity = 255 @sprite1 = Window1.new # - Producer Name @sprite1.x = 120 @sprite1.y = 320 @sprite2 = Window2.new # - Producer Title Window (sprite2 = Producer) @sprite2.x = 321 @sprite2.y = - 60 # - Plays the Background Music (Obviously!) Audio.bgm_play("Audio/BGM/" + " ", 100, 100) @sprite3 = Window3.new # - Main Scripter @sprite3.x = - 200 @sprite3.y = 60 @sprite4 = Window4.new # - Main Scripter Name (Squall789) @sprite4.x = 20 @sprite4.y = 458 @sprite5 = Window5.new # - Director Name @sprite5.x = 170 @sprite5.y = - 120 @sprite6 = Window6.new # - Director Title @sprite6.x = - 120 @sprite6.y = 120 @sprite7 = Window7.new # - Main Programmer Title @sprite7.x = 680 @sprite7.y = 110 @sprite8 = Window8.new # - Main programmer name @sprite8.x = 450 @sprite8.y = - 90 @sprite9 = Window9.new # - Composer name @sprite9.x = - 150 @sprite9.y = 400 @sprite10 = Window10.new # - Composer Title @sprite10.x = 30 @sprite10.y = 540 @sprite11 = Window11.new # - Artist Battles Ect... Title! @sprite11.x = 680 @sprite11.y = 90 @sprite12 = Window12.new # - Artist Name ect... @sprite12.x = 460 @sprite12.y = - 90 @sprite13 = Window13.new # - Special thanks Itself! @sprite13.x = - 142 @sprite13.y = 320 @sprite14 = Window14.new # - Special thanks Names @sprite14.x = 320 @sprite14.y = - 90 @Button = Window15.new @Button.x = 220 @Button.y = 210 @Button.contents_opacity = 0 @Button.visible = false Graphics.transition loop do Graphics.update Input.update update if $scene != self break end end Graphics.freeze @Background.dispose @sprite1.dispose @sprite2.dispose @sprite3.dispose @sprite4.dispose @sprite5.dispose @sprite6.dispose @sprite7.dispose @sprite8.dispose @sprite9.dispose @sprite10.dispose @sprite11.dispose @sprite12.dispose @sprite13.dispose @sprite14.dispose @Button.dispose end def update # - Longer than you thought aint it! # - Message to ALL n00bs # - Sorry I made things look so complicated if @sprite1.x > 119 @sprite1.x += 2 end if @sprite1.x > 319 @sprite1.x = 321 end if @sprite1.x == 321 @sprite2.y += 2 end if @sprite2.y > 298 @sprite2.y = 299 end if @sprite2.y == 299 and @sprite1.x == 321 @sprite1.contents_opacity -= 2 @sprite2.contents_opacity -= 2 end if @sprite1.contents_opacity < 1 @sprite1.active = false @sprite2.active = false @sprite3.x += 1 @sprite4.y -= 2 if @sprite4.y < 40 @sprite4.y = 40 end end if @sprite3.x > 89 @sprite3.x = 90 @sprite3.contents_opacity -= 2 @sprite4.contents_opacity -= 2 end if @sprite3.contents_opacity < 1 @sprite3.active = false @sprite4.active = false @sprite5.y += 1 @sprite6.x += 1 if @sprite5.y > 137 and @sprite6.x > 137 @sprite5.y = 138 @sprite6.x = 138 end end if @sprite5.y == 138 and @sprite6.x == 138 @sprite5.contents_opacity -= 2 @sprite6.contents_opacity -= 2 end if @sprite5.contents_opacity < 1 @sprite7.x > 639 @sprite8.y < - 89 @sprite8.y += 1 @sprite7.x -= 1 end if @sprite7.x < 461 @sprite7.x = 460 @sprite8.y = 130 @sprite7.contents_opacity -=2 @sprite8.contents_opacity -=2 end if @sprite8.contents_opacity < 1 @sprite9.x += 1 @sprite10.y -= 1 end if @sprite10.y < 381 @sprite10.y = 381 @sprite9.x = 10 @sprite9.contents_opacity -= 2 @sprite10.contents_opacity -= 2 end if @sprite10.contents_opacity < 1 @sprite11.x > 639 @sprite12.y < - 89 @sprite12.y += 1 @sprite11.x -= 1 end if @sprite11.x < 461 @sprite11.x = 460 @sprite12.y = 130 @sprite11.contents_opacity -=2 @sprite12.contents_opacity -=2 end if @sprite12.contents_opacity < 1 @sprite13.x += 1 @sprite14.y += 1 end if @sprite13.x > 300 @sprite13.x = 302 @sprite14.y = 341 @sprite13.contents_opacity -= 2 @sprite14.contents_opacity -= 2 end if @sprite14.contents_opacity < 1 @Button.visible = true @Button.contents_opacity +=1 end if Input.trigger?(Input::C) $scene = Scene_Title.new end end end# end of class #=================================================== # - Window_Text (Contains the Credits themselves) #=================================================== class Your_Scene def main Graphics.freeze @window1.dispose @window2.dispose @window3.dispose @window4.dispose @window5.dispose @window6.dispose @window7.dispose @window8.dispose @window9.dispose @window10.dispose end end #=================================================== # - Window Producer name text begins #=================================================== class Window1 < Window_Base def initialize super(0, 0, 210,60) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = "Tahoma" self.contents.font.size = 22 self.opacity = 0 self.contents.draw_text(0, 0, 110, 33, "Squall789") end end #=================================================== # - Window Producer Title Text Begins #=================================================== class Window2 < Window_Base def initialize super(0, 0, 140,60) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = "Arial Black" self.contents.font.size = 22 self.opacity = 0 self.contents.draw_text(0, 0, 133, 33, "Producer") end end #=================================================== # - Window Main Scripter Name text begins #=================================================== class Window3 < Window_Base def initialize super(0, 0, 140,60) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = "Tahoma" self.contents.font.size = 22 self.opacity = 0 self.contents.draw_text(0, 0, 133, 33, "Squall789") end end #=================================================== # - Window Mian Scripter Title Text Begins #=================================================== class Window4 < Window_Base def initialize super(0, 0, 290,60) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = "Arial Black" self.contents.font.size = 22 self.opacity = 0 self.contents.draw_text(0, 0, 290, 33, " Main Scripter") end end #=================================================== # - Window Director Name Text Begins #=================================================== class Window5 < Window_Base def initialize super(0, 0, 140,60) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = "Tahoma" self.contents.font.size = 22 self.opacity = 0 self.contents.draw_text(0, 0, 133, 33, "Squall789") end end #=================================================== # - Window Director Name Title Begins #=================================================== class Window6 < Window_Base def initialize super(0, 0, 140,60) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = "Arial Black" self.contents.font.size = 22 self.opacity = 0 self.contents.draw_text(0, 0, 133, 33, "Director") end end #=================================================== # - Window Main Programmer Title Begins #=================================================== class Window7 < Window_Base def initialize super(0, 0, 210,60) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = "Arial Black" self.contents.font.size = 22 self.opacity = 0 self.contents.draw_text(0, 0, 210, 33, "Main Programmer") end end #=================================================== # - Window Main Programmer Name Begins #=================================================== class Window8 < Window_Base def initialize super(0, 0, 180,60) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = "Tahoma" self.contents.font.size = 22 self.opacity = 0 self.contents.draw_text(0, 0, 178, 33, " Squall789") end end #=================================================== # - Window Composer Title Begins #=================================================== class Window9 < Window_Base def initialize super(0, 0, 240,60) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = "Tahoma" self.contents.font.size = 22 self.opacity = 0 self.contents.draw_text(0, 0, 233, 33, " Nobuo Uematsu") end end #=================================================== # - Window Composer name Begins #=================================================== class Window10 < Window_Base def initialize super(0, 0, 240,60) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = "Arial Black" self.contents.font.size = 22 self.opacity = 0 self.contents.draw_text(0, 0, 233, 33, "Composer") end end #=================================================== # - Window Battle Script designer Title Begins #=================================================== class Window11 < Window_Base def initialize super(0, 0, 240,240) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = "Arial Black" self.contents.font.size = 22 self.opacity = 0 self.contents.draw_text(0, 0, 133, 33, "Character Design &") self.contents.draw_text(0, 0, 143, 63, "Battle Visual Director") end end #=================================================== # - Window Battle Script Designer Name Begins #=================================================== class Window12 < Window_Base def initialize super(0, 0, 240,60) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = "Tahoma" self.contents.font.size = 22 self.opacity = 0 self.contents.draw_text(0, 0, 233, 33, "Tetsuya Nomura") end end #=================================================== # - Window Special thanks Begins #=================================================== class Window13 < Window_Base def initialize super(0, 0, 340,240) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = "Arial" self.contents.font.size = 22 self.opacity = 0 self.contents.draw_text(0, 0, 333, 33, "Special Thanks") end end #=================================================== # - Window Special Thanks Names begins #=================================================== class Window14 < Window_Base def initialize super(0, 0, 240,60) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = "Tahoma" self.contents.font.size = 22 self.opacity = 0 self.contents.draw_text(0, 0, 133, 33, "Squaresoft") end end #=================================================== # - This Creates the "Please Press Start" Screen #=================================================== class Window15 < Window_Base def initialize super(0, 0, 440,360) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = "Tahoma" self.contents.font.size = 28 self.opacity = 0 self.contents.draw_text(0, 0, 433, 33, "Thankyou For watching") self.contents.font.size = 24 self.contents.draw_text(0, 20, 433, 33, "FFVII Opening Credits script") self.contents.draw_text(0, 40, 433, 33, "By Squall789") end end Teh_Freak's Quest Script: Instructions: Installation: Create a new class above ââ¬ÅMainââ¬Â and place the first spoilered code into it. IMPORTANT: If your Scene_Menu has edits to it continue. If it does not, it will be faster to use the pre-edited Scene_Menu from below (second spoiler code). Now, in your scene_menu class, after the last s# object add S# (where # is the number after the last object. So if you have an s5 this one is s6) = "Quest Window". Example: Quote:s6 = ââ¬ÅQuest Windowââ¬Â In the line that has (s1, s2, s3, s4, s5 ect) add the s# from the quest window's line, so, if we continue with it being 6, its (s1, s2, s3, s4, s5, s6). Now, find the @dispose's and @update's in the "Scene_Menu' and add this to the respective group: Quote:@quest_window.dispose Now, under: Quote: @status_window = Window_MenuStatus.new add this: Quote:#Teh_Freak - Quest Window Under this: Quote:update_commandadd this: Quote:# Teh_Freak - update the quest window Under this: Quote:if @status_window.active add this: Quote:#------------------------------------------------------------------------ and that should do it. Now, you might get an error in "Scene_Menu" If you do, and the erroring line is the last end in Scene_Menu, then comment it out by putting a # in front of it. Usage: This script is a tricky one to use, for a few reasons: You need to put some edits into a few classes and you need to decide how many normal items you are going to create, because after a certain number, the items all become quest items. So, first off, in "Window_Item" find this: Quote: def initialize and add this under that: Quote:@quest_number = 33 #Teh_Freak - this is the item ID of the FIRST quest item I used 33, but you'll want to set it higher if you are, or have, making or made custom items. Now, we donââ¬â¢t want to be able to sell these items now do we, so we go to 'Window_ShopSell' and add find this: Quote:def initialize and again, add this underneath that: Quote:@quest_number = 33 #Teh_Freak - this is the item ID of the FIRST quest item Now any item after 33 will now be a quest item. The description will be the quest items description, so make sure you label them right. Also, after you complete a quest, you might want to make a quest called "questââ¬â¢s name"- complete so that you know itââ¬â¢s completed. Again, thatââ¬â¢s what I am doing with mine. Quest Window
#============================================================================== # ? Window_Quest #------------------------------------------------------------------------------ # Based on Window_Item, with several changes #============================================================================== class Window_Quest < Window_Selectable #-------------------------------------------------------------------------- # ? ????????? #-------------------------------------------------------------------------- def initialize super(0, 0, 480, 480) @column_max = 1 @quest_number = 34 #Teh_Freak - this is the item ID of the FIRST quest item refresh self.index = 0 end #-------------------------------------------------------------------------- # ? ??????? #-------------------------------------------------------------------------- def item return @data[self.index] end #-------------------------------------------------------------------------- # ? ?????? #-------------------------------------------------------------------------- def refresh if self.contents != nil self.contents.dispose self.contents = nil end @data = [] for i in @quest_number...$data_items.size if $game_party.item_number(i) > 0 @data.push($data_items[i]) end end # ???? 0 ?????????????????????? @item_max = @data.size if @item_max > 0 self.contents = Bitmap.new(width - 32, row_max * 32) self.contents.font.name = "OldEnglish" self.contents.font.size = 20 for i in 0...@item_max draw_item(i) end end end #-------------------------------------------------------------------------- # ? ????? # index : ???? #-------------------------------------------------------------------------- def draw_item(index) item = @data[index] case item when RPG::Item number = $game_party.item_number(item.id) end if item.is_a?(RPG::Item) and $game_party.item_can_use?(item.id) self.contents.font.color = normal_color else self.contents.font.color = disabled_color end x = index y = index * 32 rect = Rect.new(x, y, self.width / @column_max - 32, 32) self.contents.fill_rect(rect, Color.new(0, 0, 0, 0)) bitmap = RPG::Cache.icon(item.icon_name) opacity = self.contents.font.color == normal_color ? 255 : 128 self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity) self.contents.draw_text(x + 28, y, width, 32, item.description, 0) end end Now, to be able to use this, we need to call the menu up. This only works thought the main menu so go to "Scene_Menu" press ctrl + a, come back to here, select all of this: **ONLY REPLACE THIS IF YOU DON'T HAVE EDITATIONS TO "SCENE_MENU' ALREADY. IF YOU DO HAVE EDITATIONS, SKIP THIS PART AND GO BACK TO THE INSTRUCTIONS SECTION!!!** Edited Scene Menu
#============================================================================== # ? Scene_Menu #------------------------------------------------------------------------------ # ??????????????????? #============================================================================== class Scene_Menu #-------------------------------------------------------------------------- # ? ????????? # menu_index : ????????????? #-------------------------------------------------------------------------- def initialize(menu_index = 0) @menu_index = menu_index end #-------------------------------------------------------------------------- # ? ????? #-------------------------------------------------------------------------- def main # ???????????? s1 = $data_system.words.item s2 = $data_system.words.skill s3 = $data_system.words.equip s4 = "Status" s5 = "Quest" s6 = "Save" s7 = "Exit" @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7]) @command_window.index = @menu_index @command_window.height = (5 * 32) + 64 # Allows scrolling # ??????? 0 ???? if $game_party.actors.size == 0 # ????????????????????? @command_window.disable_item(0) @command_window.disable_item(1) @command_window.disable_item(2) @command_window.disable_item(3) end # ???????? if $game_system.save_disabled # ????????? @command_window.disable_item(4) end # ????????????? @playtime_window = Window_PlayTime.new @playtime_window.x = 0 @playtime_window.y = 224 # ?????????? @steps_window = Window_Steps.new @steps_window.x = 0 @steps_window.y = 320 # ???????????? @gold_window = Window_Gold.new @gold_window.x = 0 @gold_window.y = 416 # ????????????? @status_window = Window_MenuStatus.new @status_window.x = 160 @status_window.y = 0 #Teh_Freak - Quest Window @quest_window = Window_Quest.new @quest_window.visible = false @quest_window.x = 160 @quest_window.y = 0 # ????????? Graphics.transition # ?????? loop do # ???????? Graphics.update # ??????? Input.update # ?????? update # ???????????????? if $scene != self break end end # ????????? Graphics.freeze # ???????? @command_window.dispose @playtime_window.dispose @steps_window.dispose @quest_window.dispose @gold_window.dispose @status_window.dispose end #-------------------------------------------------------------------------- # ? ?????? #-------------------------------------------------------------------------- def update # ???????? @command_window.update @playtime_window.update @steps_window.update @quest_window.update @gold_window.update @status_window.update # ??????????????????: update_command ??? if @command_window.active update_command return end # Teh_Freak - update the quest window if @quest_window.active update_quest return end # ???????????????????: update_status ??? if @status_window.active update_status return end end #-------------------------------------------------------------------------- # ? Teh_Freak - Update Quest #-------------------------------------------------------------------------- def update_quest # If escape is pressed if Input.trigger?(Input::B) # do the sound effect $game_system.se_play($data_system.cancel_se) # switch windows to normal again @command_window.active = true @quest_window.active = false @quest_window.visible = false @status_window.visible = true return end end # END update_quest#-------------------------------------------------------------------------- # ? ?????? (??????????????????) #-------------------------------------------------------------------------- def update_command # B ?????????? if Input.trigger?(Input::B) # ????? SE ??? $game_system.se_play($data_system.cancel_se) # ?????????? $scene = Scene_Map.new return end # C ?????????? if Input.trigger?(Input::C) # ??????? 0 ?????????????????????? if $game_party.actors.size == 0 and @command_window.index < 4 # ??? SE ??? $game_system.se_play($data_system.buzzer_se) return end # ??????????????????? case @command_window.index when 0 # items # ?? SE ??? $game_system.se_play($data_system.decision_se) # ??????????? $scene = Scene_Item.new when 1 # skills # ?? SE ??? $game_system.se_play($data_system.decision_se) # ??????????????????? @command_window.active = false @status_window.active = true @status_window.index = 0 when 2 #equipment # ?? SE ??? $game_system.se_play($data_system.decision_se) # ??????????????????? @command_window.active = false @status_window.active = true @status_window.index = 0 when 3 # Status # ?? SE ??? $game_system.se_play($data_system.decision_se) # ??????????????????? @command_window.active = false @status_window.active = true @status_window.index = 0 when 4 # Teh_Freak - Quests Button $game_system.se_play($data_system.decision_se) @command_window.active = false @status_window.visible = false @quest_window.active = true @quest_window.visible = true when 5 #save # ???????? if $game_system.save_disabled # ??? SE ??? $game_system.se_play($data_system.buzzer_se) return end # ?? SE ??? $game_system.se_play($data_system.decision_se) # ?????????? $scene = Scene_Save.new when 6 # Exit $game_system.se_play($data_system.decision_se) $scene = Scene_End.new end end return end end #-------------------------------------------------------------------------- # ? ?????? (???????????????????) #-------------------------------------------------------------------------- def update_status # B ?????????? if Input.trigger?(Input::B) # ????? SE ??? $game_system.se_play($data_system.cancel_se) # ?????????????????? @command_window.active = true @status_window.active = false @status_window.index = -1 return end # C ?????????? if Input.trigger?(Input::C) # ??????????????????? case @command_window.index when 1 # ??? # ???????????? 2 ????? if $game_party.actors[@status_window.index].restriction >= 2 # ??? SE ??? $game_system.se_play($data_system.buzzer_se) return end # ?? SE ??? $game_system.se_play($data_system.decision_se) # ?????????? $scene = Scene_Skill.new(@status_window.index) when 2 # ?? # ?? SE ??? $game_system.se_play($data_system.decision_se) # ????????? $scene = Scene_Equip.new(@status_window.index) when 3 # ????? # ?? SE ??? $game_system.se_play($data_system.decision_se) # ???????????? $scene = Scene_Status.new(@status_window.index) end return end end #end |