Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Enemy HP == Party Member 002 HP?

Star

Sponsor

Is it possible to make a party members HP take the same amount of damage when damage is inflicted on an Enemy?

I would be grateful if someone could think of a way to do this in events :angel: or maybe a script
 

Star

Sponsor

Justin Lee":2cfjecjs said:
Which engine? I do not really understand your question
Oh sorry. It's for Rpg maker XP.

Okay. How about an example. Let say I use an attack. And I hit the enemy at 56 Damage Points.

I want to decrease my Ally's HP by 56's points.

Or if the Damage was 105 or any other number. I want to decrease my Ally's HP by that
 
Hmmm... you could do it with a common event by generating a number (a multiple of a stat, a random number, whatever), and then Inflicting Damage both on Enemy (Last Targeted) and Player 2, couldn't you?

I'm assuming here that the characters are in fixed positions in the party, BTW-- it's a very useful thing to do, sometimes.
 

Star

Sponsor

Souloux":9ke3vvep said:
So you want an attack that does damage to the enemy and self-inflicted damage?
Not exactly what I'm trying to accomplish. You see.. I'm using an abs. But one of the enemies on the field is my ally. I need to set the damage he takes to the allies health. So I can have a working four person hud. A random number might work. I'll look into this. I am welcome to any other ideas.

Also. It's not a script question, just incase anyone was wondering
 
Ah, the phrase "I'm using an ABS" really should have appeared in your first post.

Ideally, with the actual ABS that you are using.

Because, well, that has a HUGE IMPACT ON WHAT KIND OF SOLUTION COULD WORK.

The idea that I tossed out, for example, will not. Because it's an ABS.

And the actual solution to this problem might very well work differently in different systems.
 

Star

Sponsor

Unka Josh":2sji0sf1 said:
Ah, the phrase "I'm using an ABS" really should have appeared in your first post.

Ideally, with the actual ABS that you are using.

Because, well, that has a HUGE IMPACT ON WHAT KIND OF SOLUTION COULD WORK.

The idea that I tossed out, for example, will not. Because it's an ABS.

And the actual solution to this problem might very well work differently in different systems.
Okay okay. I just didn't want any mod or whatnot to toss my question aside saying it was a scripting question. It's for XAS Abs. viewtopic.php?f=11&t=36855 Initially you can't have Party Members in this ABS. Which is why I use enemies to act like allies instead. And I use pathfinding to make them attack other enemies and enemies to attack them. There's just no possible way I could think of to match an allies health with an enemy
 
Code:
# Recoil Weapons & Skills

# By SephirothSpawn

 

module Recoil

  # weapon/skill_id => percent/direct damage

  Weapon_Percent = {}

  Skill_Percent = {}

  Weapon_Direct = {}

  Skill_Direct = {}

end

 

class RPG::Weapon

  def recoil_percent

    if Recoil::Weapon_Percent.has_key?(@id)

      return Recoil::Weapon_Percent[@id]

    end

    return 0

  end

  def recoil_direct

    if Recoil::Weapon_Direct.has_key?(@id)

      return Recoil::Weapon_Direct[@id]

    end

    return 0

  end

end

 

class RPG::Skill

  def recoil_percent

    if Recoil::Skill_Percent.has_key?(@id)

      return Recoil::Skill_Percent[@id]

    end

    return 0

  end

  def recoil_direct

    if Recoil::Skill_Direct.has_key?(@id)

      return Recoil::Skill_Direct[@id]

    end

    return 0

  end

end

 

class Game_Battler

  alias_method :seph_recoildamages_gmbtlr_ae, :attack_effect

  def attack_effect(attacker)

    result = seph_recoildamages_gmbtlr_ae(attacker)

    if result && attacker.is_a?(Game_Actor)

      weapon = attacker.weapon_id

      if weapon != nil

        damage = Integer(self.damage * (weapon.recoil_percent / 100.0))

        damage += weapon.recoil_direct

        if damage > 0

          attacker.damage = damage

          attacker.damage_pop = true

        end

      end

    end

    return result

  end

  alias_method :seph_recoildamage_gmbtlr_se, :skill_effect

  def skill_effect(skill, user)

    result = seph_recoildamages_gmbtlr_se(skill, user)

    if result

      damage = Integer(self.damage * (skill.recoil_percent / 100.0))

      damage += skill.recoil_direct

      if damage > 0

        attacker.damage = damage

        attacker.damage_pop = true

      end

    end

    return result

  end

end

Ok. This works for weapons and skills, percents and direct recoil.

Say weapon 1 does 10% damage back to the user, weapon 2 does 50% damage back to user. You would change:

Weapon_Percent = {}

to

Weapon_Percent = {1=>10, 2=>50}

The rest of the setup (Skill_Percent/Weapon_Direct/Skill_Direct) all work the same.

Let me know how that works.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top