Всем привет, можете подсказать скрипты, или хоть что нибудь, для создание игры типа: 3 в линию (match 3) на RPG maker vx ace?
Не знаю есть ли вообще, но сам не нашел.
Всем привет, можете подсказать скрипты, или хоть что нибудь, для создание игры типа: 3 в линию (match 3) на RPG maker vx ace?
Не знаю есть ли вообще, но сам не нашел.
Прохлада и спокойствие мне вполне по душе
Спойлер :
き っ と 、 女 の 子 は お 砂 糖 と ス パ イ ス と 素 敵 な 何 か で で き て い る。
Уважаемые. Существует ли что-то вроде системы перков по образцу Фаллаута или ветки навыков. Никак пока не выходит ровно это сделать через событие...
(Что собственно я хочу : Получение уровня = предоставляется выбор между рядом навыков, которые зависят от параметров героя и от уже выбранного в прошлом.
Уточняй какой мейкер. Да есть. Вот на асе: http://www.rpgmakervxace.net/topic/2...ed-skill-tree/Уважаемые. Существует ли что-то вроде системы перков по образцу Фаллаута или ветки навыков. Никак пока не выходит ровно это сделать через событие...
(Что собственно я хочу : Получение уровня = предоставляется выбор между рядом навыков, которые зависят от параметров героя и от уже выбранного в прошлом.
Прохлада и спокойствие мне вполне по душе
Спойлер :
き っ と 、 女 の 子 は お 砂 糖 と ス パ イ ス と 素 敵 な 何 か で で き て い る。
Так, господа скриптеры, мне нужна ваша помощь. На XP.
Есть Stat Distribution System от Blizzard'a - система повышения характеристик.
Спойлер код скрипта:Код:#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:= # Stat Distribution System by Blizzard # Version: 2.2b # Type: Actor Attribute Modifier # Date: 25.3.2007 # Date v1.1b: 6.4.2007 # Date v1.2b: 22.8.2007 # Date v1.3b: 12.9.2007 # Date v1.33b: 5.11.2007 # Date v2.0: 18.10.2009 # Date v2.01: 28.7.2010 # Date v2.1: 16.12.2011 # Date v2.2: 29.9.2012 # Date v2.2b: 30.9.2012 #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:= # # Compatibility: # # 99% compatible with SDK v1.x. 80% compatible with SDK 2.x. WILL corrupt # your old savegames. Might cause problems with custom leveling up systems. # 99% compatibility with everything else. # # # Features: # # - distribute points between different stats # - extra scene for point distribution with confirmation window at the end # - calls the "caller scene" automatically when finished # - add points by easily pressing RIGHT/LEFT # - hold Q to add 10 points at once # - hold W to add 100 points at once # - a Stat Distribution System that actually works like it should... # # new in v1.1b: # - added option to call the Points Scene after a fight with level ups # - customizable icon position and opacity # # new in v1.2b: # - improved coding and made code shorter # - rewritten conditions using classic syntax to avoid RGSS conditioning bug # # new in v1.3b: # - improved coding # - fixed bug with AUTO_CALL after battle # - new AUTO_MAP_CALL works on the map as well (that means it's fully # compatible with Blizz-ABS) # # new in v1.33b: # - improved coding # - improved compatibility # - fixed a little glitch # # new in v2.0: # - improved coding and overworked system (corrupts old savegames with older # version of this system!) # - new design # - new support for HP and SP # - now possible to configure multiple points for one stat # # new in v2.01: # - fixed bug with display of remaining DP # # new in v2.1: # - fixed bug with calculation of DP allowance # # new in v2.2: # - added possibility of using negative number in X_DP_COST values for # inverted exchange rates # # new in v2.2b: # - fixed a few small bugs when using inverted exchange rates # # # Configuration: # # Set up the configuration below. # # STARTING_DP - how many points should the actor have initially at level 1 # DP_PER_LEVEL - how many points should the actor gain per level # HP_DP_COST - how many DP does 1 HP cost (use negative numbers for # inverted exchange rate) # SP_DP_COST - how many DP does 1 SP cost (use negative numbers for # inverted exchange rate) # STR_DP_COST - how many DP does 1 STR cost (use negative numbers for # inverted exchange rate) # DEX_DP_COST - how many DP does 1 DEX cost (use negative numbers for # inverted exchange rate) # AGI_DP_COST - how many DP does 1 AGI cost (use negative numbers for # inverted exchange rate) # INT_DP_COST - how many DP does 1 INT cost (use negative numbers for # inverted exchange rate) # AUTO_CALL - set to true to have the scene called automatically after # battles if at least one character got leveled up # AUTO_MAP_CALL - set to true to have the scene called automatically on the # map if at least one character got leveled up (this works # for Blizz-ABS as well), also note that this will cause the # scene to called over and over as long as not all points # were distributed # DISPLAY_ICON - displays an icon on the map if ANY character in the # party has any points to distribute # OWN_ICON - use an own icon for display, false for no or filename of # your own icon (the icon has to be in the Icons folder) # ICON_X - icon X coordinate # ICON_Y - icon Y coordinate # ICON_OPACITY - icon Y opacity # WINDOW_MODE - set to true to have the command windows at the bottom, set # to false to have them to at the top # # # You can always add change DP yourself by using following syntax: # # $game_party.actors[POSITION].dp = VALUE # $game_actors[ID].dp = VALUE # # POSITION - position of actor in the party (STARTS FROM ZERO!) # ID - ID of actor in the database # VALUE - value # # You can call the Scene by using a "Call script" event command. Type into # the editor window this text: # # $scene = Scene_Points.new # # # Notes: # # - Decreasing the level of an actor won't remove his gained DP. You MUST do # it manually. # - Negative numbers in X_DP_COST designate inverted exchange rates. e.g. # a value of 10 would designate that 10 DP are required to raise the stat # by 1 point while a value of -10 woulde designate that 1 DP is required to # increase the stat by 10 points. This convention has been added as # calculation with decimals (floating point numbers) can cause problems # during rounding due to physically limited precision. # # # If you find any bugs, please report them here: # http://forum.chaos-project.com #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:= module BlizzCFG #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: # START Configuration #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: STARTING_DP = 200 DP_PER_LEVEL = 100 HP_DP_COST = -100 SP_DP_COST = -100 STR_DP_COST = 10 DEX_DP_COST = 10 AGI_DP_COST = 10 INT_DP_COST = 10 AUTO_CALL = false AUTO_MAP_CALL = false DISPLAY_ICON = true OWN_ICON = false ICON_X = 612 ICON_Y = 452 ICON_OPACITY = 192 WINDOW_MODE = true #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: # END Configuration #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: # constants HPLimit = 9999 SPLimit = 9999 STRLimit = 999 DEXLimit = 999 AGILimit = 999 INTLimit = 999 DPName = 'DP' EvasionName = 'EVA' EXPText = 'EXP' NextText = 'next' EquipmentText = 'Equipment' AreYouSure = 'Are you sure?' DistroCommands = ['Distribute DP', 'Next Character', 'Previous Character', 'Finish'] AreYouSureCommands = ['Cancel', 'Accept Changes', 'Discard Changes'] AttrLimits = [HPLimit, SPLimit, STRLimit, DEXLimit, AGILimit, INTLimit] ExchangeRates = [HP_DP_COST, SP_DP_COST, STR_DP_COST, DEX_DP_COST, AGI_DP_COST, INT_DP_COST] ColorWhite = Color.new(255, 255, 255) ColorBlack = Color.new(0, 0, 0) ColorIcon = Color.new(0, 128, 255) ColorIncreased = Color.new(0, 255, 0) # ensures compatibility $stat_system = 2.2 end #============================================================================== # Array #============================================================================== class Array def sum result = 0 self.each {|i| result += i if i.is_a?(Numeric)} return result end end #============================================================================== # Game_Actor #============================================================================== class Game_Actor < Game_Battler attr_reader :dp alias setup_sds_later setup def setup(actor_id) @dp = BlizzCFG::STARTING_DP setup_sds_later(actor_id) end alias exp_sds_later exp= def exp=(exp) old_level = @level exp_sds_later(exp) value = (@level - old_level) * BlizzCFG::DP_PER_LEVEL self.dp += value if value > 0 end def dp=(value) @dp = (value < 0 ? 0 : value) end end #============================================================================== # Window_Base #============================================================================== class Window_Base < Window def draw_actor_battler(actor, x, y) bitmap = RPG::Cache.battler(actor.battler_name, actor.battler_hue) cw, ch = bitmap.width, bitmap.height src_rect = Rect.new(0, 0, cw, ch) self.contents.blt(x - cw / 2, y - ch / 2, bitmap, src_rect) end alias draw_actor_parameter_sds_later draw_actor_parameter def draw_actor_parameter(actor, x, y, type) if type == 7 self.contents.font.color = system_color self.contents.draw_text(x, y, 120, 32, BlizzCFG::EvasionName) self.contents.font.color = normal_color self.contents.draw_text(x + 120, y, 36, 32, actor.eva.to_s, 2) else draw_actor_parameter_sds_later(actor, x, y, type) end end end #============================================================================== # Window_DistributionStatus #============================================================================== class Window_DistributionStatus < Window_Base attr_reader :actor def initialize(actor) super(0, BlizzCFG::WINDOW_MODE ? 0 : 224, 640, 256) @actor = actor self.contents = Bitmap.new(width - 32, height - 32) if $fontface != nil self.contents.font.name = $fontface self.contents.font.size = $fontsize elsif $defaultfonttype != nil self.contents.font.name = $defaultfonttype self.contents.font.size = $defaultfontsize end refresh end def actor=(actor) @actor = actor refresh end def refresh self.contents.clear unless @actor == nil draw_actor_battler(@actor, 256, 120) draw_actor_name(@actor, 4, 0) draw_actor_class(@actor, 4, 32) draw_actor_level(@actor, 4, 64) self.contents.font.color = system_color self.contents.draw_text(352, 16, 96, 32, BlizzCFG::EquipmentText) draw_item_name($data_weapons[@actor.weapon_id], 352, 64) draw_item_name($data_armors[@actor.armor1_id], 352, 96) draw_item_name($data_armors[@actor.armor2_id], 352, 128) draw_item_name($data_armors[@actor.armor3_id], 352, 160) draw_item_name($data_armors[@actor.armor4_id], 352, 192) self.contents.font.color = normal_color draw_actor_parameter(@actor, 4, 96, 0) draw_actor_parameter(@actor, 4, 128, 1) draw_actor_parameter(@actor, 4, 160, 2) draw_actor_parameter(@actor, 4, 192, 7) end end end #============================================================================== # Window_DistributionPoints #============================================================================== class Window_DistributionPoints < Window_Base attr_reader :actor attr_reader :dp_left def initialize(actor) super(0, BlizzCFG::WINDOW_MODE ? 416 : 160, 224, 64) self.contents = Bitmap.new(width - 32, height - 32) if $fontface != nil self.contents.font.name = $fontface self.contents.font.size = $fontsize elsif $defaultfonttype != nil self.contents.font.name = $defaultfonttype self.contents.font.size = $defaultfontsize end self.actor = actor end def actor=(actor) @actor, @dp_left = actor, actor.dp refresh end def set_dp(value) @dp_left = actor.dp - value refresh end def refresh self.contents.clear self.contents.font.color = system_color self.contents.draw_text(4, 0, 32, 32, BlizzCFG::DPName) self.contents.font.color = normal_color self.contents.draw_text(36, 0, 152, 32, "#{@dp_left} / #{@actor.dp}", 2) end end #============================================================================== # Window_Distribution #============================================================================== class Window_Distribution < Window_Selectable attr_reader :actor attr_reader :spent def initialize(actor) super(224, BlizzCFG::WINDOW_MODE ? 256 : 0, 416, 224) self.contents = Bitmap.new(width - 32, height - 32) if $fontface != nil self.contents.font.name = $fontface self.contents.font.size = $fontsize elsif $defaultfonttype != nil self.contents.font.name = $defaultfonttype self.contents.font.size = $defaultfontsize end @words = ["Max #{$data_system.words.hp}", "Max #{$data_system.words.sp}", $data_system.words.str, $data_system.words.dex, $data_system.words.agi, $data_system.words.int] @item_max = @words.size self.actor = actor self.active, self.index = false, 0 end def actor=(actor) @actor = actor @current = [@actor.maxhp, @actor.maxsp, @actor.str, @actor.dex, @actor.agi, @actor.int] @spent = [0, 0, 0, 0, 0, 0] refresh end def active=(value) super(value) update_cursor_rect end def apply_new_attributes @actor.maxhp += (BlizzCFG::HP_DP_COST > 0 ? @spent[0] / BlizzCFG::HP_DP_COST : @spent[0] * -BlizzCFG::HP_DP_COST) @actor.maxsp += (BlizzCFG::SP_DP_COST > 0 ? @spent[1] / BlizzCFG::SP_DP_COST : @spent[1] * -BlizzCFG::SP_DP_COST) @actor.str += (BlizzCFG::STR_DP_COST > 0 ? @spent[2] / BlizzCFG::STR_DP_COST : @spent[2] * -BlizzCFG::STR_DP_COST) @actor.dex += (BlizzCFG::DEX_DP_COST > 0 ? @spent[3] / BlizzCFG::DEX_DP_COST : @spent[3] * -BlizzCFG::DEX_DP_COST) @actor.agi += (BlizzCFG::AGI_DP_COST > 0 ? @spent[4] / BlizzCFG::AGI_DP_COST : @spent[4] * -BlizzCFG::AGI_DP_COST) @actor.int += (BlizzCFG::INT_DP_COST > 0 ? @spent[5] / BlizzCFG::INT_DP_COST : @spent[5] * -BlizzCFG::INT_DP_COST) @actor.dp -= @spent.sum self.actor = @actor end def refresh self.contents.clear (0...@item_max).each {|i| draw_item(i)} end def draw_item(i) y = i * 32 self.contents.fill_rect(0, y, self.contents.width, 32, Color.new(0, 0, 0, 0)) self.contents.font.color = system_color self.contents.draw_text(4, y, 80, 32, @words[i]) self.contents.draw_text(344, y, 40, 32, BlizzCFG::DPName) self.contents.draw_text(180, y, 12, 32, '/', 1) self.contents.draw_text(192, y, 64, 32, @current[i].to_s) self.contents.font.color = normal_color if BlizzCFG::ExchangeRates[i] > 0 self.contents.draw_text(276, y, 64, 32, BlizzCFG::ExchangeRates[i].to_s, 2) elsif BlizzCFG::ExchangeRates[i] < 0 self.contents.draw_text(276, y, 64, 32, "1/" + (-BlizzCFG::ExchangeRates[i]).to_s, 2) end font, self.contents.font.name = self.contents.font.name, 'Arial' size, self.contents.font.size = self.contents.font.size, 32 bold, self.contents.font.bold = self.contents.font.bold, true self.contents.draw_text(104, y - 2, 24, 32, '«') self.contents.draw_text(244, y - 2, 24, 32, '»', 2) self.contents.font.bold = bold self.contents.font.size = size self.contents.font.bold = bold self.contents.font.color = BlizzCFG::ColorIncreased if @spent[i] > 0 current = @current[i] if BlizzCFG::ExchangeRates[i] > 0 current = (@current[i] + @spent[i] / BlizzCFG::ExchangeRates[i]) elsif BlizzCFG::ExchangeRates[i] < 0 current = (@current[i] + @spent[i] * -BlizzCFG::ExchangeRates[i]) end current = BlizzCFG::AttrLimits[i] if current > BlizzCFG::AttrLimits[i] self.contents.draw_text(116, y, 64, 32, current.to_s, 2) end def add_points(value) return false if value == 0 if BlizzCFG::ExchangeRates[index] > 0 limit = BlizzCFG::AttrLimits[index] - (@current[index] + @spent[index] / BlizzCFG::ExchangeRates[index]) remaining = (@actor.dp - @spent.sum) / BlizzCFG::ExchangeRates[index] limit = remaining if limit > remaining value = limit if value > limit elsif BlizzCFG::ExchangeRates[index] < 0 value *= -BlizzCFG::ExchangeRates[index] limit = BlizzCFG::AttrLimits[index] - (@current[index] + @spent[index] * -BlizzCFG::ExchangeRates[index]) remaining = (@actor.dp - @spent.sum) * -BlizzCFG::ExchangeRates[index] limit = remaining if limit > remaining value = limit if value > limit spent = (value - BlizzCFG::ExchangeRates[index] - 1) / -BlizzCFG::ExchangeRates[index] end if value > 0 if BlizzCFG::ExchangeRates[index] > 0 @spent[index] += value * BlizzCFG::ExchangeRates[index] elsif BlizzCFG::ExchangeRates[index] < 0 @spent[index] += spent end return true end return false end def remove_points(value) return false if value == 0 if BlizzCFG::ExchangeRates[index] > 0 limit = @spent[index] / BlizzCFG::ExchangeRates[index] value = limit if value > limit elsif BlizzCFG::ExchangeRates[index] < 0 value = @spent[index] if value > @spent[index] spent = value value *= -BlizzCFG::ExchangeRates[index] end if value > 0 if BlizzCFG::ExchangeRates[index] > 0 @spent[index] -= value * BlizzCFG::ExchangeRates[index] elsif BlizzCFG::ExchangeRates[index] < 0 @spent[index] -= spent end return true end return false end def update super return unless self.active if Input.press?(Input::R) if Input.repeat?(Input::RIGHT) if add_points(100) $game_system.se_play($data_system.cursor_se) draw_item(self.index) else $game_system.se_play($data_system.buzzer_se) end elsif Input.repeat?(Input::LEFT) if remove_points(100) $game_system.se_play($data_system.cursor_se) draw_item(self.index) else $game_system.se_play($data_system.buzzer_se) end end elsif Input.press?(Input::L) if Input.repeat?(Input::RIGHT) if add_points(10) $game_system.se_play($data_system.cursor_se) draw_item(self.index) else $game_system.se_play($data_system.buzzer_se) end elsif Input.repeat?(Input::LEFT) if remove_points(10) $game_system.se_play($data_system.cursor_se) draw_item(self.index) else $game_system.se_play($data_system.buzzer_se) end end elsif Input.repeat?(Input::RIGHT) if add_points(1) $game_system.se_play($data_system.cursor_se) draw_item(self.index) else $game_system.se_play($data_system.buzzer_se) end elsif Input.repeat?(Input::LEFT) if remove_points(1) $game_system.se_play($data_system.cursor_se) draw_item(self.index) else $game_system.se_play($data_system.buzzer_se) end end end def update_cursor_rect if @index < 0 || !self.active self.cursor_rect.empty else super end end end #============================================================================== # Window_Sure #============================================================================== class Window_Sure < Window_Command def initialize(width, commands) commands = commands.clone + [''] super @item_max, self.index = commands.size - 1, 0 self.x, self.y, self.z = 320 - self.width / 2, 240 - self.height / 2, 10000 refresh end def refresh super self.contents.font.color = system_color self.contents.draw_text(4, 0, self.contents.width - 8, 32, BlizzCFG::AreYouSure, 1) end def draw_item(i, color) self.contents.font.color = color rect = Rect.new(4, (i + 1) * 32, self.contents.width - 8, 32) self.contents.fill_rect(rect, Color.new(0, 0, 0, 0)) self.contents.draw_text(rect, @commands[i], 1) end def update_cursor_rect if @index < 0 self.cursor_rect.empty else self.cursor_rect.set(32, (@index + 1) * 32, self.contents.width - 64, 32) end end end #============================================================================== # Scene_Points #============================================================================== class Scene_Points def initialize(classe = $scene.class) @scene = classe end def main @command_window = Window_Command.new(224, BlizzCFG::DistroCommands) @command_window.y = (BlizzCFG::WINDOW_MODE ? 256 : 0) actor = $game_party.actors[0] @status_window = Window_DistributionStatus.new(actor) @distro_window = Window_Distribution.new(actor) @dp_window = Window_DistributionPoints.new(actor) Graphics.transition loop do Graphics.update Input.update update break if $scene != self end Graphics.freeze @command_window.dispose @status_window.dispose @distro_window.dispose @dp_window.dispose end def create_confirmation_window @sure_window = Window_Sure.new(256, BlizzCFG::AreYouSureCommands) end def update if @command_window.active @command_window.update update_main_command elsif @sure_window != nil @sure_window.update update_confirmation elsif @distro_window.active @distro_window.update update_distro end end def update_main_command if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) $scene = @scene.new elsif Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) if @command_window.index == 0 @command_window.active, @distro_window.active = false, true elsif @distro_window.spent.sum > 0 @command_window.active = false create_confirmation_window else @distro_window.index = 0 check_command_window end end end def update_confirmation if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) @sure_window.dispose @sure_window, @command_window.active = nil, true elsif Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) if @sure_window.index > 0 @distro_window.apply_new_attributes if @sure_window.index == 1 check_command_window end @sure_window.dispose @sure_window, @command_window.active = nil, true end end def check_command_window case @command_window.index when 1 i = @status_window.actor.index + 1 i %= $game_party.actors.size @status_window.actor = @distro_window.actor = @dp_window.actor = $game_party.actors[i] when 2 i = @status_window.actor.index + $game_party.actors.size - 1 i %= $game_party.actors.size @status_window.actor = @distro_window.actor = @dp_window.actor = $game_party.actors[i] when 3 $scene = @scene.new end end def update_distro if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) @command_window.active, @distro_window.active = true, false elsif Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) @command_window.active, @distro_window.active = true, false elsif Input.repeat?(Input::LEFT) || Input.repeat?(Input::RIGHT) @dp_window.set_dp(@distro_window.spent.sum) end end end #============================================================================== # Scene_Battle #============================================================================== class Scene_Battle alias main_sds_later main def main main_sds_later if BlizzCFG::AUTO_CALL && $game_party.actors.any? {|actor| actor.dp > 0} $scene = Scene_Points.new end end end #============================================================================== # Scene_Map #============================================================================== class Scene_Map alias main_sds_later main def main main_sds_later @notify.dispose if @notify != nil end alias upd_sds_later update def update check_icon if BlizzCFG::DISPLAY_ICON upd_sds_later if BlizzCFG::AUTO_MAP_CALL && $game_party.actors.any? {|actor| actor.dp > 0} $scene = Scene_Points.new end end def check_icon if $game_party.actors.any? {|actor| actor.dp > 0} if @notify == nil @notify = RPG::Sprite.new if BlizzCFG::OWN_ICON @notify.bitmap = RPG::Cache.icon(BlizzCFG::OWN_ICON) else @notify.bitmap = Bitmap.new(24, 24) @notify.bitmap.fill_rect(0, 0, 24, 24, BlizzCFG::ColorWhite) @notify.bitmap.fill_rect(22, 1, 2, 23, BlizzCFG::ColorBlack) @notify.bitmap.fill_rect(1, 22, 23, 2, BlizzCFG::ColorBlack) @notify.bitmap.set_pixel(23, 0, BlizzCFG::ColorBlack) @notify.bitmap.set_pixel(0, 23, BlizzCFG::ColorBlack) @notify.bitmap.fill_rect(2, 2, 20, 20, BlizzCFG::ColorIcon) @notify.bitmap.fill_rect(4, 10, 16, 4, BlizzCFG::ColorWhite) @notify.bitmap.fill_rect(10, 4, 4, 16, BlizzCFG::ColorWhite) @notify.opacity = BlizzCFG::ICON_OPACITY end @notify.x, @notify.y = BlizzCFG::ICON_X, BlizzCFG::ICON_Y @notify.z = 5000 @notify.blink_on end @notify.update elsif @notify != nil @notify.dispose @notify = nil end end end
И есть Mr_Wiggles Perk Script от Mr_Wiggles - перки из Fallout (кстати, их тут кто-то искал).
Спойлер код скрипта:Код:#============================================================================== # ** Mr_Wiggles Perk Script ** #============================================================================== # By: Mr Wiggles # Version: 1.2 # Aug. 12, 2011 #============================================================================== # Instructions: # ---------------------------------------------------- # Call script using a scrip command in an event that states: # $scene = Perks.new # #============================================================================== # Description: # ---------------------------------------------------- # You know in the Fall Out series where you as the player can select a perk # that will aid you in your over all quest when you level up? Well this # script does just that. #============================================================================== # Features: # ---------------------------------------------------- # Fully Customizable - perks can be simple edits to health or something like # Str, or can be as advanced as a script call. # #============================================================================== # * CONFIG START #============================================================================== module Wig_Config #-------------------------------------------------------------------------- # Player must spend perk points before they can exit the perk menu. #-------------------------------------------------------------------------- MUST_SPEND = true #-------------------------------------------------------------------------- # Names of the perks. # n => "name" #-------------------------------------------------------------------------- PERK_NAMES = { 0 => "First perk", 1 => "Second perk", 2 => "Third perk" } #-------------------------------------------------------------------------- # Description for perk. # n => "description" #-------------------------------------------------------------------------- PERK_DISC = { 0 => "First perk's description followed by a comma if another description" + " follows it.", 1 => "Second perk's description, also note that since this being perk number" + " two that its id in the script is 1. This goes for all perks, its id" + " will be one less this its original location.", 2 => "But as you can see these descriptions can be very long and descriptive" + " which makes it a great feature for this script." } #-------------------------------------------------------------------------- # Requirements that need to be met in order to have this perk. # n => [["name", value], ["name", value]] # # "name" refers to one of the following: # Level, Str, Dex, Agi, Int # # *MUST* match the formatting shown! #-------------------------------------------------------------------------- PERK_REQ = { 0 => [ ["Level", 1], ["Str", 20] ], 1 => [ ["Level", 1] ], 2 => [ ["Level", 10], ["Int", 60], ["Dex", 56], ["Agi", 80] ] } #-------------------------------------------------------------------------- # Perk Effects. # n => [["name", value], ["name", value]] # # "name" refers to one of the following: # HP, MP, Str, Dex, Agi, Int # # value stands for the amount that the stat is modified by. # *MUST* match the formatting shown! #-------------------------------------------------------------------------- # Or you can have it run a script command. (little complex) # n => "script string" # # You write your script commands in the string that will be evaluated, use # "\n" for enter to tell the script that its on a new line. # Any quotes must follow after a backslash ( like so " or \' ) in # order to be used. #-------------------------------------------------------------------------- PERK_EFFEC = { 0 => [["Dex", 30], ["Str", 5]], 1 => "print ("See, this was a scripted perk,") \n" + "print ("its set up not to do much just show text")", 2 => [["HP", 70], ["MP", 50]] } #-------------------------------------------------------------------------- end #============================================================================== # * END CONFIG #============================================================================== # Only edit past this point if you have some what of a clue of what it is your # doing, if not do feel free to poke around and learn something new. ^-^ #============================================================================== # ** Class Perks #============================================================================== class Perks include Wig_Config #-------------------------------------------------------------------------- # * Main #-------------------------------------------------------------------------- def main # create windows @perk_selection_window = Window_Perk_Selection.new @perk_discription_window = Window_Perk_Discription.new @perk_actor_stat_window = Window_Perk_Actor_Stats.new @perk_grey_window = Window_Perk_Grey.new(640, 480) @perk_points_window = Window_Perk_Points.new @perk_confirm_window = Window_Command.new(160, ["No", "Yes"]) @perk_confirm_window.x = 240 @perk_confirm_window.y = 196 @perk_confirm_window.z = 10 @perk_confirm_window.active = false @perk_confirm_window.visible = false @perk_grey_window.visible = false # main loop Graphics.transition loop do Graphics.update Input.update update break if $scene != self end Graphics.freeze # dispose windows @perk_selection_window.dispose @perk_discription_window.dispose @perk_actor_stat_window.dispose @perk_confirm_window.dispose @perk_grey_window.dispose @perk_points_window.dispose end #-------------------------------------------------------------------------- # * Update #-------------------------------------------------------------------------- def update @perk_index = @perk_selection_window.index if @perk_confirm_window.active @perk_confirm_window.update update_confirm return end @perk_grey_window.update @perk_selection_window.update @perk_actor_stat_window.update(@perk_index) @perk_discription_window.update(@perk_index) update_perk_selection end #-------------------------------------------------------------------------- # * Update Confirm #-------------------------------------------------------------------------- def update_confirm if Input.trigger?(Input::C) case @perk_confirm_window.index when 0 $game_system.se_play($data_system.cancel_se) when 1 $game_system.se_play($data_system.decision_se) $game_party.gain_perk(@perk_index) $game_party.perk_points -= 1 @perk_selection_window.refresh @perk_points_window.refresh @perk_actor_stat_window.refresh end @perk_confirm_window.active = false @perk_confirm_window.visible = false @perk_grey_window.visible = false @perk_selection_window.active = true end # exit if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) @perk_confirm_window.active = false @perk_confirm_window.visible = false @perk_grey_window.visible = false @perk_selection_window.active = true end end #-------------------------------------------------------------------------- # * Update Perk Windwos #-------------------------------------------------------------------------- def update_perk_selection # selection if Input.trigger?(Input::C) if $game_party.perk_selectable?(@perk_index) and !$game_party.known_perks.include?(@perk_index) $game_system.se_play($data_system.decision_se) @perk_selection_window.active = false @perk_confirm_window.active = true @perk_confirm_window.visible = true @perk_grey_window.visible = true else $game_system.se_play($data_system.buzzer_se) end end # exit if Input.trigger?(Input::B) if $game_party.perk_points > 0 and MUST_SPEND $game_system.se_play($data_system.buzzer_se) print ("You must chose #{$game_party.perk_points} Perk(s).") else $game_system.se_play($data_system.cancel_se) $scene = Scene_Map.new $game_map.refresh end end end end #============================================================================== # ** Game Party #============================================================================== class Game_Party include Wig_Config attr_reader :known_perks attr_accessor :perk_points #-------------------------------------------------------------------------- # * Intitialize #-------------------------------------------------------------------------- alias :perk_init :initialize def initialize perk_init @known_perks = [] @perk_points = 0 @old_level = 1 end #-------------------------------------------------------------------------- # * Gain Perk #-------------------------------------------------------------------------- def gain_perk(perk_id) if !@known_perks.include?(perk_id) @known_perks.push(perk_id) @actors[0].perk_effects(perk_id) end end #-------------------------------------------------------------------------- # * Gain Point to Spend #-------------------------------------------------------------------------- def gain_perk_point? if @actors[0].level != @old_level @perk_points += 1 if @actors[0].level > @old_level @old_level = @actors[0].level end end #-------------------------------------------------------------------------- # * Can Select Perk #-------------------------------------------------------------------------- def perk_selectable?(perk_id) # no points to spend return false if @perk_points <= 0 # requirement check requirements = PERK_REQ[perk_id] for ment in requirements case ment[0] when "Level" return false if @actors[0].level.to_f < ment[1].to_f when "Str" return false if @actors[0].base_str.to_f < ment[1].to_f when "Dex" return false if @actors[0].base_dex.to_f < ment[1].to_f when "Agi" return false if @actors[0].base_agi.to_f < ment[1].to_f when "Int" return false if @actors[0].base_int.to_f < ment[1].to_f end end # all requirements are met return true end end #============================================================================== # ** Scene Map #============================================================================== class Scene_Map alias :perk_update :update def update perk_update $game_party.gain_perk_point? end end #============================================================================== # ** Game System #============================================================================== class Game_System attr_accessor :actor_perk_mods #-------------------------------------------------------------------------- # * Setup #-------------------------------------------------------------------------- alias :perk_init :initialize def initialize perk_init @actor_perk_mods = [] for i in 0...6 @actor_perk_mods[i] = 0 end end end #============================================================================== # ** Game Actor #============================================================================== class Game_Actor include Wig_Config #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- alias :perk_init :initialize def initialize(*args) perk_init(*args) set_perk_mods end #-------------------------------------------------------------------------- # * Setup #-------------------------------------------------------------------------- def set_perk_mods @maxhp_plus = $game_system.actor_perk_mods[0] @maxsp_plus = $game_system.actor_perk_mods[1] @str_plus = $game_system.actor_perk_mods[2] @dex_plus = $game_system.actor_perk_mods[3] @agi_plus = $game_system.actor_perk_mods[4] @int_plus = $game_system.actor_perk_mods[5] end #-------------------------------------------------------------------------- # * Perk Effects #-------------------------------------------------------------------------- def perk_effects(perk_id) effects = PERK_EFFEC[perk_id] if effects.is_a?(String) error_print = "There is an error with perk #{perk_id}'s script." eval(effects) rescue print(error_print) return else for effect in effects case effect[0] when "HP" @maxhp_plus += effect[1] $game_system.actor_perk_mods[0] = @maxhp_plus when "MP" @maxsp_plus += effect[1] $game_system.actor_perk_mods[1] = @maxsp_plus when "Str" @str_plus += effect[1] $game_system.actor_perk_mods[2] = @str_plus when "Dex" @dex_plus += effect[1] $game_system.actor_perk_mods[3] = @dex_plus when "Agi" @agi_plus += effect[1] $game_system.actor_perk_mods[4] = @agi_plus when "Int" @int_plus += effect[1] $game_system.actor_perk_mods[5] = @int_plus end end end end #-------------------------------------------------------------------------- # * Get Basic Maximum SP #-------------------------------------------------------------------------- alias :perk_mp :base_maxsp def base_maxsp old_value = perk_mp return old_value + @maxsp_plus end #-------------------------------------------------------------------------- # * Get Basic Strength #-------------------------------------------------------------------------- alias :perk_str :base_str def base_str old_value = perk_str return old_value + @str_plus end #-------------------------------------------------------------------------- # * Get Basic Dexterity #-------------------------------------------------------------------------- alias :perk_dex :base_dex def base_dex old_value = perk_dex return old_value + @dex_plus end #-------------------------------------------------------------------------- # * Get Basic Agility #-------------------------------------------------------------------------- alias :perk_agi :base_agi def base_agi old_value = perk_agi return old_value + @agi_plus end #-------------------------------------------------------------------------- # * Get Basic Intelligence #-------------------------------------------------------------------------- alias :perk_int :base_int def base_int old_value = perk_int return old_value + @int_plus end end #============================================================================== # ** Window Perk Selection #============================================================================== class Window_Perk_Selection < Window_Selectable include Wig_Config #-------------------------------------------------------------------------- # * Initialization #-------------------------------------------------------------------------- def initialize super(0, 0, 240, 480) self.contents = Bitmap.new(width - 32, height - 32) @item_max = PERK_NAMES.size @column_max = 1 self.index = 0 self.z = 1 refresh end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh self.contents.clear @data = [] for id in 0...PERK_NAMES.size @data.push(id) end for item in @data draw_item(item) end end #-------------------------------------------------------------------------- # * Draw Item #-------------------------------------------------------------------------- def draw_item(index) self.contents.font.color = $game_party.known_perks.include?(index) ? system_color : $game_party.perk_selectable?(index) ? normal_color : disabled_color x = 4 y = index * 32 self.contents.draw_text(x, y, 220, 32, PERK_NAMES[index]) end end #============================================================================== # ** Window Perk Discription #============================================================================== class Window_Perk_Discription < Window_Selectable include Wig_Config #-------------------------------------------------------------------------- # * Initialization #-------------------------------------------------------------------------- def initialize super(240, 120, 400, 296) self.contents = Bitmap.new(width - 32, height - 32) self.z = 1 @old_perk_id = -1 update end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh(index = 0) self.contents.clear old_size = self.contents.font.size # format and draw perk discription self.contents.font.color = $game_party.perk_selectable?(index) ? normal_color : disabled_color format_string(0, 0, PERK_DISC[index], 360) # draw perk effects effects = PERK_EFFEC[index] text = [] for fect in effects break if fect.is_a?(String) i = effects.index(fect) text.push("+#{fect[1]} to #{fect[0]}") text.push(", ") if i != effects.size - 1 end self.contents.font.color = system_color self.contents.draw_text(4, 190, 200, 32, "Bonuses:") if effects.size > 0 and !effects.is_a?(String) self.contents.font.color = normal_color self.contents.font.size = 16 self.contents.draw_text(4, 205, 360, 32, text.to_s, 2) self.contents.font.size = old_size # draw perk requirements requirements = PERK_REQ[index] text = [] for ment in requirements i = requirements.index(ment) text.push("#{ment[0]} #{ment[1]}") text.push(", ") if i != requirements.size - 1 end text.flatten! self.contents.font.color = system_color self.contents.draw_text(4, 225, 200, 32, "Requirements:") if requirements.size > 0 self.contents.font.color = normal_color self.contents.font.size = 16 self.contents.draw_text(4, 240, 360, 32, text.to_s, 2) self.contents.font.size = old_size end #-------------------------------------------------------------------------- # * Update #-------------------------------------------------------------------------- def update(index = 0) super() if @old_perk_id != index refresh(index) @old_perk_id = index end end end #============================================================================== # ** Window Perk Actor Stats #============================================================================== class Window_Perk_Actor_Stats < Window_Base include Wig_Config #-------------------------------------------------------------------------- # * Initialization #-------------------------------------------------------------------------- def initialize super(240, 0, 400, 120) self.contents = Bitmap.new(width - 32, height - 32) self.z = 1 @maxsp_plus = @str_plus = @dex_plus = @agi_plus = @int_plus = 0 @maxhp_plus = 0 @perk_id = -1 @actor = $game_party.actors[0] update end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh self.contents.clear self.contents.font.size = 18 actor = $game_party.actors[0] draw_actor_level(actor, 300, 64) draw_actor_hp(actor, 0, 0) draw_actor_sp(actor, 200, 0) for type in 0...4 draw_actor_parameter(actor, type) end end #-------------------------------------------------------------------------- # * Draw Parameter #-------------------------------------------------------------------------- def draw_actor_parameter(actor, type, x = 0, y = 32) case type when 0 # Str self.contents.font.color = system_color self.contents.draw_text(x, y, 120, 32, $data_system.words.str) self.contents.font.color = @require[1] ? knockout_color : normal_color self.contents.draw_text(x + 40, y, 36, 32, actor.str.to_s, 2) when 1 # Dex y += 32 self.contents.font.color = system_color self.contents.draw_text(x, y, 120, 32, $data_system.words.dex) self.contents.font.color = @require[2] ? knockout_color : normal_color self.contents.draw_text(x + 40, y, 36, 32, actor.dex.to_s, 2) when 2 # Agi x += 90 self.contents.font.color = system_color self.contents.draw_text(x, y, 120, 32, $data_system.words.agi) self.contents.font.color = @require[3] ? knockout_color : normal_color self.contents.draw_text(x + 40, y, 36, 32, actor.agi.to_s, 2) when 3 # Int x += 90; y += 32 self.contents.font.color = system_color self.contents.draw_text(x, y, 120, 32, $data_system.words.int) self.contents.font.color = @require[4] ? knockout_color : normal_color self.contents.draw_text(x + 40, y, 36, 32, actor.int.to_s, 2) end end #-------------------------------------------------------------------------- # * Draw Level #-------------------------------------------------------------------------- def draw_actor_level(actor, x, y) self.contents.font.color = system_color self.contents.draw_text(x, y, 32, 32, "Lv") self.contents.font.color = @require[0] ? knockout_color : normal_color self.contents.draw_text(x + 32, y, 24, 32, actor.level.to_s, 2) end #-------------------------------------------------------------------------- # * Requirements Met #-------------------------------------------------------------------------- def requirements_met? # create fail array fails = [] # return if perk is known return fails if $game_party.known_perks.include?(@perk_id) # test if player meets requirements requirements = PERK_REQ[@perk_id] for ment in requirements case ment[0] when "Level" fails[0] = true if @actor.level.to_f < ment[1].to_f when "Str" fails[1] = true if @actor.base_str.to_f < ment[1].to_f when "Dex" fails[2] = true if @actor.base_dex.to_f < ment[1].to_f when "Agi" fails[3] = true if @actor.base_agi.to_f < ment[1].to_f when "Int" fails[4] = true if @actor.base_int.to_f < ment[1].to_f end end return fails end #-------------------------------------------------------------------------- # * Update #-------------------------------------------------------------------------- def update(perk_id = 0) if @perk_id != perk_id @perk_id = perk_id @require = requirements_met? refresh end end #-------------------------------------------------------------------------- # * Make Temp Effects #-------------------------------------------------------------------------- def make_temp_effects effects = PERK_EFFEC[@perk_id] for effect in effects case effect[0] when "HP" @maxhp_plus = effect[1] when "MP" @maxsp_plus = effect[1] when "Str" @str_plus = effect[1] when "Dex" @dex_plus = effect[1] when "Agi" @agi_plus = effect[1] when "Int" @int_plus = effect[1] end end end end #============================================================================== # ** Window_Perk_Points #============================================================================== class Window_Perk_Points < Window_Base include Wig_Config #-------------------------------------------------------------------------- # * Initialization #-------------------------------------------------------------------------- def initialize super(240, 416, 400, 64) self.contents = Bitmap.new(width - 32, height - 32) self.z = 1 refresh end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh self.contents.clear self.contents.font.color = $game_party.perk_points > 0 ? normal_color : disabled_color string = "You have #{$game_party.perk_points} Perk Points to spend." self.contents.draw_text(0, 0, 400, 32, string) end end #============================================================================== # ** Window Perk Grey #============================================================================== class Window_Perk_Grey < Window_Base #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize(w, h, x = 0, y = 0) super(x - 16, y - 16, w + 32, h + 32) self.contents = Bitmap.new(width - 32, height - 32) self.z = 5 self.opacity = 0 @width = w + 32 @height = h + 32 refresh end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh self.contents.clear rect = Rect.new(0, 0, @width, @height) self.contents.fill_rect(rect, Color.new(0, 0, 0, 120)) end end #============================================================================== # ** Window Base #============================================================================== class Window_Base #-------------------------------------------------------------------------- # * Format String #-------------------------------------------------------------------------- def format_string(x, y, string, max_width = 100) temp_word_array = string.scan (/./) position = line_break = 0 lines = [] blank_width = [] new_string = [lines, blank_width] for i in 0...temp_word_array.size character = temp_word_array[i] if character == " " or i == temp_word_array.size - 1 i += 1 if i == temp_word_array.size - 1 if self.contents.text_size(string[line_break, i-line_break]).width <= max_width position = i else line = temp_word_array[line_break, position-line_break] new_string[0].push(line) line_blank = max_width - self.contents.text_size(string[ line_break, position-line_break]).width new_string[1].push(line_blank.to_f / (line.size.to_f - 1.0)) line_break = position + 1 position = i end end end new_string[0].push(temp_word_array[line_break, temp_word_array.size - line_break]) return if new_string[0].nil? for line in 0...lines[0].size self.contents.draw_text(x, y + (line * 32), 380, 32, lines[line].to_s) end end end
По отдельности они работают великолепно, без всяких нареканий, но если использовать их вместе, в одном проекте, начинаются косяки. Близардовская система начинает вливать вдвое больше очков, чем указано в скрипте - т.е. поднимаешь, скажем, силу на 1, а она поднимается автоматом на 2. Такая же петрушка с перк скриптом - например, указал, что при получении перка получишь +5 к той же силе, а в итоге получаешь +10. По одиночке, в разных проектах, повторюсь, оба скрипта работают правильно, без нареканий.
Может, кто-нибудь, мне помочь?
Я вчера весь день сидел - я и так-то в скриптах не силен (я вообще ни в чем, кроме механики не силен), а тут вообще запутался к хренам и не знаю, что делать.
В скрипте перков попробуй удалить/закомментировать строки с 371 по 410 включительно. Вроде помогает, но нужно это дело тщательно потестить.
...sed semel insanivimus omnes...
Уже потестил, но решение не работает. Это помогает первому скрипту с раздачей характеристик и он теперь не накидывает характеристик в двойном размере, но ломает, собственно, сам скрипт перков - если, например, есть перк требующий силы 12, допустим, то он теперь не активируется, если равна 12. Закоментированные тобой строки - это информация для скрипта, какая характеристика чем являетс, для последующих вышеупомянутых проверок.
Это-то понятно. Но они же - причина конфликта. После их удаления скрипт перков не то что бы не работает, он работает по-другому: теперь если некий перк требует 12 силы, то это именно "базовая" сила, та, что получена с уровнем персонажа. Только сейчас дошло, почему такой вариант неприемлем) будем думать дальше, интересный баг +)
...sed semel insanivimus omnes...
Моих маленьких познаний в скриптах не хватает, чтобы решить эту проблему. Так что, вся надежда на тебя.
Вот такой тогда вариант:
Спойлер код скрипта:Код:#============================================================================== # ** Mr_Wiggles Perk Script ** #============================================================================== # By: Mr Wiggles # Version: 1.2 # Aug. 12, 2011 #============================================================================== # Instructions: # ---------------------------------------------------- # Call script using a scrip command in an event that states: # $scene = Perks.new # #============================================================================== # Description: # ---------------------------------------------------- # You know in the Fall Out series where you as the player can select a perk # that will aid you in your over all quest when you level up? Well this # script does just that. #============================================================================== # Features: # ---------------------------------------------------- # Fully Customizable - perks can be simple edits to health or something like # Str, or can be as advanced as a script call. # #============================================================================== # * CONFIG START #============================================================================== module Wig_Config #-------------------------------------------------------------------------- # Player must spend perk points before they can exit the perk menu. #-------------------------------------------------------------------------- MUST_SPEND = true #-------------------------------------------------------------------------- # Names of the perks. # n => "name" #-------------------------------------------------------------------------- PERK_NAMES = { 0 => "First perk", 1 => "Second perk", 2 => "Third perk" } #-------------------------------------------------------------------------- # Description for perk. # n => "description" #-------------------------------------------------------------------------- PERK_DISC = { 0 => "First perk's description followed by a comma if another description" + " follows it.", 1 => "Second perk's description, also note that since this being perk number" + " two that its id in the script is 1. This goes for all perks, its id" + " will be one less this its original location.", 2 => "But as you can see these descriptions can be very long and descriptive" + " which makes it a great feature for this script." } #-------------------------------------------------------------------------- # Requirements that need to be met in order to have this perk. # n => [["name", value], ["name", value]] # # "name" refers to one of the following: # Level, Str, Dex, Agi, Int # # *MUST* match the formatting shown! #-------------------------------------------------------------------------- PERK_REQ = { 0 => [ ["Level", 1], ["Str", 75] ], 1 => [ ["Level", 1], ["Str", 80] ], 2 => [ ["Level", 10], ["Int", 60], ["Dex", 56], ["Agi", 80] ] } #-------------------------------------------------------------------------- # Perk Effects. # n => [["name", value], ["name", value]] # # "name" refers to one of the following: # HP, MP, Str, Dex, Agi, Int # # value stands for the amount that the stat is modified by. # *MUST* match the formatting shown! #-------------------------------------------------------------------------- # Or you can have it run a script command. (little complex) # n => "script string" # # You write your script commands in the string that will be evaluated, use # "\n" for enter to tell the script that its on a new line. # Any quotes must follow after a backslash ( like so " or \' ) in # order to be used. #-------------------------------------------------------------------------- PERK_EFFEC = { 0 => [["Dex", 30], ["Str", 5]], 1 => [["HP", 70], ["MP", 50]], 2 => [["HP", 70], ["MP", 50]] } #-------------------------------------------------------------------------- end #============================================================================== # * END CONFIG #============================================================================== # Only edit past this point if you have some what of a clue of what it is your # doing, if not do feel free to poke around and learn something new. ^-^ #============================================================================== # ** Class Perks #============================================================================== class Perks include Wig_Config #-------------------------------------------------------------------------- # * Main #-------------------------------------------------------------------------- def main # create windows @perk_selection_window = Window_Perk_Selection.new @perk_discription_window = Window_Perk_Discription.new @perk_actor_stat_window = Window_Perk_Actor_Stats.new @perk_grey_window = Window_Perk_Grey.new(640, 480) @perk_points_window = Window_Perk_Points.new @perk_confirm_window = Window_Command.new(160, ["No", "Yes"]) @perk_confirm_window.x = 240 @perk_confirm_window.y = 196 @perk_confirm_window.z = 10 @perk_confirm_window.active = false @perk_confirm_window.visible = false @perk_grey_window.visible = false # main loop Graphics.transition loop do Graphics.update Input.update update break if $scene != self end Graphics.freeze # dispose windows @perk_selection_window.dispose @perk_discription_window.dispose @perk_actor_stat_window.dispose @perk_confirm_window.dispose @perk_grey_window.dispose @perk_points_window.dispose end #-------------------------------------------------------------------------- # * Update #-------------------------------------------------------------------------- def update @perk_index = @perk_selection_window.index if @perk_confirm_window.active @perk_confirm_window.update update_confirm return end @perk_grey_window.update @perk_selection_window.update @perk_actor_stat_window.update(@perk_index) @perk_discription_window.update(@perk_index) update_perk_selection end #-------------------------------------------------------------------------- # * Update Confirm #-------------------------------------------------------------------------- def update_confirm if Input.trigger?(Input::C) case @perk_confirm_window.index when 0 $game_system.se_play($data_system.cancel_se) when 1 $game_system.se_play($data_system.decision_se) $game_party.gain_perk(@perk_index) $game_party.perk_points -= 1 @perk_selection_window.refresh @perk_points_window.refresh @perk_actor_stat_window.refresh end @perk_confirm_window.active = false @perk_confirm_window.visible = false @perk_grey_window.visible = false @perk_selection_window.active = true end # exit if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) @perk_confirm_window.active = false @perk_confirm_window.visible = false @perk_grey_window.visible = false @perk_selection_window.active = true end end #-------------------------------------------------------------------------- # * Update Perk Windwos #-------------------------------------------------------------------------- def update_perk_selection # selection if Input.trigger?(Input::C) if $game_party.perk_selectable?(@perk_index) and !$game_party.known_perks.include?(@perk_index) $game_system.se_play($data_system.decision_se) @perk_selection_window.active = false @perk_confirm_window.active = true @perk_confirm_window.visible = true @perk_grey_window.visible = true else $game_system.se_play($data_system.buzzer_se) end end # exit if Input.trigger?(Input::B) if $game_party.perk_points > 0 and MUST_SPEND $game_system.se_play($data_system.buzzer_se) print ("You must chose #{$game_party.perk_points} Perk(s).") else $game_system.se_play($data_system.cancel_se) $scene = Scene_Map.new $game_map.refresh end end end end #============================================================================== # ** Game Party #============================================================================== class Game_Party include Wig_Config attr_reader :known_perks attr_accessor :perk_points #-------------------------------------------------------------------------- # * Intitialize #-------------------------------------------------------------------------- alias :perk_init :initialize def initialize perk_init @known_perks = [] @perk_points = 0 @old_level = 1 end #-------------------------------------------------------------------------- # * Gain Perk #-------------------------------------------------------------------------- def gain_perk(perk_id) if !@known_perks.include?(perk_id) @known_perks.push(perk_id) @actors[0].perk_effects(perk_id) end end #-------------------------------------------------------------------------- # * Gain Point to Spend #-------------------------------------------------------------------------- def gain_perk_point? if @actors[0].level != @old_level @perk_points += 1 if @actors[0].level > @old_level @old_level = @actors[0].level end end #-------------------------------------------------------------------------- # * Can Select Perk #-------------------------------------------------------------------------- def perk_selectable?(perk_id) # no points to spend return false if @perk_points <= 0 # requirement check requirements = PERK_REQ[perk_id] for ment in requirements case ment[0] when "Level" return false if @actors[0].level.to_f < ment[1].to_f when "Str" return false if @actors[0].str.to_f < ment[1].to_f when "Dex" return false if @actors[0].dex.to_f < ment[1].to_f when "Agi" return false if @actors[0].agi.to_f < ment[1].to_f when "Int" return false if @actors[0].int.to_f < ment[1].to_f end end # all requirements are met return true end end #============================================================================== # ** Scene Map #============================================================================== class Scene_Map alias :perk_update :update def update perk_update $game_party.gain_perk_point? end end #============================================================================== # ** Game System #============================================================================== class Game_System attr_accessor :actor_perk_mods #-------------------------------------------------------------------------- # * Setup #-------------------------------------------------------------------------- alias :perk_init :initialize def initialize perk_init @actor_perk_mods = [] for i in 0...6 @actor_perk_mods[i] = 0 end end end #============================================================================== # ** Game Actor #============================================================================== class Game_Actor include Wig_Config #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- alias :perk_init :initialize def initialize(*args) perk_init(*args) set_perk_mods end #-------------------------------------------------------------------------- # * Setup #-------------------------------------------------------------------------- def set_perk_mods @maxhp_plus = $game_system.actor_perk_mods[0] @maxsp_plus = $game_system.actor_perk_mods[1] @str_plus = $game_system.actor_perk_mods[2] @dex_plus = $game_system.actor_perk_mods[3] @agi_plus = $game_system.actor_perk_mods[4] @int_plus = $game_system.actor_perk_mods[5] end #-------------------------------------------------------------------------- # * Perk Effects #-------------------------------------------------------------------------- def perk_effects(perk_id) effects = PERK_EFFEC[perk_id] if effects.is_a?(String) error_print = "There is an error with perk #{perk_id}'s script." eval(effects) rescue print(error_print) return else for effect in effects case effect[0] when "HP" @maxhp_plus += effect[1] $game_system.actor_perk_mods[0] = @maxhp_plus when "MP" @maxsp_plus += effect[1] $game_system.actor_perk_mods[1] = @maxsp_plus when "Str" @str_plus += effect[1] $game_system.actor_perk_mods[2] = @str_plus when "Dex" @dex_plus += effect[1] $game_system.actor_perk_mods[3] = @dex_plus when "Agi" @agi_plus += effect[1] $game_system.actor_perk_mods[4] = @agi_plus when "Int" @int_plus += effect[1] $game_system.actor_perk_mods[5] = @int_plus end end end end end #============================================================================== # ** Window Perk Selection #============================================================================== class Window_Perk_Selection < Window_Selectable include Wig_Config #-------------------------------------------------------------------------- # * Initialization #-------------------------------------------------------------------------- def initialize super(0, 0, 240, 480) self.contents = Bitmap.new(width - 32, height - 32) @item_max = PERK_NAMES.size @column_max = 1 self.index = 0 self.z = 1 refresh end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh self.contents.clear @data = [] for id in 0...PERK_NAMES.size @data.push(id) end for item in @data draw_item(item) end end #-------------------------------------------------------------------------- # * Draw Item #-------------------------------------------------------------------------- def draw_item(index) self.contents.font.color = $game_party.known_perks.include?(index) ? system_color : $game_party.perk_selectable?(index) ? normal_color : disabled_color x = 4 y = index * 32 self.contents.draw_text(x, y, 220, 32, PERK_NAMES[index]) end end #============================================================================== # ** Window Perk Discription #============================================================================== class Window_Perk_Discription < Window_Selectable include Wig_Config #-------------------------------------------------------------------------- # * Initialization #-------------------------------------------------------------------------- def initialize super(240, 120, 400, 296) self.contents = Bitmap.new(width - 32, height - 32) self.z = 1 @old_perk_id = -1 update end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh(index = 0) self.contents.clear old_size = self.contents.font.size # format and draw perk discription self.contents.font.color = $game_party.perk_selectable?(index) ? normal_color : disabled_color format_string(0, 0, PERK_DISC[index], 360) # draw perk effects effects = PERK_EFFEC[index] text = [] for fect in effects break if fect.is_a?(String) i = effects.index(fect) text.push("+#{fect[1]} to #{fect[0]}") text.push(", ") if i != effects.size - 1 end self.contents.font.color = system_color self.contents.draw_text(4, 190, 200, 32, "Bonuses:") if effects.size > 0 and !effects.is_a?(String) self.contents.font.color = normal_color self.contents.font.size = 16 self.contents.draw_text(4, 205, 360, 32, text.to_s, 2) self.contents.font.size = old_size # draw perk requirements requirements = PERK_REQ[index] text = [] for ment in requirements i = requirements.index(ment) text.push("#{ment[0]} #{ment[1]}") text.push(", ") if i != requirements.size - 1 end text.flatten! self.contents.font.color = system_color self.contents.draw_text(4, 225, 200, 32, "Requirements:") if requirements.size > 0 self.contents.font.color = normal_color self.contents.font.size = 16 self.contents.draw_text(4, 240, 360, 32, text.to_s, 2) self.contents.font.size = old_size end #-------------------------------------------------------------------------- # * Update #-------------------------------------------------------------------------- def update(index = 0) super() if @old_perk_id != index refresh(index) @old_perk_id = index end end end #============================================================================== # ** Window Perk Actor Stats #============================================================================== class Window_Perk_Actor_Stats < Window_Base include Wig_Config #-------------------------------------------------------------------------- # * Initialization #-------------------------------------------------------------------------- def initialize super(240, 0, 400, 120) self.contents = Bitmap.new(width - 32, height - 32) self.z = 1 @maxsp_plus = @str_plus = @dex_plus = @agi_plus = @int_plus = 0 @maxhp_plus = 0 @perk_id = -1 @actor = $game_party.actors[0] update end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh self.contents.clear self.contents.font.size = 18 actor = $game_party.actors[0] draw_actor_level(actor, 300, 64) draw_actor_hp(actor, 0, 0) draw_actor_sp(actor, 200, 0) for type in 0...4 draw_actor_parameter(actor, type) end end #-------------------------------------------------------------------------- # * Draw Parameter #-------------------------------------------------------------------------- def draw_actor_parameter(actor, type, x = 0, y = 32) case type when 0 # Str self.contents.font.color = system_color self.contents.draw_text(x, y, 120, 32, $data_system.words.str) self.contents.font.color = @require[1] ? knockout_color : normal_color self.contents.draw_text(x + 40, y, 36, 32, actor.str.to_s, 2) when 1 # Dex y += 32 self.contents.font.color = system_color self.contents.draw_text(x, y, 120, 32, $data_system.words.dex) self.contents.font.color = @require[2] ? knockout_color : normal_color self.contents.draw_text(x + 40, y, 36, 32, actor.dex.to_s, 2) when 2 # Agi x += 90 self.contents.font.color = system_color self.contents.draw_text(x, y, 120, 32, $data_system.words.agi) self.contents.font.color = @require[3] ? knockout_color : normal_color self.contents.draw_text(x + 40, y, 36, 32, actor.agi.to_s, 2) when 3 # Int x += 90; y += 32 self.contents.font.color = system_color self.contents.draw_text(x, y, 120, 32, $data_system.words.int) self.contents.font.color = @require[4] ? knockout_color : normal_color self.contents.draw_text(x + 40, y, 36, 32, actor.int.to_s, 2) end end #-------------------------------------------------------------------------- # * Draw Level #-------------------------------------------------------------------------- def draw_actor_level(actor, x, y) self.contents.font.color = system_color self.contents.draw_text(x, y, 32, 32, "Lv") self.contents.font.color = @require[0] ? knockout_color : normal_color self.contents.draw_text(x + 32, y, 24, 32, actor.level.to_s, 2) end #-------------------------------------------------------------------------- # * Requirements Met #-------------------------------------------------------------------------- def requirements_met? # create fail array fails = [] # return if perk is known return fails if $game_party.known_perks.include?(@perk_id) # test if player meets requirements requirements = PERK_REQ[@perk_id] for ment in requirements case ment[0] when "Level" fails[0] = true if @actor.level.to_f < ment[1].to_f when "Str" fails[1] = true if @actor.str.to_f < ment[1].to_f when "Dex" fails[2] = true if @actor.dex.to_f < ment[1].to_f when "Agi" fails[3] = true if @actor.agi.to_f < ment[1].to_f when "Int" fails[4] = true if @actor.int.to_f < ment[1].to_f end end return fails end #-------------------------------------------------------------------------- # * Update #-------------------------------------------------------------------------- def update(perk_id = 0) if @perk_id != perk_id @perk_id = perk_id @require = requirements_met? refresh end end #-------------------------------------------------------------------------- # * Make Temp Effects #-------------------------------------------------------------------------- def make_temp_effects effects = PERK_EFFEC[@perk_id] for effect in effects case effect[0] when "HP" @maxhp_plus = effect[1] when "MP" @maxsp_plus = effect[1] when "Str" @str_plus = effect[1] when "Dex" @dex_plus = effect[1] when "Agi" @agi_plus = effect[1] when "Int" @int_plus = effect[1] end end end end #============================================================================== # ** Window_Perk_Points #============================================================================== class Window_Perk_Points < Window_Base include Wig_Config #-------------------------------------------------------------------------- # * Initialization #-------------------------------------------------------------------------- def initialize super(240, 416, 400, 64) self.contents = Bitmap.new(width - 32, height - 32) self.z = 1 refresh end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh self.contents.clear self.contents.font.color = $game_party.perk_points > 0 ? normal_color : disabled_color string = "You have #{$game_party.perk_points} Perk Points to spend." self.contents.draw_text(0, 0, 400, 32, string) end end #============================================================================== # ** Window Perk Grey #============================================================================== class Window_Perk_Grey < Window_Base #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize(w, h, x = 0, y = 0) super(x - 16, y - 16, w + 32, h + 32) self.contents = Bitmap.new(width - 32, height - 32) self.z = 5 self.opacity = 0 @width = w + 32 @height = h + 32 refresh end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh self.contents.clear rect = Rect.new(0, 0, @width, @height) self.contents.fill_rect(rect, Color.new(0, 0, 0, 120)) end end #============================================================================== # ** Window Base #============================================================================== class Window_Base #-------------------------------------------------------------------------- # * Format String #-------------------------------------------------------------------------- def format_string(x, y, string, max_width = 100) temp_word_array = string.scan (/./) position = line_break = 0 lines = [] blank_width = [] new_string = [lines, blank_width] for i in 0...temp_word_array.size character = temp_word_array[i] if character == " " or i == temp_word_array.size - 1 i += 1 if i == temp_word_array.size - 1 if self.contents.text_size(string[line_break, i-line_break]).width <= max_width position = i else line = temp_word_array[line_break, position-line_break] new_string[0].push(line) line_blank = max_width - self.contents.text_size(string[ line_break, position-line_break]).width new_string[1].push(line_blank.to_f / (line.size.to_f - 1.0)) line_break = position + 1 position = i end end end new_string[0].push(temp_word_array[line_break, temp_word_array.size - line_break]) return if new_string[0].nil? for line in 0...lines[0].size self.contents.draw_text(x, y + (line * 32), 380, 32, lines[line].to_s) end end end
Требования перков по силе и т.п. проверяются с учетом бонусов от других перков, распределенных очков, бонусов от оружия/брони.
Кстати, скрипт точно работоспособной версии? У меня он даже сам по себе, как выяснилось, благополучно задваивал бонусные статы на чистом проекте.
Последний раз редактировалось Nefas; 19.03.2015 в 21:55.
...sed semel insanivimus omnes...
Эту тему просматривают: 3 (пользователей: 0 , гостей: 3)
Социальные закладки