Group: Member
Posts: 2
Type: None
RM Skill: Beginner
So, I'm having an issue. I really want two separate MP bars for each character, in order to have a separate pool for both Skills and Magic.
The issue I'm running in to is that both scripts I've found interfere with Reedo's Side Battle's function of allowing player heals/buffs and enemy skills to animate on-screen. I am sure it has to do with how both scripts overwrite the battle scene. I've exhausted my limited knowledge of how to counter-act it, so I need someone's help.
The first script is Zetu's Alternate MP:
Code
CODE
#======================# # Z-Systems by: Zetu # #===========================#======================#===========================# # * * * Alternate MP X v3.01 * * * # #------------------------------------------------------------------------------# # Will Overwrite Draw Functions for MP. # #------------------------------------------------------------------------------# # Known Compatable Battle Systems: # # • Tankentai # #------------------------------------------------------------------------------# # Version History # # 3.01 ALPHA # #=#==========================================================================#=# # You may need slight scripting knowledge of working with arrays (but # # not a whole lot!). # #--------------------------------------------------------------------------# # * * Anything in "< >" means replace with the described contents. * * # # REQUIRED PARAMETERS (Any resource without it will cause an error) # # :name, <name of resource> # # :abbv, <1 or 2 character abbv. of resource> # # :color, <color 1>, <color 2> # # * These color attributes are indexes of the window skin # # OPTIONAL PARAMETERS # # Resource Regen for each turn: # # :regen, <type>, <base> # # type can be :maxmp, :atk, :def, :spi, :agi, :set # # base is number multiplied by type (:set is considered 1) # # Resource Regen on Damage # # :regenondamage, <type>, <base> # # type can be :damage, :maxmp, :set, :percentdmg # # base in number multipled by type (:set is considered 1) # # (:percentdmg is ratio of maxmp and damage) # # :regenelemental, <element_id>, <type>, <base> # # same as :regenondamage, except on elemental damage (of # # element_ids) (may place more than 1 id) # # Resource Change Out of Battle: # # :depleteoob (Set to 0) # # :regenoob (Set to Max) # # Resource Inversion # # :invert # # this allows the resource to Add instead of Subtract for its cost # # and disallows skill use if cost will exceed the maxmp # #========================================================================== # module Z11
RESOURCES = [ :name, "Stamina", :abbv, "Stamina", :color, 23, 22 ],[ :depleteoob, :regen, :spi, 0.5, :name, "Magic", :abbv, "Magic", :color, 10, 2 ] # If set to false, use RESBYCLASS's indexes as Actor IDs instead of Class IDs BIND_TO_CLASS = true
# <Class ID> => <Array of Resources by :name parameter> # Recommended max is 2 RESBYCLASS = { 1 => ["Stamina", "Magic"], 2 => ["Stamina", "Magic"], 3 => ["Stamina", "Magic"], }
# Default value if not in RESBYCLASS hash. DEF_RES = "Stamina" #=========================================================================# # Note Tags: To be used in notebox # <regen: mana/stamina> (Heal) # <ampx: mana/stamina> (Damage) #=========================================================================# #Skill Notes
#States what Resource Skill uses. Use :name parameter (case insensitive) #If tag does not exist, will default to actor's primary resource RESOURCECOSTTYPE = /<ampx[: ]+(.*)>/i #========#======================#====#================================#========# #--------# #----# DO NOT EDIT PAST THIS POINT!!! #--------# #--------# End of Customization #----# Editing will cause death by #--------# #--------# #----# brain asplosions. #--------# #========#======================#====#================================#========# def self.get_resource_index(type) for array in RESOURCES if array[array.index(:name)+1].upcase == type.upcase return RESOURCES.index(array) end end return -1 end
def initialize(type, actor) @index = Z11::get_resource_index(type) @actor = actor scan_object_variables(type) end
def scan_object_variables(type) i = 0 array=Z11::RESOURCES[@index] @tags = [] @max = @actor.maxmp @value = @max @maxdefault = true @regenelemental = {} while (i < array.size) case array[i] when :name; @name = array[i+1]; i+=1 when :abbv; @abbv = array[i+1]; i+=1 when :color; @color1 = array[i+1]; @color2 = array[i+2]; i+=2 when :regen; @regentype = array[i+1]; @regenbase = array[i+2]; i+=2 when :regenondamage @regenodtype = array[i+1] @regenodbase = array[i+2] i+=2 when :regenelemental i+=1 id = [] while (array[i].is_a?(Integer)) id.push(array[i]) i+=1 end for n in id @regenelemental[n]= array[i], array[i+1] end i+=1 when :max @max = array[i+1] i+=1 @value = [@max, @value].min @maxdefault = false when :depleteoob; @tags.push(:depleteoob); @value = 0 when :regenoob; @tags.push(:regenoob) when :invert; @tags.push(:invert) end i+=1 end end
def value=(new_value) @value = [[new_value, 0].max, @max].min end
end
class Game_Actor < Game_Battler
alias ampx_setup setup def setup(actor_id) ampx_setup(actor_id) @ampx = [] for resource in self.resources @ampx.push(Game_Resources.new(resource,self)) end end
def resources if Z11::BIND_TO_CLASS result = Z11::RESBYCLASS[self.class_id] else result = Z11::RESBYCLASS[self.actor_id] end return result.nil? ? [Z11::DEF_RES] : result end
alias z11ed execute_damage unless $@ def execute_damage(user) z11ed(user) ampx_on_hit(@hp_damage) self.mp -= @mp_damage#### if @absorbed user.mp += @mp_damage#### end end
def resourcenameof(skill) skill.note.scan(Z11::RESOURCECOSTTYPE){ return $1.upcase } return self.ampx[0].name.upcase end
end
class Game_Enemy < Game_Battler####
alias ampx_initialize initialize def initialize(index, enemy_id) ampx_initialize(index, enemy_id) @ampx = [Game_Resources.new(Z11::DEF_RES,self)] end
def resources return [Z11::DEF_RES] end
def resourcenameof(skill) return Z11::DEF_RES end
end
class Game_Battler attr_reader :ampx
def skill_can_use?(skill) return false unless skill.is_a?(RPG::Skill) return false unless movable? return false if silent? and skill.spi_f > 0 resource = skill.resourceof(self) return false unless self.ampx.include?(resource) if resource.tags.include?(:invert) return false if calc_mp_cost(skill) + resource.value > resource.max else return false if calc_mp_cost(skill) > resource.value end if $game_temp.in_battle return skill.battle_ok? else return skill.menu_ok? end end
alias z11ed execute_damage unless $@ def execute_damage(user) z11ed(user) ampx_on_hit(@hp_damage) self.mp -= @mp_damage#### if @absorbed user.mp += @mp_damage#### end end
def ampx_on_hit(damage) return unless damage > 0 for resource in @ampx next if resource.regenodtype.nil? value = resource.regenodbase case resource.regenodtype when :damage value *= damage when :maxmp value *= resource.max when :percentdmg value *= 100*damage/resource.max end resource.value += value.to_i next if @obj.nil? total = 0 value = 0 for i in @obj.element_set if resource.regenelemental.key?(i) value = resource.regenelemental[i][1] case resource.regenelemental[i][0] when :damage; value *= damage when :maxmp; value *= resource.max when :percentdmg; value *= 100*damage/resource.max end total+=1 end end resource.value += (value/total).to_i if total != 0 end end
def recover_all @hp = maxhp return if @ampx.nil? for resource in @ampx unless resource.tags.include?(:depleteoob) resource.value = resource.max end end for i in @states.clone remove_state(i) end end
alias z11modv make_obj_damage_value unless $@ def make_obj_damage_value(user, obj) @obj = obj z11modv(user,obj) end
alias z11madv make_attack_damage_value def make_attack_damage_value(attacker) @obj = nil z11madv(attacker) end
end
class Scene_Base alias old_main main unless $@ def main old_main refresh_zsr end
def refresh_zsr for actor in $game_party.members for resource in actor.ampx if resource.tags.include?(:regenoob) resource.value=resource.max elsif resource.tags.include?(:depleteoob) resource.value=0 end end end end
end
class Scene_Battle < Scene_Base
def regen_ampx(actor) return if actor.dead? for resource in actor.ampx next if resource.regentype.nil? value = resource.regenbase case resource.regentype when :maxmp; value *= resource.max when :atk; value *= actor.atk when :def; value *= actor.def when :spi; value *= actor.spi when :agi; value *= actor.agi end resource.value += value.to_i end @status_window.refresh end
def refresh_zsr for actor in $game_party.members for resource in actor.ampx if resource.tags.include?(:regenoob) resource.value = resource.max elsif resource.tags.include?(:depleteoob) resource.value = 0 end end end end
end
class Scene_Skill < Scene_Base
def use_skill_nontarget # OVERWRITE Sound.play_use_skill resource = @skill.resourceof(@actor) if resource.tags.include?(:invert) resource.value += @actor.calc_mp_cost(@skill) else resource.value -= @actor.calc_mp_cost(@skill) end @status_window.refresh @skill_window.refresh @target_window.refresh if $game_party.all_dead? $scene = Scene_Gameover.new elsif @skill.common_event_id > 0 $game_temp.common_event_id = @skill.common_event_id $scene = Scene_Map.new end end
end
class Scene_Item < Scene_Base
def use_item_nontarget # OVERWRITE Sound.play_use_item $game_party.consume_item(@item) @item_window.draw_item(@item_window.index) @target_window.refresh if $game_party.all_dead? $scene = Scene_Gameover.new elsif @item.common_event_id > 0 $game_temp.common_event_id = @item.common_event_id $scene = Scene_Map.new end end
end
class RPG::Skill < RPG::UsableItem
def resourceof(actor) unless actor.actor? return actor.ampx[0] end name = actor.resourcenameof(self) for resource in actor.ampx if resource.name.upcase==name return resource end end print "Error: def resourceof(#{actor.name}) for skill #{self.name} returned nil, type #{name}" end
end
class Window_Base < Window
def draw_actor_mp(actor, x, y, width = 120) # OVERWRITE width = width/actor.ampx.size offset = width if actor.ampx.size != 1 offset += 1 width -= 1 end for i in 0...actor.ampx.size draw_actor_ampx(actor.ampx[i], x+i*offset,y,width) end end
def draw_actor_ampx(resource, x, y, width = 120) draw_actor_ampx_gauge(resource, x, y, width) self.contents.font.color = system_color self.contents.draw_text(x, y, 30, WLH, resource.abbv) self.contents.font.color = text_color(resource.color1) last_font_size = self.contents.font.size xr = x + width if width < 120 self.contents.draw_text(xr - 44, y, 44, WLH, resource.value, 2) else self.contents.draw_text(xr - 99, y, 44, WLH, resource.value, 2) self.contents.font.color = normal_color self.contents.draw_text(xr - 55, y, 11, WLH, "/", 2) self.contents.font.color = text_color(resource.color1) self.contents.draw_text(xr - 44, y, 44, WLH, resource.max, 2) end end
def display_mp_damage(target, obj = nil) #OVERWRITE return if target.dead? return if target.mp_damage == 0 type = obj.regresource.name if target.absorbed fmt = target.actor? ? Vocab::ActorDrain : Vocab::EnemyDrain text = sprintf(fmt, target.name, type, target.mp_damage) elsif target.mp_damage > 0 fmt = target.actor? ? Vocab::ActorLoss : Vocab::EnemyLoss text = sprintf(fmt, target.name, type, target.mp_damage) else fmt = target.actor? ? Vocab::ActorRecovery : Vocab::EnemyRecovery text = sprintf(fmt, target.name, type, -target.mp_damage) Sound.play_recovery end @message_window.add_instant_text(text) wait(30) end
def execute_action_skill #OVERWRITE skill = @active_battler.action.skill text = @active_battler.name + skill.message1 resource = skill.resourceof(@active_battler) @message_window.add_instant_text(text) unless skill.message2.empty? wait(10) @message_window.add_instant_text(skill.message2) end targets = @active_battler.action.make_targets display_animation(targets, skill.animation_id) if resource.tags.include?(:invert) resource.value += @active_battler.calc_mp_cost(skill) else resource.value -= @active_battler.calc_mp_cost(skill) end $game_temp.common_event_id = skill.common_event_id for target in targets target.skill_effect(@active_battler, skill) display_action_effects(target, skill) end end
alias old_battle_end battle_end unless $@ def battle_end(result) old_battle_end(result) refresh_zsr end
alias res_turn_end turn_end unless $@ def turn_end(actor = nil) if actor.nil? res_turn_end for actor in $game_party.members regen_ampx(actor) end else res_turn_end(actor) regen_ampx(actor) end end
end
It's more commonly found, and I managed to isolate the offending line of script easier. The issue with this one is that it completely re-writes the MP draw function. This isn't a major issue, but as I wanted the original MP to rise with successive physical attacks (I fiddled with the "Vampire Attack" script until I was able to get it to increase MP upon Physical attack), it would be nice if the other one could be made to work with Reedo's animation function instead:
Code
CODE
module OZ004 #------------------------------------------------------------------------------- # # Dual mp script # by Julian Villaruz (omegazion) # # this script allows you to have 2 sets of mp, one of which recovers after battle # and the other one that recovers after rest. # # for my purposes i named the one that recovers after battle "sp" and the one # that recovers after rest is the original "mp" but you can change that. # # Instructions: # 1. put this script above main # 2. change the terms and sp bar color to what you want # Terms: SP = "SP" SP_a = "S" # sp abbreviated # color of the sp bar SpBarLeft = [ 220, 210, 10, 255 ] # [red, blue, green, opacity] SpBarRight = [ 100, 100, 2, 255] # 3. Ignore these 2 lines class MaxSp def self.initiate_max_sp # 4. set up each actors max sp # To set up an actors max sp type this: # # set_maxsp_growth(actor id, base, growth per lvl) #------------------------------------------------------------------------------- # Exactly below this line: (all are lower case!)(have as many as you want) set_maxsp_growth(1, 90, 10) set_maxsp_growth(2, 80, 20) set_maxsp_growth(3, 95, 15)
#------------------------------------------------------------------------------- # 5. to increase an actors max sp in an event, type this in the script section: # "$data_actors[actor_id].inc_maxsp(val)" # (without the double quotes) where actor_id is an integer representing actor id # and val is the value maxsp would increase. (can be negative) # 6. to designate a skill to use sp instead of mp type: # "<SS>" # (without the double quotes) in the skills note box # 7. to designate a skill to use BOTH sp and mp type: # "<mp&sp[val]>" # (without the double quotes) in the skills note box # where val is an integer equal to the sp consumed # (the mp consumed is the one on the database) # NOTE: make sure you dont type <SS> on skills with <mp&sp[val]> ! # 8. to make an item recover sp type this in the item's note box: # "<sp rec[val]>" # (without the double quotes) # where val is an integer equal to the amount recovered (can be negative) # make sure you set all these types of items like this to for battle only. # 9. you can also set a skill to damage sp! (or heal with negative damage) # to do that type in the skill notes box: # "<damage to sp>" # (without the double quotes) damage to mp must NOT be checked # once you set a skill to damage sp it doesnt damage hp anymore # 10. if you want (and if you can) you could edit the window display # they are exactly below the end lines # 11. Credit me in your work! end end end
# this is the window display in battle # the draw_actor_sp is modeled from original draw_actor_mp class Window_BattleStatus < Window_Selectable def draw_item(index) rect = item_rect(index) rect.x += 4 rect.width -= 8 self.contents.clear_rect(rect) self.contents.font.color = normal_color actor = $game_party.members[index] draw_actor_name(actor, 4, rect.y) draw_actor_state(actor, 114, rect.y, 48) draw_actor_hp(actor, 167, rect.y, 67) draw_actor_mp(actor, 240, rect.y, 67) draw_actor_sp(actor, 313, rect.y, 67) end end # this is the window display in the menu class Window_MenuStatus < Window_Selectable def refresh self.contents.clear @item_max = $game_party.members.size for actor in $game_party.members draw_actor_face(actor, 2, actor.index * 96 + 2, 92) x = 104 y = actor.index * 96 + WLH / 2 draw_actor_name(actor, x, y) draw_actor_class(actor, x + 120, y) draw_actor_level(actor, x, y + WLH * 1) draw_actor_state(actor, x, y + WLH * 2) draw_actor_hp(actor, x + 120, y + WLH/6 * 5) draw_actor_mp(actor, x + 120, y + WLH/6 * 10) draw_actor_sp(actor, x + 120, y + WLH/6 * 15) end end end
# this is the window display in status class Window_Status < Window_Base def draw_basic_info(x, y) draw_actor_level(@actor, x, y + WLH * 0) draw_actor_state(@actor, x, y + WLH * 1) draw_actor_hp(@actor, x, y + WLH * 2) draw_actor_mp(@actor, x, y + WLH * 3) draw_actor_sp(@actor, x, y + WLH * 4) end end
class Window_Base < Window def draw_actor_sp_gauge(actor, x, y, width = 120) gw = width * actor.sp / [actor.maxsp, 1].max gc1 = Color.new(OZ004::SpBarLeft[0],OZ004::SpBarLeft[1],OZ004::SpBarLeft[2],OZ004::SpBarLeft[3]) gc2 = Color.new(OZ004::SpBarRight[0],OZ004::SpBarRight[1],OZ004::SpBarRight[2],OZ004::SpBarRight[3]) self.contents.fill_rect(x, y + WLH - 8, width, 6, gauge_back_color) self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2) end def draw_actor_sp(actor, x, y, width = 120) draw_actor_sp_gauge(actor, x, y, width) self.contents.font.color = system_color self.contents.draw_text(x, y, 30, WLH, OZ004::SP_a) self.contents.font.color = sp_color(actor) last_font_size = self.contents.font.size xr = x + width if width < 120 self.contents.draw_text(xr - 44, y, 44, WLH, actor.sp, 2) else self.contents.draw_text(xr - 99, y, 44, WLH, actor.sp, 2) self.contents.font.color = normal_color self.contents.draw_text(xr - 55, y, 11, WLH, "/", 2) self.contents.draw_text(xr - 44, y, 44, WLH, actor.maxsp, 2) end end def sp_color(actor) return crisis_color if actor.sp < actor.maxsp / 4 return normal_color end end
class Window_Skill < Window_Selectable def draw_item(index) rect = item_rect(index) self.contents.clear_rect(rect) skill = @data[index] if skill != nil rect.width -= 4 enabled = @actor.skill_can_use?(skill) draw_item_name(skill, rect.x, rect.y, enabled) mp_cost = @actor.calc_mp_cost(skill) if skill.special_skill? self.contents.draw_text(rect, mp_cost.to_s + OZ004::SP_a, 2) elsif skill.uses_both? sp_cost = skill.sp_used self.contents.draw_text(rect, mp_cost.to_s + Vocab.mp_a + '/' + sp_cost.to_s + OZ004::SP_a, 2) else self.contents.draw_text(rect, mp_cost.to_s + Vocab.mp_a, 2) end end end end
module OZ004 class MaxSp def self.set_maxsp_growth(actor_index, base, growth) actor = $data_actors[actor_index] actor.maxsp_base = base actor.maxsp_growth = growth end end end
module RPG class Actor def maxsp(level) base = @maxsp_base != nil ? @maxsp_base : 0 growth = @maxsp_growth != nil ? @maxsp_growth : 0 maxsp = base + growth*level return maxsp end def inc_maxsp(num) index = self.id @maxsp_base += num actor = $game_actors[index] actor.sp = maxsp(actor.level) end attr_writer :maxsp_base attr_writer :maxsp_growth end class Skill < UsableItem def special_skill? s = self.note.downcase return true if s.include?("<ss>") return false end def uses_both? s = self.note.downcase return true if s.include?("<mp&sp[") and s.include?("]>") return false end def sp_used str = self.note.downcase sp = "0" str.scan(/\<mp\&sp\[([0-9]+)\]/){|s| sp = s[0]} return sp.to_i end def damage_to_sp str = self.note.downcase return true if str.include?("<damage to sp>") return false end end class Item < UsableItem def sp_recover str = self.note.downcase sp_recover = "0" sp_damage = "0" str.scan(/\<sp\srec\[([0-9]+)\]/){|s| sp_recover = s[0]} str.scan(/\<sp\srec\[(\-[0-9]+)\]/){|s| sp_damage = s[0]} sp = sp_recover.to_i + sp_damage.to_i return sp end end end #------------------------------------------------------------------------------- class Scene_Title < Scene_Base alias oz_start start def start oz_start set_up_sp end def set_up_sp OZ004::MaxSp.initiate_max_sp end end #------------------------------------------------------------------------------- class Scene_Battle < Scene_Base alias oz_battle_end battle_end alias oz_display_hp_damage display_hp_damage def execute_action_skill skill = @active_battler.action.skill text = @active_battler.name + skill.message1 @message_window.add_instant_text(text) unless skill.message2.empty? wait(10) @message_window.add_instant_text(skill.message2) end targets = @active_battler.action.make_targets display_animation(targets, skill.animation_id) if skill.special_skill? @active_battler.sp -= @active_battler.calc_mp_cost(skill) elsif skill.uses_both? @active_battler.mp -= @active_battler.calc_mp_cost(skill) @active_battler.sp -= skill.sp_used else @active_battler.mp -= @active_battler.calc_mp_cost(skill) end $game_temp.common_event_id = skill.common_event_id for target in targets target.skill_effect(@active_battler, skill) display_action_effects(target, skill) end end def display_damage(target, obj = nil) if target.missed display_miss(target, obj) elsif target.evaded display_evasion(target, obj) else display_hp_damage(target, obj) display_mp_damage(target, obj) display_sp_damage(target, obj) end end def display_hp_damage(target, obj = nil) if target.hp_damage == 0 return if obj.is_a?(RPG::Skill) and obj.damage_to_sp end oz_display_hp_damage(target, obj) end def display_sp_damage(target, obj = nil) return if target.dead? return if target.sp_damage == 0 return unless target.actor? if target.sp_damage > 0 # Damage fmt = Vocab::ActorLoss text = sprintf(fmt, target.name, OZ004::SP, target.sp_damage) else # Recovery fmt = Vocab::ActorRecovery text = sprintf(fmt, target.name, OZ004::SP, -target.sp_damage) Sound.play_recovery end @message_window.add_instant_text(text) wait(30) end def battle_end(result) oz_battle_end(result) for actor in $game_party.members actor.sp = actor.maxsp end end end #------------------------------------------------------------------------------- class Game_Battler alias oz_initialize initialize alias oz_clear_action_results clear_action_results alias oz_clear_extra_values clear_extra_values alias oz_recover_all recover_all alias oz_make_obj_damage_value make_obj_damage_value alias oz_item_effect item_effect alias oz_execute_damage execute_damage attr_reader :sp attr_reader :sp_damage def initialize @sp = 0 oz_initialize end def skill_can_use?(skill) return false unless skill.is_a?(RPG::Skill) return false unless movable? return false if silent? and skill.spi_f > 0 if skill.special_skill? return false if calc_mp_cost(skill) > sp elsif skill.uses_both? return false if calc_mp_cost(skill) > mp or skill.sp_used > sp else return false if calc_mp_cost(skill) > mp end if $game_temp.in_battle return skill.battle_ok? else return skill.menu_ok? end end def clear_action_results oz_clear_action_results @sp_damage = 0 end def clear_extra_values oz_clear_extra_values @maxsp_plus = 0 end def maxsp return 0 if self.is_a?(Game_Enemy) return [[base_maxsp + @maxsp_plus, 0].max, 9999].min end def sp=(sp) @sp = [[sp, maxsp].min, 0].max end def recover_all oz_recover_all @sp = maxsp end def make_obj_damage_value(user, obj) oz_make_obj_damage_value(user, obj) damage = @hp_damage != 0 ? @hp_damage : @mp_damage @hp_damage = 0 @mp_damage = 0 if obj.damage_to_mp @mp_damage = damage elsif obj.is_a?(RPG::Skill) @sp_damage = damage if obj.damage_to_sp else @hp_damage = damage end end def item_effect(user, item) clear_action_results unless item_effective?(user, item) @skipped = true return end if rand(100) >= calc_hit(user, item) # determine hit ratio @missed = true return end if rand(100) < calc_eva(user, item) # determine evasion rate @evaded = true return end hp_recovery = calc_hp_recovery(user, item) # calc HP recovery amount mp_recovery = calc_mp_recovery(user, item) # calc MP recovery amount make_obj_damage_value(user, item) # damage calculation @hp_damage -= hp_recovery # subtract HP recovery amount @mp_damage -= mp_recovery # subtract MP recovery amount @sp_damage -= item.sp_recover # subtract SP recovery amount make_obj_absorb_effect(user, item) # calculate absorption effect execute_damage(user) # damage reflection item_growth_effect(user, item) # apply growth effect if item.physical_attack and @hp_damage == 0 # physical no damage? return end apply_state_changes(item) # state change end def execute_damage(user) oz_execute_damage(user) self.sp -= @sp_damage end end #------------------------------------------------------------------------------- class Game_Actor < Game_Battler def base_maxsp return actor.maxsp(@level) end end
This one is a bit wonkier. I wasn't able to decipher exactly where it interferes with the SBS' animation feature. This one has other problems, though. For whatever reason, it also makes all skills (and possibly items) deal no damage. I have no idea why this is. However, as it adds a resource bar without overwriting the original, I quite like it over the more complicated one. Of course, the first one does allow for a regen feature, but I can do without that. The latter script, if it is possible to patch it for use with Reedo's simple SBS, would be preferred. If the latter one is just not workable, than a patch for the first (which seems to my untrained eye to be easier) will be fine. Thank you for your time.
For your convenience, here's Reedo's Script:
Code
CODE
############################################################################### ## RSSBS - Reedo's Simple Side Battle System ## Version 1.0 ## January 7, 2010 ## By Reedo ############################################################################### ## SOURCE ## ## Source thread: ## ## ## Support thread: ## http://www.rpgmakervx.net/index.php?showtopic=24587 ############################################################################### ## REFERENCES ## ## None. This is an original script by Reedo. ## However other people have contributed ideas and bug finds. Please see the ## support thread link above for details. ############################################################################### ## DESCRIPTION ## ## This script provides a plug-and-play Side Battle System for the default ## battle system. This is purely an asthetic script, and as such, it only ## modifies the visuals of the battle. It does not modify battle mechanics ## when used by itself. ## ## This script will: ## 1) Draw the party on the right side of the screen, facing left, during batle. ## 2) Cause actors to perform their stepping animation when they are on the ## ground, and have no state restrictions applied. ## 3) Place a shadow under the actor. ## 4) Provide a target for animations, and optionally, animations themselves. ## 5) Line up actors in a staggerd row, top to bottom, with adjustable spacing, ## recessed according to the position value of their class. ## 6) Cause actors to step forward when performing an action. ## 7) Draw actors lying down, whitened, and semi-transparent when dead. ## 8) Cause living actors to do a victory dance at the end of battle. ## 9) Provide the option to horizontally flip enemy images by enemy ID. ## ## When used with the YERD or YEZ battle scripts, you then get even more ## animation options (such as casting animations) and popups for most battle ## event messages. This SBS and YEZ combine to form an amazing SBS experience! ## YEZ Script Link: http://www.pockethouse.com/yez/ ############################################################################### ## COMPATIBILITY ## ## Should be compatible with most other scripts. ## ## This script overwrites 1 method: Spriteset_Battle.update_actors ## All other methods are aliased, and those aliases are called. ## The one overwrite should not cause an issue as the only functionality it ## supresses is setting the party members to the current battle sprites. The ## rest of the original method is maintained, and this script handles the ## relationship between party members and battle sprites. ############################################################################### ## REQUIREMENTS ## ## None ############################################################################### ## INSTALLATION ## ## Plug-and-play. (and this time I mean it for reals!) ## ## Insert below Materials, above other Reedo scripts. ## All Reedo scripts should be below all YERD/YEZ scripts. ############################################################################### ## RIGHTS & RESTRICTIONS ## ## As with most Reedo scripts, this script is free to re-use, as-is, ## in personal, educational, and commercial RPGVX development projects, ## providing that: this script, as well as the rpgmakervx.net forum link ## from which it was obtained, are credited in writing displayed readily ## to the user of the final compiled code assembly. ## ## Reedo and rgpmakervx.net retain all rights of intellect and ownership. ## You forego all rights of warranty by utilizing this script. ############################################################################### ## USAGE ## ## Plug and play. Suggested to use YEZ Battle Engine Zealous, and Reedo's ## Tile-Based Battle Backgrounds scripts. ## ## Some visual options can be modified below. ###############################################################################
############################################################################### ## USER OPTIONS ############################################################################### module REEDO_SBS
# If desired, you can modify the default script options using the constants # below. In most cases though, you should not need to adjust these values.
############################################################################### ## This section controls the battle animations provided by this script ############################################################################### # This controls whether or not this script will provide animations during # battle. Set to 'true' when using this script without any other battle scene # enhancements. Set to 'false' when using battle scene enhancements such # as YEZ/YERD. Default is 'false'. SBS_ACTION_ANIMES = true
# If this script is providing animations, then you can specify which # animations to use a default. SBS_DEFAULT_ATTACK_ANIME = 19 # Skill and item animations will use the animation assigned to the skill or # item, if any. If none is assigned, then the default will be used. Specify # a value of 0 if you do not want a default animation. These values have no # effect if SBS_ACTION_ANIMES is set to 'false'. SBS_DEFAULT_SKILL_ANIME = 1 SBS_DEFAULT_ITEM_ANIME = 1
############################################################################### ## This section adjusts the actors positions on screen ############################################################################### ACTOR_START_LINE = 432 # The left-most position of the first actor ACTOR_START_TOP = 80 # The top-most position of the first actor ACTOR_STAGGER_HORZ = 8 # The amount to recess each actor to the right ACTOR_STAGGER_VERT = 16 # The vertical spacing between characters ACTOR_CLASS_POS_STAGGER = 16 # The extra distance to the right for class position ACTOR_STEP_IN_DISTANCE = 64 # The distance an actor steps in during an action ACTOR_STEP_IN_RATE = 8 # The rate at which the actor covers the distance
############################################################################### ## This section controls when an actor displays their stepping animation ############################################################################### # If an actor has a state applied which has a restriction value listed in # the following array, the actor will not display their stepping animation # until the state is removed. NO_STEP_RESTRICTIONS = [4, 5] # Has the same effect as above, but halts the stepping animation based on # the state's ID, without regard to the state's restriction. NO_STEP_STATES = []
############################################################################### ## This section adjusts the appearance of an actor when dead ############################################################################### ACTOR_DEATH_OPACITY = 175 # The tranparency of dead actors ACTOR_DEATH_ANGLE = 270 # The angle to rotate the body ACTOR_DEATH_TONE = [128, 128, 128, 0] # A color tone to apply to the image ACTOR_DEATH_OFFSET_X = -8 # A horizontal offset to move the body by ACTOR_DEATH_OFFSET_Y = -8 # A vertical offset to move the body by
############################################################################### ## This section adjusts the actor's shadow ############################################################################### ACTOR_SHADOW_IMAGE = "Shadow" # The name of the system image to use ACTOR_SHADOW_CUSTOM_PICTURE = nil # The name of a resource picture to use instead; nil to use system image ACTOR_SHADOW_OFFSET_X = 0 # The horizontal offset to the actor's position ACTOR_SHADOW_OFFSET_Y = 8 # The vertical offset to the actor's position ACTOR_DEATH_SHADOW_OFFSET_X = 8 # Additional X offset added when dead ACTOR_DEATH_SHADOW_OFFSET_Y = 2 # Additional Y offset added when dead
############################################################################### ## This section adjusts the victory dance ############################################################################### VICTORY_DANCE_JUMP_HEIGHT = 16 # The height of the jump VICTORY_DANCE_JUMP_INCREMENT = 2 # The rate of jump movement VICTORY_DANCE_JUMP_HOVER = 4 # The number of frames to wait in the air VICTORY_DANCE_JUMP_WAIT = 70 # The number of frames before jumping again VICTORY_DANCE_JUMP_TWIST = true # True to twirl when jumping; false to face forward
############################################################################### ## This section adjusts the battle floor location ############################################################################### BATTLE_FLOOR_TOP = 128 # Allows you to set the top of the battle floor
############################################################################### ## This section adjusts enemy images ############################################################################### # Specify the ID of enemies who should have their image flipped in battle FLIP_ENEMY = [ 2, 3, 4, 5, 8, 10, 12, 13, 14, 16, 17, 18, 19, 21, 22, 23, 25, 28, 29,
]
end ############################################################################### ## MAIN SCRIPT ############################################################################### ## EDITS BEYOND THIS POINT ARE AT YOUR OWN RISK!!! ############################################################################### class Game_Battler alias reedo_sbs_gb_add_state add_state def add_state(state_id) reedo_sbs_gb_add_state(state_id) if self.is_a?(Game_Actor) and $scene.is_a?(Scene_Battle) bs = $scene.reedo_get_battle_sprite(reedo_battle_sprite_id) return if bs == nil bs.reedo_bc_sprite.character.step_anime = reedo_check_step_anime reedo_update_life_state end end
alias reedo_sbs_gb_remove_state remove_state def remove_state(state_id) reedo_sbs_gb_remove_state(state_id) if self.is_a?(Game_Actor) and $scene.is_a?(Scene_Battle) bs = $scene.reedo_get_battle_sprite(reedo_battle_sprite_id) return if bs == nil bs.reedo_bc_sprite.character.step_anime = reedo_check_step_anime reedo_update_life_state end end
def reedo_check_step_anime return false if dead? for state in states return false if REEDO_SBS::NO_STEP_STATES.include?(state.id) return false if REEDO_SBS::NO_STEP_RESTRICTIONS.include?(state.restriction) end return true end
def reedo_update_life_state(battle_sprite = nil) if dead? if !@reedo_dead_set reedo_set_dead_state(battle_sprite) @reedo_dead_set = true end else if @reedo_dead_set reedo_set_live_state(battle_sprite) @reedo_dead_set = false end end end
def reedo_reset_dead_set @reedo_dead_set = false end
def reedo_set_dead_state(battle_sprite = nil) if battle_sprite == nil bs = $scene.reedo_get_battle_sprite(reedo_battle_sprite_id) else bs = battle_sprite end return if bs == nil return if bs.reedo_bc_sprite.is_dead bs.reedo_bc_sprite.angle = REEDO_SBS::ACTOR_DEATH_ANGLE tone = REEDO_SBS::ACTOR_DEATH_TONE bs.reedo_bc_sprite.tone.set(tone[0], tone[1], tone[2], tone[3]) bs.reedo_bc_sprite.character.opacity = REEDO_SBS::ACTOR_DEATH_OPACITY bs.reedo_bc_sprite.character.screen_x += REEDO_SBS::ACTOR_DEATH_OFFSET_X bs.reedo_bc_sprite.character.screen_y += REEDO_SBS::ACTOR_DEATH_OFFSET_Y bs.reedo_bc_sprite.shadow_sprite.x += REEDO_SBS::ACTOR_DEATH_SHADOW_OFFSET_X bs.reedo_bc_sprite.shadow_sprite.y += REEDO_SBS::ACTOR_DEATH_SHADOW_OFFSET_Y bs.reedo_bc_sprite.is_dead = true end
def reedo_set_live_state(battle_sprite = nil) if battle_sprite == nil bs = $scene.reedo_get_battle_sprite(reedo_battle_sprite_id) else bs = battle_sprite end return if bs == nil return if bs.reedo_bc_sprite.is_dead != true bs.reedo_bc_sprite.angle = 0 bs.reedo_bc_sprite.tone.set(0, 0, 0, 0) bs.reedo_bc_sprite.character.opacity = 255 bs.reedo_bc_sprite.character.screen_x -= REEDO_SBS::ACTOR_DEATH_OFFSET_X bs.reedo_bc_sprite.character.screen_y -= REEDO_SBS::ACTOR_DEATH_OFFSET_Y bs.reedo_bc_sprite.shadow_sprite.x -= REEDO_SBS::ACTOR_DEATH_SHADOW_OFFSET_X bs.reedo_bc_sprite.shadow_sprite.y -= REEDO_SBS::ACTOR_DEATH_SHADOW_OFFSET_Y bs.reedo_bc_sprite.is_dead = false end end
class Game_Actor attr_accessor :reedo_battle_sprite_id attr_accessor :screen_x attr_accessor :screen_y end
class Game_Actors def members return @data end end
class Game_Troop def troop_id return @troop_id end end
class Game_Character alias reedo_sbs_gc_screen_x screen_x def screen_x if $scene.is_a?(Scene_Battle) return @battle_screen_x else return reedo_sbs_gc_screen_x end end
alias reedo_sbs_gc_screen_y screen_y def screen_y if $scene.is_a?(Scene_Battle) return @battle_screen_y else return reedo_sbs_gc_screen_y end end
def opacity=(value) @opacity = value end def screen_x=(value) @battle_screen_x = value end def screen_y=(value) @battle_screen_y = value end def step_anime return @step_anime end def step_anime=(value) @step_anime = value end end
class Sprite_Base attr_accessor :reedo_victory_wait end
class Sprite_Character attr_accessor :shadow_sprite attr_accessor :is_dead
alias reedo_sbs_sc_dispose dispose def dispose @shadow_sprite.dispose if @shadow_sprite != nil reedo_sbs_sc_dispose end
alias reedo_sbs_sc_update update def update reedo_sbs_sc_update @shadow_sprite.update if @shadow_sprite != nil end end
class Sprite_Battler attr_accessor :reedo_bc_sprite
alias reedo_sbs_sb_dispose dispose def dispose @reedo_bc_sprite.dispose if @reedo_bc_sprite != nil reedo_sbs_sb_dispose end
alias reedo_sbs_sb_update update def update reedo_sbs_sb_update @reedo_bc_sprite.update if @reedo_bc_sprite != nil end end
class Spriteset_Battle alias reedo_sbs_ssb_create_battlefloor create_battlefloor def create_battlefloor reedo_sbs_ssb_create_battlefloor @battlefloor_sprite.y = REEDO_SBS::BATTLE_FLOOR_TOP end
alias reedo_sbs_ssb_create_actors create_actors def create_actors if @actor_sprites != nil dispose_actors end reedo_sbs_ssb_create_actors @reedo_start_points = {} @actor_sprites = [] i = 1 for actor in $game_party.members actor.reedo_battle_sprite_id = i - 1 gc = Game_Character.new gc.set_graphic(actor.character_name, actor.character_index) gc.set_direction(4) gc.screen_x = 0; gc.screen_y = 0 bc = Sprite_Character.new(@viewport1, gc) gc.screen_x = REEDO_SBS::ACTOR_START_LINE + ($data_classes[actor.class_id].position * REEDO_SBS::ACTOR_CLASS_POS_STAGGER) + ((i - 1) * REEDO_SBS::ACTOR_STAGGER_HORZ) gc.screen_y = REEDO_SBS::ACTOR_START_TOP + ((bc.height * i) + (REEDO_SBS::ACTOR_STAGGER_VERT * i)) actor.screen_x = gc.screen_x; actor.screen_y = gc.screen_y sb = Sprite_Battler.new(@viewport1, actor) sb.reedo_victory_wait = REEDO_SBS::VICTORY_DANCE_JUMP_HOVER sb.reedo_bc_sprite = bc gc.step_anime = actor.reedo_check_step_anime @reedo_start_points[sb] = [gc.screen_x, gc.screen_y] @actor_sprites.push(sb) bc.update bc.create_shadow_sprite actor.reedo_reset_dead_set actor.reedo_update_life_state(sb) i += 1 end end
alias reedo_sbs_ssb_create_enemies create_enemies def create_enemies reedo_sbs_ssb_create_enemies for sprite in @enemy_sprites if REEDO_SBS::FLIP_ENEMY.include?(sprite.battler.enemy_id) sprite.mirror = true end end end
def update_actors if $scene.is_a?(Scene_Battle) if $scene.victory_dance_time reedo_update_victory_dance end end for sprite in @actor_sprites sprite.reedo_bc_sprite.character.update sprite.update end end
def reedo_get_battle_sprite(sprite_id) return nil if !sprite_id.is_a?(Fixnum) return nil if sprite_id < 0 return nil if sprite_id >= @actor_sprites.length return @actor_sprites[sprite_id] end
def reedo_update_victory_dance if @victory_delta == nil @victory_delta = -REEDO_SBS::VICTORY_DANCE_JUMP_INCREMENT for sp in @actor_sprites sp.reedo_bc_sprite.character.step_anime = false end end for sp in @actor_sprites next if sp.battler.reedo_check_step_anime == false stpt = @reedo_start_points[sp] if sp.reedo_bc_sprite.character.screen_y < stpt[1] - REEDO_SBS::VICTORY_DANCE_JUMP_HEIGHT if sp.reedo_victory_wait <= 0 @victory_delta = REEDO_SBS::VICTORY_DANCE_JUMP_INCREMENT sp.reedo_victory_wait = REEDO_SBS::VICTORY_DANCE_JUMP_WAIT else @victory_delta = 0 sp.reedo_victory_wait -= 1 end end if sp.reedo_bc_sprite.character.screen_y > stpt[1] if sp.reedo_victory_wait <= 0 @victory_delta = -REEDO_SBS::VICTORY_DANCE_JUMP_INCREMENT sp.reedo_victory_wait = REEDO_SBS::VICTORY_DANCE_JUMP_HOVER sp.reedo_bc_sprite.character.step_anime = false else @victory_delta = 0 sp.reedo_victory_wait -= 1 sp.reedo_bc_sprite.character.step_anime = true if !sp.reedo_bc_sprite.character.step_anime end end if REEDO_SBS::VICTORY_DANCE_JUMP_TWIST if sp.reedo_bc_sprite.character.screen_y <= stpt[1] if (sp.reedo_bc_sprite.character.screen_y - stpt[1]) % (REEDO_SBS::VICTORY_DANCE_JUMP_HEIGHT / 4) == 0 case sp.reedo_bc_sprite.character.direction when 4; sp.reedo_bc_sprite.character.set_direction(2) when 2; sp.reedo_bc_sprite.character.set_direction(6) when 6; sp.reedo_bc_sprite.character.set_direction(8) when 8; sp.reedo_bc_sprite.character.set_direction(4) end end else sp.reedo_bc_sprite.character.set_direction(4) if sp.reedo_bc_sprite.character.direction != 4 end end sp.reedo_bc_sprite.character.screen_y += @victory_delta sp.battler.screen_y += @victory_delta end end end
class Scene_Battle attr_reader :victory_dance_time
alias reedo_sbs_sb_start start def start reedo_sbs_sb_start @current_party = $game_party.members end
alias reedo_sbs_sb_terminate terminate def terminate reedo_teardown_actors reedo_sbs_sb_terminate end
alias reedo_sbs_sb_update update def update if @current_party != $game_party.members @spriteset.create_actors @current_party = $game_party.members end reedo_sbs_sb_update end
alias reedo_sbs_sb_execute_action_attack execute_action_attack def execute_action_attack reedo_do_execute_action("attack") end
alias reedo_sbs_sb_execute_action_skill execute_action_skill def execute_action_skill reedo_do_execute_action("skill") end
alias reedo_sbs_sb_execute_action_item execute_action_item def execute_action_item reedo_do_execute_action("item") end
alias reedo_sbs_sb_process_victory process_victory def process_victory @victory_dance_time = true reedo_sbs_sb_process_victory end
def reedo_get_battle_sprite(sprite_id) return @spriteset.reedo_get_battle_sprite(sprite_id) end
def reedo_teardown_actors for actor in $game_actors.members actor.reedo_battle_sprite_id = nil if actor != nil end end
def reedo_do_execute_action(action_method) targets = @active_battler.action.make_targets if @active_battler.is_a?(Game_Actor) reedo_actor_step_in if REEDO_SBS::SBS_ACTION_ANIMES targets.each do |t| if t.is_a?(Game_Actor) bs = reedo_get_battle_sprite(t.reedo_battle_sprite_id) bs.reedo_bc_sprite.character.animation_id = eval("reedo_get_" + action_method + "_animation") if bs != nil end end end eval("reedo_sbs_sb_execute_action_" + action_method) reedo_actor_step_back else if REEDO_SBS::SBS_ACTION_ANIMES targets.each do |t| if t.is_a?(Game_Actor) bs = reedo_get_battle_sprite(t.reedo_battle_sprite_id) bs.reedo_bc_sprite.character.animation_id = eval("reedo_get_" + action_method + "_animation") if bs != nil end end end eval("reedo_sbs_sb_execute_action_" + action_method) end end
def reedo_get_attack_animation return REEDO_SBS::SBS_DEFAULT_ATTACK_ANIME end
def reedo_get_skill_animation skill = $data_skills[@active_battler.action.skill_id] aid = REEDO_SBS::SBS_DEFAULT_SKILL_ANIME aid = skill.animation_id if skill.animation_id > 0 return aid end
def reedo_get_item_animation item = $data_items[@active_battler.action.item_id] aid = REEDO_SBS::SBS_DEFAULT_ITEM_ANIME aid = item.animation_id if item.animation_id > 0 return aid end
def reedo_actor_step_in delta = 0 dr = REEDO_SBS::ACTOR_STEP_IN_RATE while delta < REEDO_SBS::ACTOR_STEP_IN_DISTANCE bs = reedo_get_battle_sprite(@active_battler.reedo_battle_sprite_id) return if bs == nil bs.reedo_bc_sprite.shadow_sprite.x -= dr bs.reedo_bc_sprite.character.screen_x -= dr bs.battler.screen_x -= dr Graphics.update @spriteset.update delta += dr end end
def reedo_actor_step_back delta = 0 dr = REEDO_SBS::ACTOR_STEP_IN_RATE while delta < REEDO_SBS::ACTOR_STEP_IN_DISTANCE bs = reedo_get_battle_sprite(@active_battler.reedo_battle_sprite_id) return if bs == nil bs.reedo_bc_sprite.shadow_sprite.x += dr bs.reedo_bc_sprite.character.screen_x += dr bs.battler.screen_x += dr Graphics.update @spriteset.update delta += dr end end end
Group: Member
Posts: 2
Type: None
RM Skill: Beginner
Bump. If there is simply nothing that can be done, then I guess I'll have to look for another option. It's not like my battle system hinges on this, but it would help make things neater.