Help Creating a Toxic State

Hi all,

I'm needing help in creating a state similar to the toxic state from the Pokemon games. If you aren't familar with that it's a poison state that drains more hp as the battle goes on (6.25% of max hp the first turn, 12.5% of max hp the second turn, 18.75% of max hp the third turn, and so on). I'm unsure of how I can create a state that will increase the amount of hp that is lost per turn and I'm wondering if any of you would know of how to solve this problem. Thanks for any help.
I don't mean to hi-jack, but I'd really like to figure out how to do this as well. I'd like to make a state increase attack every turn.
you need different states (one for 6.25%, one for 12.5% and so on) and have the gamr change from one to the next over time.

That could either be done by tricky use of troop events or by Tsukihime's preogressive state script.

(sorry, short on time, cans search the link for you atm)
Eh... I just wanted to make it for fun, so here it goes. It also is unwarranted quality, free to use, public domain, all that.

Code:
class Game_BattlerBase  TOXIC = 2 #ID for toxic status  def all_features    feature_objects.inject([]) {|r, obj|       # ASDTsutarja      extra=[]      if toxic?(obj)        turns = [@state_total_turns[obj.id],7].min rescue 0        print turns        extra = obj.features*turns      end      r + obj.features + extra    }  end  def toxic?(obj)    (obj.is_a?(RPG::State))&&(obj.id==TOXIC)  end  alias oztx_clear_states clear_states unless $@  def clear_states    oztx_clear_states    @state_total_turns = {}  end  alias oztx_erase_state erase_state unless $@  def erase_state(state_id)    oztx_erase_state(state_id)    @state_total_turns.delete(state_id)  endend  class Game_Battler < Game_BattlerBase  alias oztx_reset_state_counts reset_state_counts unless $@  def reset_state_counts(state_id)    oztx_reset_state_counts(state_id)    @state_total_turns[state_id] = 0 if @state_total_turns[state_id]==nil  end  alias oztx_update_state_turns update_state_turns unless $@  def update_state_turns    oztx_update_state_turns    states.each do |state|      @state_total_turns[state.id] += 1    end  endend
Thanks for the help Andar and muramasa, that makes things easier on me. I should be able to get this to work now.
:S I didn't see that Muramasa had posted a script here until mine was already done, but I guess I'll post it anyway:

#==============================================================================# ** RPG::State#------------------------------------------------------------------------------# Superclass for dealing with states#==============================================================================class RPG::State < RPG::BaseItem attr_accessor :turns_applied def start_turn_count @turns_applied = 0 end # end start_turn_countend # RPG::State#==============================================================================# ** Scene_Battle#------------------------------------------------------------------------------# This class performs battle screen processing.#==============================================================================class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # * Processing at End of Action #-------------------------------------------------------------------------- alias process_custom_actions process_action_end def process_action_end process_custom_actions ######## Apply Toxic Damage ######## tox_id = 26 # replace with toxic state id if @subject.state?(tox_id) tox_state = $data_states[tox_id] # start a new turn count if there isn't one tox_state.start_turn_count if tox_state.turns_applied.nil? tox_state.turns_applied += 1 # increment the turn count # the damage formula. @subject.mhp / 15 is about 6.7% dmg = (@subject.mhp / 15) * tox_state.turns_applied @subject.hp -= dmg # make a message to display to the battle log fmt = @subject.actor? ? Vocab::ActorDamage : Vocab::EnemyDamage msg = sprintf(fmt, @subject.name, dmg) # print the resulting damage to the battle log @log_window.add_text(msg) end # end if @subject == member && member.state?(tox_id) #################################### end # def process_action_endend # Scene_BattleAs always, put this scriptlet under Materials.If you don't want the actor to be able to die from the poison, replace

Code:
dmg = (@subject.mhp / 15) * tox_state.turns_applied @subject.hp -= dmg
with
Code:
dmg = (@subject.mhp / 15) * tox_state.turns_applied dmg = (dmg > @subject.hp) ?  (@subject.hp - 1) : [email hidden] -= dmg
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/help-creating-a-toxic-state.18528/