Enemy HP error

Qeo

Veteran
Veteran
Joined
Jan 12, 2014
Messages
112
Reaction score
24
Primarily Uses
The enemies HP are drastically lower than they should be in battle. This only happens with this script, but I still want to keep the script. How should I edit it so that this glitch doesn't occur?

#==============================================================================
# ** Game_Battler
#------------------------------------------------------------------------------
# This class deals with battlers. It's used as a superclass for the Game_Actor
# and Game_Enemy classes.
#==============================================================================

class Game_Battler
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias timed_hit_attack_effect attack_effect
alias timed_hit_skill_effect skill_effect
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :timed_hit_hit_percent
attr_accessor :timed_hit_use_percent
attr_accessor :timed_hit_state_to_add
#--------------------------------------------------------------------------
# * Applying Normal Attack Effects
# attacker : battler
#--------------------------------------------------------------------------
def attack_effect(attacker)
effective = false
# If part of Timed Hits
if @timed_hit_use_percent
hp = self.hp
# Perform the original call and get effective
effective = timed_hit_attack_effect(attacker)
if self.damage != "Miss"
self.hp = hp
self.damage = Integer((@timed_hit_hit_percent * self.damage) / 100.0)
self.hp -= Integer(self.damage)
if @timed_hit_state_to_add != nil
self.add_state(@timed_hit_state_to_add)
end
end
# If not part of Timed Hits
else
# Perform the original call and get effective
effective = timed_hit_attack_effect(attacker)
end
@timed_hit_use_percent = false
@timed_hit_state_to_add = nil
return effective
end
#--------------------------------------------------------------------------
# * Apply Skill Effects
# user : the one using skills (battler)
# skill : skill
#--------------------------------------------------------------------------
def skill_effect(user, skill)
effective = false
# If part of Timed Hits
if @timed_hit_use_percent
hp = self.hp
# Perform the original call and get effective
effective = timed_hit_skill_effect(user, skill)
if self.damage != "Miss"
self.hp = hp
self.damage = Integer((@timed_hit_hit_percent * self.damage) / 100.0)
self.hp -= Integer(self.damage)
end
# If not part of Timed Hits
else
# Perform the original call and get effective
effective = timed_hit_skill_effect(user, skill)
end
@timed_hit_use_percent = false
return effective
end
end



#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
# This class handles the actor. It's used within the Game_Actors class
# ($game_actors) and refers to the Game_Party class ($game_party).
#==============================================================================

class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :actor_id
end
 

mathmaster74

just...John
Veteran
Joined
Jun 12, 2016
Messages
285
Reaction score
193
First Language
English
Primarily Uses
RMMV
@Qeo You say it only happens with this script. What is the enemy HP without the script and how does that change when the script runs?
 

Qeo

Veteran
Veteran
Joined
Jan 12, 2014
Messages
112
Reaction score
24
Primarily Uses
@Qeo You say it only happens with this script. What is the enemy HP without the script and how does that change when the script runs?
Enemy HP without the script just works as you'd expect, an enemy with 10,000 HP has 10,000 HP. With it, an enemy with 10 thousand hp died at a little over 5000. So it seemed like enemies health were reduced by half, then I fight something with 80,000 health and it dies in less than 40,000.
 

mathmaster74

just...John
Veteran
Joined
Jun 12, 2016
Messages
285
Reaction score
193
First Language
English
Primarily Uses
RMMV
@Qeo It looks like the script is doing double duty. If an enemy is being dealt normal damage noted by the engine and then your script also subtracts the damage from the enemy, they will effectively have half hit points because they are taking damage twice, once from the source code and once again from your script. What happens if you just take out the self.hp -= Integer(self.damage) lines from the code?
 

Qeo

Veteran
Veteran
Joined
Jan 12, 2014
Messages
112
Reaction score
24
Primarily Uses
@Qeo It looks like the script is doing double duty. If an enemy is being dealt normal damage noted by the engine and then your script also subtracts the damage from the enemy, they will effectively have half hit points because they are taking damage twice, once from the source code and once again from your script. What happens if you just take out the self.hp -= Integer(self.damage) lines from the code?
This seems to have fixed the problem entirely. Thank you!
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!
one bad plugin combo later and one of my followers is moonwalking off the screen on his own... I didn't even more yet on the new map lol.

Forum statistics

Threads
106,034
Messages
1,018,447
Members
137,820
Latest member
georg09byron
Top