With the release of MV I'm jumping back into the RPG Maker pool. These are the scripts I created for my old Ace project. I'm putting them here to give some examples of what can be done to the games basic combat system with a little creativity. I also changed a bunch of window stuff to show the new stats, so I'll include those as well. Compatibility was never a concern of mine. I didn't alias any scripts, I overwrote them. That means these will probably not 'plug and play'...
With the release of MV I'm jumping back into the RPG Maker pool. These are the scripts I created for my old Ace project. I'm putting them here to give some examples of what can be done to the games basic combat system with a little creativity. I also changed a bunch of window stuff to show the new stats, so I'll include those as well.
Compatibility was never a concern of mine. I didn't alias any scripts, I overwrote them. That means these will probably not 'plug and play' into any project with any other scripts expecting default behavior from any of the classes I changed. If you want to do what I did, follow what I did and figure out a way to do the same things in your project.
Mechanically, the combat is calculated as close to Diablo 2 stats as I could get. Weapons have a damage range which is multiplied by your strength(ATK)/100. You have a chance to evade, block, or defend (armor). If any of those work the attack misses and does no damage. If it hits, it does regular damage unless a critical is landed. Different weapons have different chances of landing a critical (5% or 10%) and different multiples (x2 or x3). The actual 'damage box' calculation is:
a.weapons[0].atk*(1+(a.atk-a.weapons[0].atk)/100)
"Fame" is a measure of how well known you are. It increases by killing boss mobs, completing some quests, and killing goblins. Different events reference it in their dialog and decision branching (they don't let wandering nobodies into the king's chamber, for example).
Once my dropbox finishes syncing I'll include a link to the unencrypted project. It's around 500 MB. I trimmed out the extra music and big things but there's still some fat here and there, including a few extra maps and things like that. I'm not going to try to go back in and change anything now as I'll just end up breaking the project since I don't remember what all is used where any more. I'll put screenshots in this thread so you can see what I did without having to look at the project itself if you want
The project has quite a bit of custom stuff in it, so I'm putting that up 'for educational use'. Please don't distribute it or take resources.
Link to project (self extracting .exe, unencrypted):
https://www.dropbox.com/s/dje39j2ajv201k0/Requiem%20for%20Tomorrow%20unencrypted.exe?dl=0
That out of the way, here are the combat scripts (free non-commercial, commercial use PM me):
Any questions about any of the scripts or why I did what I did where, feel free to ask!
Game_BattlerBase:
#==============================================================================# ** Game_BattlerBase#------------------------------------------------------------------------------# This base class handles battlers. It mainly contains methods for calculating# parameters. It is used as a super class of the Game_Battler class.#==============================================================================class Game_BattlerBase def hit; xparam(0); end # The enemy's individual Fame value def exr; sparam(9); end # This is the enemy's 'Level'. It # isn't used directly as yet, but as a check # for fame and possibly drops and XP awards #-------------------------------------------------------------------------- # * Get Maximum Value of Parameter #-------------------------------------------------------------------------- def param_max(param_id) return 999999 if param_id == 0 # MHP return 9999 if param_id == 1 # MMP return 9999 # increased to allow higher defense values end #-------------------------------------------------------------------------- # * Get Skill ID of Normal Attack #-------------------------------------------------------------------------- def attack_skill_id if self.is_a?(Game_Actor) if self.class_id == 14 # This is Mitzi's throw grenade skill return 201 # The following code block checks for the existence # of skills that should be used 'automatically' # such as double attack and double strike # more can be added as the class and skills learned list grows else self.skills.each { |skill| if skill.id == 4 return 4 elsif skill.id == 3 return 3 end }# ends code block end end return 1 endend
Game_Battler: (this is where most of the changes are)
class Game_Battler < Game_BattlerBase # for enemies: # PHA = base attack # EXR = Shield block % # ATK = Base Damage # # # for actors # ATK = attack skill modifier used in calculations (weapon ATK removed) # # for enemies and actors # CEV = Critical Hit Multiplier # CRI = Critical Hit Chance # # # for weapons # ATK = Base Damage # LUK = Variance as an integer # # for shields # LUK = Shield Block chance as percent def make_damage_value(user, item) if item.damage.recover? value = item.damage.eval(user, self, $game_variables) else value = base_damage(user) # Item is the attack skill for now. Need either value = apply_variance(user, value) # a conditional or switch for other skills if user.actor? #apply attack skill bonus if (!user.equips[0]) value*=1 #### failsafe for no weapon equipped else value*=1.0+((user.atk-user.equips[0].params[2])/100.0) end else value*=1.0+user.pha end end value *= item_element_rate(user, item) # <- this will need a huge overhaul value *= pdr if item.physical? value *= mdr if item.magical? value *= rec if item.damage.recover? value = apply_critical(user, value) if @result.critical value = apply_guard(value) @result.make_damage(value.to_i, item) end #========================================================================== # * Getting the base damage from actor's weapon or enemy's attack #========================================================================== def base_damage(user) value=1.0 # establishes that value is a float return 2 if (user.actor? && !(user.equips[0])) # failsafe in case actor has no weapon equipped. value=(user.actor?)?user.equips[0].params[2]:user.atk #get base damage if user.actor? #apply skill bonus value*=1.0+((user.atk-user.equips[0].params[2])/100.0) else value*=1.0+user.pha end end #-------------------------------------------------------------------------- # * Apply Critical #-------------------------------------------------------------------------- def apply_critical(user, damage) #critical multiplier now based on if user.cev<0.001 crit_multiplier=0.01 else crit_multiplier=user.cev end damage *= (100*crit_multiplier) end #-------------------------------------------------------------------------- # * Applying Variance #-------------------------------------------------------------------------- def apply_variance(user, damage) if (user.actor? && (!user.equips[0])) ### Failsafe for no equipped weapon return 0 end variance=(user.actor?)?user.equips[0].params[7]:user.luk min_damage=(damage-variance).to_i max_damage=(damage+variance).to_i min_damage+rand(max_damage-min_damage) end #-------------------------------------------------------------------------- # * Calculate Hit Rate of Skill/Item #-------------------------------------------------------------------------- def item_hit(user, item) if user.actor? hit = user.atk/(user.atk+self.def).to_f #returns hit chance as a decimal else hit = (user.pha*100)/(user.pha*100+self.def).to_f end return 0.10 if hit<0.10 #Always 10% chance to overcome defense return 0.90 if hit>0.90 #Always 10% chance to miss return hit end #-------------------------------------------------------------------------- # * Calculate Evasion Rate for Skill/Item #-------------------------------------------------------------------------- def item_eva(user, item) if user.actor? evasion=self.agi/(user.atk+user.agi).to_f else evasion=self.agi/(user.pha*100+user.agi).to_f end return 0.05 if evasion<0.05 #always 5% chance to evade return 0.50 if evasion>0.50 #never more than 50% chance return evasion end #-------------------------------------------------------------------------- # * Calculate Critical Rate of Skill/Item #-------------------------------------------------------------------------- def item_cri(user, item) crit=user.cri return 0.05 if crit<0.05 #always a 5% chance to crit return 0.50 if crit>0.50 #never more than a 50% chance return crit end #========================================================================== # * Calculate Shield Block #========================================================================== def shield_block(user, item) if self.actor? return 0 if !self.equips[1] #no shield equipped shield = self.equips[1].params[7].to_f block = (shield/100.0) *(self.def/user.atk.to_f) elsif self.enemy? block=self.exr*(self.def/user.atk.to_f) end if block>0.25 #25% cap on shield block return 0.25 else return block end end #-------------------------------------------------------------------------- # * Apply Effect of Skill/Item #-------------------------------------------------------------------------- def item_apply(user, item) @result.clear @result.used = item_test(user, item) if !item.damage.recover? @result.missed = (@result.used && rand >= item_hit(user, item)) @result.evaded = (!@result.missed && rand < item_eva(user, item)) @result.blocked = (!@result.missed && !@result.evaded && rand < shield_block(user, item)) end if @result.hit? || item.damage.recover? unless item.damage.none? @result.critical = (rand < item_cri(user, item)) make_damage_value(user, item) execute_damage(user) end item.effects.each {|effect| item_effect_apply(user, item, effect) } item_user_effect(user, item) end endend
Game_Actor
#==============================================================================# ** Game_Actor#------------------------------------------------------------------------------# This class handles actors. It is used within the Game_Actors class# ($game_actors) and is also referenced from the Game_Party class ($game_party).#==============================================================================class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # * Initialize Skills # # This sets Mitzi's basic attack to throw grenade #-------------------------------------------------------------------------- def init_skills @skills = [] self.class.learnings.each do |learning| learn_skill(learning.skill_id) if learning.level <= @level end if self.class_id == 14 self.skills[1]=$data_skills[201] end end #-------------------------------------------------------------------------- # * Level Up #-------------------------------------------------------------------------- def level_up @level += 1 self.class.learnings.each do |learning| learn_skill(learning.skill_id) if learning.level == @level end @hp=self.mhp endend
Game_ActionResult
#==============================================================================# ** Game_ActionResult#------------------------------------------------------------------------------# This class handles the results of battle actions. It is used internally for# the Game_Battler class.#==============================================================================class Game_ActionResult #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_accessor :blocked # shield block flag #-------------------------------------------------------------------------- # * Determine Final Hit #-------------------------------------------------------------------------- def hit? @used && !@missed && !@evaded && !@blocked endend
Game_Troop
#==============================================================================# ** Game_Troop#------------------------------------------------------------------------------# This class handles enemy groups and battle-related data. Also performs# battle events. The instance of this class is referenced by $game_troop.#==============================================================================class Game_Troop < Game_Unit def total_fame #totals the fame value of each enemy encounter_fame=0 #during the victory processing phase $game_troop.members.each do |enemy| encounter_fame += (enemy.hit*100).to_i #put in TLC check here enemy vs actor level end return encounter_fame endend
BattleManager
#==============================================================================# ** BattleManager#------------------------------------------------------------------------------# This module manages battle progress.#==============================================================================module BattleManager #-------------------------------------------------------------------------- # * Victory Processing #-------------------------------------------------------------------------- def self.process_victory play_battle_end_me replay_bgm_and_bgs $game_message.add(sprintf(Vocab::Victory, $game_party.name)) display_exp gain_gold gain_drop_items gain_exp if $game_switches[26] then # If the fame switch is set, calculate fame earned fame = $game_troop.total_fame $game_variables[101] += fame if fame > 0 # Replace this with an enemy variable # $game_message.add(sprintf("You have gained fame in the region")) if fame>0 end SceneManager.return battle_end(0) return true endend
These are some of the window classes - selecting an item in the shop shows the equipped stats on the shopping actor:
Window_Base:
class Window_Base < Window #-------------------------------------------------------------------------- # * Reset Font Settings #-------------------------------------------------------------------------- def reset_font_settings change_color(normal_color) contents.font.name = ["Amaranth"] contents.font.size = Font.default_size contents.font.bold = Font.default_bold contents.font.italic = Font.default_italic end #-------------------------------------------------------------------------- # * Draw Parameters # # # param_id is the index value for the actor's stat: # ATK, DEF, MAT, MDF, AGI, LUK # # Taking out a lot of 'padding' to allow for a middle column of stats # # ATK needs to be shown without weapon's add # LUK needs to be shown without shield block #-------------------------------------------------------------------------- def draw_actor_param(actor, x, y, param_id) stat_value=0 #initialize stat_value speed_mod=0 change_color(system_color) draw_text(x, y, 60, line_height, Vocab:aram(param_id)) change_color(normal_color) #-------------------------------------------------------------------------- # # I'm changing the values printed so that they reflect the true # Values used in battle calculations. This means removing weapon # ATK from actor ATK and Shield LUK from actor LUK # #-------------------------------------------------------------------------- case param_id when 2 if (actor.equips[0]) stat_value = actor.param(2)-actor.equips[0].params[2] else stat_value = 0 end when 6 5.times do |j| if (actor.equips[j]) speed_mod+=actor.equips[j].params[6] end end stat_value=actor.param(6)-speed_mod when 7 if (actor.equips[1]) stat_value = (actor.param(7)-actor.equips[1].params[7]) else stat_value = actor.param(7) end else stat_value = actor.param(param_id) end draw_text((x+60), y, 36, line_height, stat_value, 2) end #-------------------------------------------------------------------------- # * Draw Equipment stats # # This method will display min/max damage, crit values, block/evade% # I'm patterning it after draw_parameters to get the bitmap window # sizing right - the values will be drawn by draw_equip_stats #-------------------------------------------------------------------------- def draw_equip_stats(actor, x, y, param_id, stat_name) stat_value=0.0 #initialize stat_value as a float change_color(system_color) draw_text(x, y, 120, line_height, stat_name) change_color(normal_color) # Calulate all the values, then convert to string and append symbols # where needed - Percents and the 'x' for Crit Multiplier case param_id when 0 # Minimum Damage if !actor.equips[0] stat_value = 2 # Unarmed base damage else stat_value = actor.equips[0].params[2]-actor.equips[0].params[7] stat_value*=1.0+((actor.atk-actor.equips[0].params[2])/100.0) end stat_value = stat_value.truncate when 1 # Maximum Damage if !actor.equips[0] stat_value = 3 # Unarmed base damage else stat_value = actor.equips[0].params[2]+actor.equips[0].params[7] stat_value*=1.0+((actor.atk-actor.equips[0].params[2])/100.0) end stat_value = stat_value.truncate when 2 # Critcal Hit Chance stat_value = actor.cri if stat_value < 0.05 stat_value = 0.05 # Always a 5% chance to crit elsif stat_value > 0.50 stat_value =0.50 # Never more than a 50% chance to crit end stat_value *= 100 stat_value = stat_value.truncate stat_value = stat_value.to_s stat_value += "%" when 3 stat_value = actor.cev if stat_value < 0.001 stat_value = 0.01 end stat_value *=100 stat_value = "x" + stat_value.to_s when 4 stat_value = actor.agi when 5 if (!actor.equips[1]) stat_value = 0 else stat_value = actor.equips[1].params[7] end if stat_value > 25 stat_value = 25 end stat_value = stat_value.to_s + "%" end draw_text(x+120, y, 36, line_height, stat_value, 2) end end
Window_EquipStatus:
#==============================================================================# ** Window_EquipStatus#------------------------------------------------------------------------------# This window displays actor parameter changes on the equipment screen.#==============================================================================class Window_EquipStatus < Window_Baseattr_accessor :item #-------------------------------------------------------------------------- # * Object Initialization # # Add the new parameter array - I moved it for scope reasons # But it really should be here. Something for me to come back to. # #-------------------------------------------------------------------------- def initialize(x, y) super(x, y, window_width, window_height) x=0 @actor=nil @temp_actor = nil @item = nil @page_index = 0 refresh end #-------------------------------------------------------------------------- # * Get Window Width #-------------------------------------------------------------------------- def window_width return 240 end #-------------------------------------------------------------------------- # * Get Number of Lines to Show # # Increased line numbers to 13 to allow for new stats # #-------------------------------------------------------------------------- def visible_line_number return 9 end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh contents.clear 9.times {|i| draw_item(0, (line_height * i), i) } # <--- changed 'x' to 0 end #-------------------------------------------------------------------------- # * Draw Parameter Name # # For now, I'm declaring and initializing equip_stats here. # Not the most 'elegant' solution since it gets recreated every time # but I can mess with the variable scope later # #-------------------------------------------------------------------------- def draw_param_name(x, y, param_id) equip_stats="ATK", "Min Dmg", "Max Dmg", "Critical", "DEF", "Speed", "Block", "Max HP", "Max MP" change_color(system_color) draw_text(x, y, 120, line_height, equip_stats[param_id]) end #-------------------------------------------------------------------------- # * Draw Item #-------------------------------------------------------------------------- def draw_item(x, y, param_id) draw_param_name(x, y, param_id) draw_equip_stats(@actor, x+84, y, param_id) if @actor draw_right_arrow(x + 142, y) if @temp_actor draw_equip_stats(@temp_actor, x+155, y, param_id) else draw_equip_stats(@actor, x+155, y, 10) end end #-------------------------------------------------------------------------- # * Draw Equipment stats # # This method will display min/max damage, crit values, block/evade% # I'm patterning it after draw_parameters to get the bitmap window # sizing right - the values will be drawn by draw_equip_stats # # Overriding the window_base method to add ATK, DEF, Max HP, and Max MP #-------------------------------------------------------------------------- def draw_equip_stats(actor, x, y, param_id) stat_value = 0.0 #initialize stat_value as a float speed_mod = 0 #used to add speed of all equipment temp_value = 0.0 #used to hold critical multiplier # Calulate all the values, then convert to string and append symbols # where needed - Percents and the 'x' for Crit Multiplier case param_id when 0 # ATK if actor.equips[0] stat_value = actor.atk - actor.equips[0].params[2] else stat_value = actor.atk end when 1 # Minimum Damage if !actor.equips[0] stat_value = 2 # Unarmed base damage else stat_value = actor.equips[0].params[2]-actor.equips[0].params[7] stat_value*=1.0+((actor.atk-actor.equips[0].params[2])/100.0) end stat_value = stat_value.truncate when 2 # Maximum Damage if !actor.equips[0] stat_value = 3 # Unarmed base damage else stat_value = actor.equips[0].params[2]+actor.equips[0].params[7] stat_value*=1.0+((actor.atk-actor.equips[0].params[2])/100.0) end stat_value = stat_value.truncate when 3 # Critcal Hit Chance stat_value = actor.cri if stat_value < 0.05 stat_value = 0.05 # Always a 5% chance to crit elsif stat_value > 0.50 stat_value =0.50 # Never more than a 50% chance to crit end stat_value *= 100 stat_value = stat_value.truncate stat_value = stat_value.to_s stat_value += "%" temp_value += actor.cev # Critical Multiplies if temp_value < 0.001 temp_value = 0.01 end temp_value *=100 temp_value = temp_value.to_i stat_value += "x" + temp_value.to_s # Combine Critcal % and x when 4 # Defense stat_value = actor.def when 5 # Speed - bonus to agility 5.times do |j| if (actor.equips[j]) speed_mod+=actor.equips[j].params[6] end end stat_value = speed_mod when 6 # Base Block Chance if (!actor.equips[1]) stat_value = 0 else stat_value = actor.equips[1].params[7] end if stat_value > 25 stat_value = 25 end stat_value = stat_value.to_s + "%" when 7 # Max HP stat_value = actor.mhp when 8 stat_value = actor.mmp # Max MP when 10 # Dummy value for consumable stat_value = " ".to_s # or non equippable items end draw_text(x, y, 60, line_height, stat_value, 2) end end
Scene_Shop: (this is the 'workhorse' window class)
#==============================================================================# ** Scene_Shop#------------------------------------------------------------------------------# This class performs shop screen processing.#==============================================================================class Scene_Shop < Scene_MenuBaseattr_accessor :status_window #-------------------------------------------------------------------------- # * Start Processing #-------------------------------------------------------------------------- def start super @actor=nil create_help_window create_actor_window create_gold_window create_dummy_window_2 create_dummy_window create_buy_window create_status_window create_blank_window create_number_window create_category_window create_sell_window end ############################################### ### Create Equipment Status Change Window ### ############################################### def create_status_window wx = @buy_window.width wy = @dummy_window.y ww = Graphics.width - wx wh = @dummy_window.height @status_window = Window_EquipStatus.new(wx, wy) @status_window.viewport = @viewport @status_window.width=ww @status_window.height=wh @status_window.hide ############################################################## ### The temp_actor code was in Window_EquipItem ### ### I moved it into buy_window (also < Window_Selectable ### ### so it can run the update code when items are selected ### ### or moused over in the buy list. ### ############################################################## @buy_window.status_window=@status_window end #-------------------------------------------------------------------------- # * Create Dummy Windows #-------------------------------------------------------------------------- def create_dummy_window wy = @actor_window.y + @actor_window.height+@dummy_window_2.height wh = Graphics.height - wy @dummy_window = Window_Base.new(0, wy, Graphics.width, wh) @dummy_window.viewport = @viewport end ######################################### ### Blank Window for consumable and ### ### Non-equippable items ### ######################################### def create_blank_window bwy = @actor_window.y + @actor_window.height+@dummy_window_2.height bwh = Graphics.height - @actor_window.y - @actor_window.height - @dummy_window_2.height bwx = @buy_window.width bww = Graphics.width - @buy_window.width @blank_window = Window_Base.new(bwx, bwy, bww, bwh) @blank_window.viewport=@viewport @blank_window.hide @buy_window.blank_window = @blank_window ### to be used by Window_ShopBuy end ############################################### ### Create Dummy Window for shop commands ### ############################################### def create_dummy_window_2 wy = @actor_window.y + @actor_window.height wh = @gold_window.height dw2_width=Graphics.width-@gold_window.width @dummy_window_2 = Window_Base.new(0, wy, dw2_width, wh) @dummy_window_2.viewport = @viewport end ############################# ### Create Actor Window ### ############################# def create_actor_window width = Graphics.width @actor_window = Window_Actors.new @actor_window.viewport = @viewport @actor_window.set_handlerSofia, methodcreate_command_window_sofia)) @actor_window.set_handlerJaxl, methodcreate_command_window_jaxl)) @actor_window.set_handlerLyrra, methodcreate_command_window_lyrra)) @actor_window.set_handlerMitzi, methodcreate_command_window_mitzi)) @actor_window.set_handlercancel, methodreturn_scene)) @actor_window.y = @help_window.height end ################################################### ### Creating Command Window Callers to pass ### ### Actor ID's into the method to show the ### ### correct stats for equipment purchases ### ################################################### def create_command_window_sofia @status_window.actor=$game_actors[1] @buy_window.actor=$game_actors[1] create_command_window end def create_command_window_jaxl @status_window.actor=$game_actors[2] @buy_window.actor=$game_actors[2] create_command_window end def create_command_window_lyrra @status_window.actor=$game_actors[3] @buy_window.actor=$game_actors[3] create_command_window end def create_command_window_mitzi @status_window.actor=$game_actors[4] @buy_window.actor=$game_actors[4] create_command_window end #-------------------------------------------------------------------------- # * Create Command Window #-------------------------------------------------------------------------- def create_command_window @command_window = Window_ShopCommand.new(@gold_window.x, @purchase_only) @command_window.viewport = @viewport @command_window.y = @help_window.height + @actor_window.height @command_window.set_handlerbuy, methodcommand_buy)) @command_window.set_handlersell, methodcommand_sell)) @command_window.set_handlercancel, methodcommand_cancel)) end #-------------------------------------------------------------------------- # * Create Gold Window #-------------------------------------------------------------------------- def create_gold_window @gold_window = Window_Gold.new @gold_window.viewport = @viewport @gold_window.x = Graphics.width - @gold_window.width @gold_window.y = @help_window.height + @actor_window.height end ############################### ### Create Purchase List ### ############################### def create_buy_window wy = @dummy_window.y wh = @dummy_window.height @buy_window = Window_ShopBuy.new(0, wy, wh, @goods) @buy_window.viewport = @viewport @buy_window.help_window = @help_window @buy_window.hide @buy_window.set_handlerok, methodon_buy_ok)) @buy_window.set_handlercancel, methodon_buy_cancel)) end #-------------------------------------------------------------------------- # * Activate Purchase Window #-------------------------------------------------------------------------- def activate_buy_window @dummy_window_2.hide @status_window.show @status_window.refresh @buy_window.money = money @buy_window.show.activate end #-------------------------------------------------------------------------- # * Buy [Cancel] #-------------------------------------------------------------------------- def on_buy_cancel @command_window.activate @dummy_window.show @buy_window.hide @status_window.hide @blank_window.hide @status_window.item = nil @help_window.clear end ############################################### ### Buy/Sell Cancel to bring back to Party ### ############################################### def command_cancel @actor_window.activate @dummy_window_2.show @blank_window.hide @command_window.hide @help_window.clear end #-------------------------------------------------------------------------- # * Quantity Input [OK] #-------------------------------------------------------------------------- def on_number_ok Sound.play_shop @status_window.refresh case @command_window.current_symbol when :buy do_buy(@number_window.number) when :sell do_sell(@number_window.number) end end_number_input @gold_window.refresh end ######################################################## ### Buy command - needs to create the item list ### ### and the status window for the stat changes ### ######################################################## def command_buy @dummy_window.hide @status_window.show @status_window.refresh activate_buy_window endend
Window_ShopBuy
#==============================================================================# ** Window_ShopBuy#------------------------------------------------------------------------------# This window displays a list of buyable goods on the shop screen.#==============================================================================class Window_ShopBuy < Window_Selectable #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_reader :status_window # Status window attr_accessor :blank_window attr_accessor :actor # Actor doing the shopping #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize(x, y, height, shop_goods) super(x, y, window_width, height) @shop_goods = shop_goods @money = 0 refresh select(0) end #-------------------------------------------------------------------------- # * Draw Item #-------------------------------------------------------------------------- def draw_item(index) item = @data[index] rect = item_rect(index) draw_item_name(item, rect.x, rect.y, enable?(item)) rect.width -= 4 draw_text(rect, price(item), 2) end #-------------------------------------------------------------------------- # * Draw Item Name ######## <== overriding Window_Base Method. # enabled : Enabled flag. When false, draw semi-transparently. #-------------------------------------------------------------------------- def draw_item_name(item, x, y, enabled = true, width = 228) ### width = 172 return unless item draw_icon(item.icon_index, x, y, enabled) change_color(normal_color, enabled) draw_text(x + 24, y, width, line_height, item.name) end #-------------------------------------------------------------------------- # * Set Actor #-------------------------------------------------------------------------- def actor=(actor) return if @actor == actor @actor = actor refresh end #-------------------------------------------------------------------------- # * Update Help Text ########## <===== Taken from Window EquipItem #-------------------------------------------------------------------------- def update_help @help_window.set_item(item) if @help_window @status_window.item = item if @status_window methods=item.methods if methods.include? :etype_id @slot_id=item.etype_id end if @actor && @status_window && @slot_id && @actor.equippable?(item) @blank_window.hide @status_window.show temp_actor = Marshal.load(Marshal.dump(@actor)) temp_actor.force_change_equip(@slot_id, item) @status_window.set_temp_actor(temp_actor) @status_window.refresh else @status_window.hide @blank_window.show end endend
Edit: The promised screenshots -
Status Screen:
https://www.dropbox.com/s/g0byqiicwdz86qn/Status.png?dl=0
Equip Screen:
https://www.dropbox.com/s/65ayv8v7aam9jyj/Equip.png?dl=0
Shop Screen:
https://www.dropbox.com/s/nu3ogy83tg20sc9/Shop%20Screen.png?dl=0
Enemy Stats (from database):
https://www.dropbox.com/s/3vv3ul1yhfvxgdo/Enemy%20Stats.png?dl=0
Note the defined extra parameters for the new stats.
That out of the way, here are the combat scripts (free non-commercial, commercial use PM me): Any questions about any of the scripts or why I did what I did where, feel free to ask! Game_BattlerBase: Spoiler