State that deals elemental DoT

Is it possible to make a state (like poison) to deal elemental damage?

Imagine two states: Bleeding and Poison. Both deal damage over time, but Poison, unlike Bleeding deals it as elemental, "poison" damage. Therefore, an enemy with poison damage resistance will take less damage from the Poison state but will not have damage reduced from the Bleeding state.

Is it possible to do something like that? Or maybe is there a script that allows to do so?
That guy was really funny, lol.

But as for your request, since by coincidence at this very time I have exactly the same problem in front of me, and that is creating damage of different element types, with different states (burning, poison, freezing, and so on), here is what I found at the moment:

1)The easiest solution:
it simply has everything you need. Like, it was made exactly for extending basic DOT options, but it's paid.

2)Not the easiest solution, but it's free:
YEP plugins provide an option to directly input javascript code. For example, the YEP BuffsStatesCore plugin lets you choose when you can run certain code (when the hero starts his turn, when he performs the action, when he finishes it, and so on).
That is, all you need to do is write the elemental damage formula using a javascript (I guess someone on this site can help you with this, but unfortunately not me), and then insert it into the notebox for your state. (And you'll need the YEP BuffsStatesCore plugin too).

Edit: Oh, sorry, I didn't check that it's for VX Ace, my bad.
That guy was really funny, lol.

But as for your request, since by coincidence at this very time I have exactly the same problem in front of me, and that is creating damage of different element types, with different states (burning, poison, freezing, and so on), here is what I found at the moment:

1)The easiest solution:
it simply has everything you need. Like, it was made exactly for extending basic DOT options, but it's paid.

