ODD ISSUE AS A RESULT OF SCRIPTING (XP)
Posts
Pages:
1
Hi all.
I've recently been playing around with the Sacrifice HP script made by LockeZ along with a script that removes SP from the game.
The problem I'm having, and I can only guess that it's as a result of my adding these scripts to the game is that when a character's HP hits zero, they can now perform actions. If all player characters die you still get a game over, but until that happens death is fairly inconsequential! Kind of puts a damper on the experience!
The two scripts can be found below. They were made to work with one another. I'm just hoping someone with more experience than I could take a gander and see if there's anything present that could be the root of the problem.
I've recently been playing around with the Sacrifice HP script made by LockeZ along with a script that removes SP from the game.
The problem I'm having, and I can only guess that it's as a result of my adding these scripts to the game is that when a character's HP hits zero, they can now perform actions. If all player characters die you still get a game over, but until that happens death is fairly inconsequential! Kind of puts a damper on the experience!
The two scripts can be found below. They were made to work with one another. I'm just hoping someone with more experience than I could take a gander and see if there's anything present that could be the root of the problem.
module LockeZ
# Do not remove this line
HP_Sacrifice_Action = {'Skill' => {}, 'Item' => {}}
# Do not remove this line
# Below here are the lines you can change to control which actions
# cost HP, and how much.
# Format for each line:
# ---------------------
# HP_Sacrifice_Action =
# And here is what each of those things means:
# action_type = Should be set to 'Skill' or 'Item'
# id = ID number of the skill/item that costs HP
#
# chance = chance of damaging self
# formula = How the amount lost is calculated. Must be 'integer' or 'percent'.
# amount = Amount of HP lost, based on formula. If formula is set to
# integer, this is the actual amount lost. If it's set to percent,
# this is the percent lost.
# anim_id = ID of the animation shown over the user; leave nil or 0 for
# no animation
# pop = true or false, whether the sacrificed amount pops up visually
# over the user's head like damage.
# can_kill = true or false. If false the skill will not reduce the user below
# 1 HP. If true it can kill the user.
end
#==============================================================================
# ** Don't modify anything below this point.
#==============================================================================
#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================
class Scene_Battle
include LockeZ
#--------------------------------------------------------------------------
# These 2 methods makes the script compatible with the default battle system.
#--------------------------------------------------------------------------
alias make_skill_action_result_hp_sacrifice make_skill_action_result
def make_skill_action_result
make_skill_action_result_hp_sacrifice
action = @active_battler.current_action
if action != nil and HP_Sacrifice_Action.include?(action.skill_id)
sacrifice_hp(@active_battler, HP_Sacrifice_Action.dup)
end
end
alias make_item_action_result_hp_sacrifice make_item_action_result
def make_item_action_result
make_item_action_result_hp_sacrifice
action = @active_battler.current_action
if action != nil and HP_Sacrifice_Action.include?(action.item_id)
sacrifice_hp(@active_battler, HP_Sacrifice_Action.dup)
end
end
#--------------------------------------------------------------------------
# This method makes the script compatible with Atoa's Custom Battle System.
#--------------------------------------------------------------------------
if respond_to?('step4_part3')
alias step4_part3_hp_sacrifice step4_part3
end
def step4_part3(battler)
step4_part3_hp_sacrifice(battler)
action = battler.now_action
if action != nil and HP_Sacrifice_Action != nil and
HP_Sacrifice_Action.include?(action_id(action))
sacrifice_hp(battler, HP_Sacrifice_Action.dup)
end
end
#--------------------------------------------------------------------------
# Sacrifice HP
# battler : active battler
# action : action
#--------------------------------------------------------------------------
def sacrifice_hp(battler, action)
if action >= rand(100)
if action == 'integer'
hp_sacrificed = action.to_i
elsif action == 'percent'
hp_sacrificed = (battler.maxhp * action / 100).to_i
end
if action == false
hp_sacrificed = .min
end
if hp_sacrificed != 0
if !respond_to?('step4_part3_hp_sacrifice')
# This line happens only in the DBS
# Atoa's CBS does this automatically for all damage
battler.hp -= hp_sacrificed
end
battler.damage = hp_sacrificed
battler.animation_id = action.nil? ? 0 : action
battler.damage_pop = action
@status_window.refresh
end
end
end
end
# Do not remove this line
HP_Sacrifice_Action = {'Skill' => {}, 'Item' => {}}
# Do not remove this line
# Below here are the lines you can change to control which actions
# cost HP, and how much.
# Format for each line:
# ---------------------
# HP_Sacrifice_Action =
# And here is what each of those things means:
# action_type = Should be set to 'Skill' or 'Item'
# id = ID number of the skill/item that costs HP
#
# chance = chance of damaging self
# formula = How the amount lost is calculated. Must be 'integer' or 'percent'.
# amount = Amount of HP lost, based on formula. If formula is set to
# integer, this is the actual amount lost. If it's set to percent,
# this is the percent lost.
# anim_id = ID of the animation shown over the user; leave nil or 0 for
# no animation
# pop = true or false, whether the sacrificed amount pops up visually
# over the user's head like damage.
# can_kill = true or false. If false the skill will not reduce the user below
# 1 HP. If true it can kill the user.
end
#==============================================================================
# ** Don't modify anything below this point.
#==============================================================================
#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================
class Scene_Battle
include LockeZ
#--------------------------------------------------------------------------
# These 2 methods makes the script compatible with the default battle system.
#--------------------------------------------------------------------------
alias make_skill_action_result_hp_sacrifice make_skill_action_result
def make_skill_action_result
make_skill_action_result_hp_sacrifice
action = @active_battler.current_action
if action != nil and HP_Sacrifice_Action.include?(action.skill_id)
sacrifice_hp(@active_battler, HP_Sacrifice_Action.dup)
end
end
alias make_item_action_result_hp_sacrifice make_item_action_result
def make_item_action_result
make_item_action_result_hp_sacrifice
action = @active_battler.current_action
if action != nil and HP_Sacrifice_Action.include?(action.item_id)
sacrifice_hp(@active_battler, HP_Sacrifice_Action.dup)
end
end
#--------------------------------------------------------------------------
# This method makes the script compatible with Atoa's Custom Battle System.
#--------------------------------------------------------------------------
if respond_to?('step4_part3')
alias step4_part3_hp_sacrifice step4_part3
end
def step4_part3(battler)
step4_part3_hp_sacrifice(battler)
action = battler.now_action
if action != nil and HP_Sacrifice_Action != nil and
HP_Sacrifice_Action.include?(action_id(action))
sacrifice_hp(battler, HP_Sacrifice_Action.dup)
end
end
#--------------------------------------------------------------------------
# Sacrifice HP
# battler : active battler
# action : action
#--------------------------------------------------------------------------
def sacrifice_hp(battler, action)
if action >= rand(100)
if action == 'integer'
hp_sacrificed = action.to_i
elsif action == 'percent'
hp_sacrificed = (battler.maxhp * action / 100).to_i
end
if action == false
hp_sacrificed = .min
end
if hp_sacrificed != 0
if !respond_to?('step4_part3_hp_sacrifice')
# This line happens only in the DBS
# Atoa's CBS does this automatically for all damage
battler.hp -= hp_sacrificed
end
battler.damage = hp_sacrificed
battler.animation_id = action.nil? ? 0 : action
battler.damage_pop = action
@status_window.refresh
end
end
end
end
class Window_Base < Window
def draw_actor_sp(actor, x, y, width = 144)
return
end
end
class Window_Skill < Window_Selectable
def draw_item(index)
skill = @data
if @actor.skill_can_use?(skill.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(skill.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
self.contents.draw_text(x + 232, y, 48, 32, (LockeZ::HP_Sacrifice_Action?LockeZ::HP_Sacrifice_Action:0).to_s, 2)
end
end
def draw_actor_sp(actor, x, y, width = 144)
return
end
end
class Window_Skill < Window_Selectable
def draw_item(index)
skill = @data
if @actor.skill_can_use?(skill.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(skill.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
self.contents.draw_text(x + 232, y, 48, 32, (LockeZ::HP_Sacrifice_Action?LockeZ::HP_Sacrifice_Action:0).to_s, 2)
end
end
LockeZ
I'd really like to get rid of LockeZ. His play style is way too unpredictable. He's always like this too. If he ran a country, he'd just kill and imprison people at random until crime stopped.
5958
I'm trying to resolve this. No one else really needs to respond.
Can you please mail me your script as you actually have it set up in your project? Thanks. I need to see what you set for the skills and such.
Can you please mail me your script as you actually have it set up in your project? Thanks. I need to see what you set for the skills and such.
Pages:
1