2)Not the easiest solution, but it's free:
YEP plugins provide an option to directly input javascript code. For example, the YEP BuffsStatesCore plugin lets you choose when you can run certain code (when the hero starts his turn, when he performs the action, when he finishes it, and so on).
That is, all you need to do is write the elemental damage formula using a javascript (I guess someone on this site can help you with this, but unfortunately not me), and then insert it into the notebox for your state. (And you'll need the YEP BuffsStatesCore plugin too).

Edit: Oh, sorry, I didn't check that it's for VX Ace, my bad.
No problem 😀
At least you tried 😍
content disposed of

I've removed the off-topic posts from the thread, please do not bring it up again.


Let's focus on helping OP. 🙂
bump
reviving this, as I've returned to working on my project and i still kinda need this
Is it possible to make a state (like poison) to deal elemental damage?
Is this for battle only or battle and map damage?
Poison itself affects the HRG value which is what causes the damage.
Would this be for states that do not affect HRG or anything else like that, so then it would be it's own function?
For instance,
A state has a note tag that says <element: 3>
When the player is affected by that state it will cause additional damage but the damage is reduced for any element resistance.

That can be done as long as we don't modify the built in HRG functions because that is likely to cause issues with other scripts (if you use any for damage over time)
And I would rather do it that way.

Now if you were to put this on an existing state that modifies the HRG then the damage will apply normally for the HRG effect and then add on additional damage for the element damage.

Would that be ok with you?
Is this for battle only or battle and map damage?
Poison itself affects the HRG value which is what causes the damage.
Would this be for states that do not affect HRG or anything else like that, so then it would be it's own function?
For instance,
A state has a note tag that says <element: 3>
When the player is affected by that state it will cause additional damage but the damage is reduced for any element resistance.

That can be done as long as we don't modify the built in HRG functions because that is likely to cause issues with other scripts (if you use any for damage over time)
And I would rather do it that way.

Now if you were to put this on an existing state that modifies the HRG then the damage will apply normally for the HRG effect and then add on additional damage for the element damage.

Would that be ok with you?
1. only for battle
2. HRG is pretty wacky on its own since technically the way poison works in "vanilla" VXA is "negative regen" so making elemental DOT its own thing would be a good thing. also it would allow for using both mechanics at once, which in response becomes a win-win situation.
only for battle
I haven't tested this on the map, but I think it will work there as well.
My tests was using a state that was removed at battle end, so it would never happen on the map.

This works but it is not adding the resistances together, it is processing them one at a time.
So if the actor has 50% resistance to fire then when inflicted with a fire damage over time state, it will first check the actor features in the database, process the resistance and multiple that to the damage value. So if the damage was 100 and you were 50% resistant then the damage would be 50.
But then it processes the resistance values for the class and repeats the above steps.
50 * 50% = 25.
So the resistance is not added together to give you 100%.
If that's ok then this may work for you, also I have not included any armour resistances.
Did you need that? or do you want the resistances added together?

*Updated
Spoiler: Elemental State Damage
Ruby:
# ╔═════════════════════════════════════╦════════════════════╗
# ║ Title: States do elemental damage   ║  Version: 1.01     ║
# ║ Author: Roninator2                  ║                    ║
# ╠═════════════════════════════════════╬════════════════════╣
# ║ Function:                           ║   Date Created     ║
# ║                                     ╠════════════════════╣
# ║ Add elemental damage over time      ║    11 Sep 2023     ║
# ╚═════════════════════════════════════╩════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Instructions:                                            ║
# ║ Use <element damage: id, dam, pcnt> on state that will   ║
# ║ perform damage to the battler in battle.                 ║
# ║ The dam is the amount of damage that will be applied.    ║
# ║ The pcnt is use percentage? 1 / 0                        ║
# ║ 1 equals true                                            ║
# ║   will use dam as a percentage value for calculation     ║
# ║ 0 equals false                                           ║
# ║   will use dam as direct damage value                    ║
# ║                                                          ║
# ║ Example:                                                 ║
# ║ <element damage: 3, 15, 1> or <element_damage:3 15 1>    ║
# ║     element 3 (fire), 15 damage in percentage            ║
# ║             mhp * 15%                                    ║
# ║ <element damage: 3, 75, 0> or <element-damage: 3 75 0>   ║
# ║     element 3 (fire), 75 damage in flat value            ║
# ╚══════════════════════════════════════════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Terms of use:                                            ║
# ║ Free for all uses in RPG Maker except nudity             ║
# ╚══════════════════════════════════════════════════════════╝

module R2_Element_Battle_Damage
  Element_Rgx = /<element[ -_]damage: *(\d+),* *(\d+),* *(\d+)>/i
  Combine = true       # combine multipler or add them.
      # false will process each function separately
      # true will get total value before calculating
  Check_Actor = true   # checks for Database actor features
  Check_Class = true   # checks for Class features
  Check_Equip = true   # checks for Actor Equipment features
end
module DataManager
  class <<self
    alias :load_database_original_r2_state_element_damage :load_database
  end
  def self.load_database
    load_database_original_r2_state_element_damage
    load_r2_state_element_damage
  end
  def self.load_r2_state_element_damage
    for obj in $data_states
      next if obj.nil?
      obj.load_r2_state_element_damage
    end
  end
end

class RPG::State
  attr_accessor :damele
  attr_accessor :dameleamt
  attr_accessor :damelepcnt
 
  def load_r2_state_element_damage
    @damele = 0
    @dameleamt = 0
    @damelepcnt = false
    self.note.split(/[\r\n]+/).each { |line|
      case line
      when R2_Element_Battle_Damage::Element_Rgx
        @damele = $1.to_i
        @dameleamt = $2.to_i
        @damelepcnt = true if $3.to_i == 1
      end
    }
  end
end

class Game_Battler < Game_BattlerBase
  alias r2_regenerate_hp_and_element_damage   regenerate_hp
  def regenerate_hp
    r2_regenerate_hp_and_element_damage
    adjust_element_state if $game_party.in_battle
  end
  def adjust_element_state
    states.each do |st|
      if st.damele != (0 || nil)
        damage = st.dameleamt
        damage = (mhp * (st.dameleamt.to_f / 100)).to_i if st.damelepcnt == true
        damage = element_feature_resist(damage, st.damele)
        @result.hp_damage = [damage, max_slip_damage].min
        perform_map_damage_effect if $game_party.in_battle && damage > 0
        self.hp -= @result.hp_damage
      end
    end
  end
  def element_feature_resist(damage, ele)
    tmul = 0
    mul = 1
    dam = damage
    mod = 0
    if R2_Element_Battle_Damage::Check_Actor
      $data_actors[self.id].features.each do |ft|
        next if ft.nil?
        next if ft.code != 11
        next if ft.data_id != ele
        mod = ft.value - 1
        mul += mod
      end
      if R2_Element_Battle_Damage::Combine == true
        tmul += mod
      else
        dam = dam * mul
      end
    end
    mul = 1
    mod = 0
    if R2_Element_Battle_Damage::Check_Class
      $data_classes[self.class_id].features.each do |ft|
        next if ft.nil?
        next if ft.code != 11
        next if ft.data_id != ele
        mod = ft.value - 1
        mul += mod
      end
      if R2_Element_Battle_Damage::Combine == true
        tmul += mod
      else
        dam = dam * mul
      end
    end
    mul = 1
    mod = 0
    if R2_Element_Battle_Damage::Check_Equip
      self.equips.each do |eq|
        next if eq.nil?
        eq.features.each do |ft|
          next if ft.class.nil?
          next if ft.code != 11
          next if ft.data_id != ele
          mod = ft.value - 1
          mul += mod
        end
      end
      if R2_Element_Battle_Damage::Combine == true
        tmul += mod
      else
        dam = dam * mul
      end
    end
    if R2_Element_Battle_Damage::Combine == true
      tmul = 0 if tmul < 0
      dam = dam * tmul
    end
    return dam.to_i
  end
end
I haven't tested this on the map, but I think it will work there as well.
My tests was using a state that was removed at battle end, so it would never happen on the map.

This works but it is not adding the resistances together, it is processing them one at a time.
So if the actor has 50% resistance to fire then when inflicted with a fire damage over time state, it will first check the actor features in the database, process the resistance and multiple that to the damage value. So if the damage was 100 and you were 50% resistant then the damage would be 50.
But then it processes the resistance values for the class and repeats the above steps.
50 * 50% = 25.
So the resistance is not added together to give you 100%.
If that's ok then this may work for you, also I have not included any armour resistances.
Did you need that? or do you want the resistances added together?
Spoiler: Elemental State Damage
Ruby:
# ╔═════════════════════════════════════╦════════════════════╗
# ║ Title: States do elemental damage   ║  Version: 1.00     ║
# ║ Author: Roninator2                  ║                    ║
# ╠═════════════════════════════════════╬════════════════════╣
# ║ Function:                           ║   Date Created     ║
# ║                                     ╠════════════════════╣
# ║ Add elemental damage over time      ║    11 Sep 2023     ║
# ╚═════════════════════════════════════╩════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Instructions:                                            ║
# ║ Use <element damage: id, dam, pcnt> on state that will   ║
# ║ perform damage to the battler in battle.                 ║
# ║ The dam is the amount of damage that will be applied.    ║
# ║ The pcnt is use percentage? 1 / 0                        ║
# ║ 1 equals true                                            ║
# ║   will use dam as a percentage value for calculation     ║
# ║ 0 equals false                                           ║
# ║   will use dam as direct damage value                    ║
# ║                                                          ║
# ║ Example:                                                 ║
# ║ <element damage: 3, 15, 1> or <element_damage:3 15 1>    ║
# ║     element 3 (fire), 15 damage in percentage            ║
# ║             mhp * 15%                                    ║
# ║ <element damage: 3, 75, 0> or <element-damage: 3 75 0>   ║
# ║     element 3 (fire), 75 damage in flat value            ║
# ╚══════════════════════════════════════════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Terms of use:                                            ║
# ║ Free for all uses in RPG Maker except nudity             ║
# ╚══════════════════════════════════════════════════════════╝

module R2_Element_Battle_Damage
  Element_Rgx = /<element[ -_]damage: *(\d+),* *(\d+),* *(\d+)>/i
end
module DataManager
  class <<self
    alias :load_database_original_r2_state_element_damage :load_database
  end
  def self.load_database
    load_database_original_r2_state_element_damage
    load_r2_state_element_damage
  end
  def self.load_r2_state_element_damage
    for obj in $data_states
      next if obj.nil?
      obj.load_r2_state_element_damage
    end
  end
end

class RPG::State
  attr_accessor :damele
  attr_accessor :dameleamt
  attr_accessor :damelepcnt
 
  def load_r2_state_element_damage
    @damele = 0
    @dameleamt = 0
    @damelepcnt = false
    self.note.split(/[\r\n]+/).each { |line|
      case line
      when R2_Element_Battle_Damage::Element_Rgx
        @damele = $1.to_i
        @dameleamt = $2.to_i
        @damelepcnt = true if $3.to_i == 1
      end
    }
  end
end

class Game_Battler < Game_BattlerBase
  alias r2_regenerate_hp_and_element_damage   regenerate_hp
  def regenerate_hp
    r2_regenerate_hp_and_element_damage
    adjust_element_state if $game_party.in_battle
  end
  def adjust_element_state
    states.each do |st|
      if st.damele != (0 || nil)
        damage = st.dameleamt
        damage = (mhp * (st.dameleamt.to_f / 100)).to_i if st.damelepcnt == true
        damage = (damage * element_feature_resist($data_actors[self.id], st.damele)).to_i if self.is_a?(Game_Actor)
        damage = (damage * element_feature_resist($data_classes[self.class_id], st.damele)).to_i if self.is_a?(Game_Actor)
        @result.hp_damage = [damage, max_slip_damage].min
        perform_map_damage_effect if $game_party.in_battle && damage > 0
        self.hp -= @result.hp_damage
      end
    end
  end
  def element_feature_resist(member, ele)
    mul = 1
    member.features.each do |ft|
      next if ft.nil?
      next if ft.code != 11
      next if ft.data_id != ele
      mod = ft.value - 1
      mul += mod
    end
    return mul
  end
end
I'm adding elemental resistance on the actor page only, as i use class page for equipment, params and skills so this should work

i havent added any equipment that grants elemental resistance yet so i dont think that will be a problem either... at least for now

thank you very much for help! I'm gonna test this in my project rq now ^^
thank you very much for help! I'm gonna test this in my project rq now ^^
I updated the script above but if the first version works for you then carry on.
Also I made this into a new script entry. Awaiting approval

Original thread: https://forums.rpgmakerweb.com/threads/state-that-deals-elemental-dot.140906/