Poison tiles Question

So I had a bit of an interesting question. If I put poisoned tiles down and the player walks on them, I know it does damage to the party, but is there a way to make it to where it not only does damage but also has a certain chance to poison the party as well? How would I set it up? Thanks in advance for the help.
If it's a small area, you could just event it. Otherwise you will probably need to use a script that reads region codes.
If it's a small area, you could just event it. Otherwise you will probably need to use a script that reads region codes.
It is not really a small area. I might need to look for a script for it just in case I make bigger rooms with poison.
Do this by common event, and that's where @Shaz Region Common Events comes handy.
I modified a script by adding the options you wanted.
You can make the extra options 0 if you don't want them.
Ruby:
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Damage for more types of Floors Script v 1.2
#Author = Kio Kurashi
#Credit = Kio Kurashi
#Modded by Roninator2
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Notes:
#  Currently this script only works for three types of Floor damage. It doesn't
#  nessesarily need to be Poison, Lava, and Shock, however. If more than the
#  provided number of Floors are needed I can add more.
#  Options added to allow inflicting states when damaged
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Instructions:
#  The editable section is directly bellow. For each you will have a Terrain tag,
#  and a Damage ammount. The Terrain tag will be a number between 0 and 7.
#  as the number on the tiles. Damage will be the Base damage that is
#  applied for each number.
#Important:
#  The map tileset must be properly configured.
#  The tile that will be a damage tile must be marked as a damage tile. go figure
#  The tile must also have the terrain tag matching the settings below.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Update:
#  The script will now apply a damage effect at the specified interval
#  60 = 1 second
#  Also available is a switch to turn the interval damage off.
#  Turn switch on to stop interval damage.
#~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#~     BEGINING OF EDITABLE SECTION
#~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

module R2_Floor_Damage
 
NORMAL_TERRAIN_REGION = 0
NORMAL_TERRAIN_DAMAGE = 0
# set any region to 8 if you do not wish to use it.
POISON_TERRAIN_REGION = 1   # Poison terrain tag
POISON_TERRAIN_DAMAGE = 10  # Poison damage
CHANCE_POISON = 15          # Chance to inflict poison
POISON_STATE = 2            # Poison state

LAVA_TERRAIN_REGION = 2     # Burn terrain tag
LAVA_TERRAIN_DAMAGE = 40    # Burn damage
CHANCE_BURN = 25            # Chance to inflict burn
BURN_STATE = 25             # Burn state

SHOCK_TERRAIN_REGION = 3    # Shock terrain tag
SHOCK_TERRAIN_DAMAGE = 20   # Shock damage
CHANCE_SHOCK = 50           # Chance to inflict shock
SHOCK_STATE = 35            # Shock state

FDR_DAMAGE_INT = 60         # interval at which the damage effect will apply again.
FDR_DAMAGE_SWITCH = 151     # Turn switch on to turn off interval damage

BLOCK_STATES = [160, 190]   # States that will block damage
INFLICT_STATE = 191         # Switch used to inflict states

end
#~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#~     END OF EDITABLE SECTION
#~       Editing beyond this point without prior knowledge is dangerous!!
#~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
class Game_Actor
  def basic_floor_damage
    case $game_map.terrain_tag($game_player.x, $game_player.y)
    when R2_Floor_Damage::NORMAL_TERRAIN_REGION
      return R2_Floor_Damage::NORMAL_TERRAIN_DAMAGE
    when R2_Floor_Damage::POISON_TERRAIN_REGION
      return R2_Floor_Damage::POISON_TERRAIN_DAMAGE
    when R2_Floor_Damage::LAVA_TERRAIN_REGION
      return R2_Floor_Damage::LAVA_TERRAIN_DAMAGE
    when R2_Floor_Damage::SHOCK_TERRAIN_REGION
      return R2_Floor_Damage::SHOCK_TERRAIN_DAMAGE
    when nil
      return 10
    end
  end
end

class Game_Player < Game_Character
  alias r2_fdr_initialize initialize
  def initialize
    @standingtime = 0
    r2_fdr_initialize
  end
  alias r2_input_move_fdr move_by_input
  def move_by_input
    @standingtime = 0 if $game_player.moving?
    r2_input_move_fdr
  end
  alias r2_fdr_update_nonmoving update_nonmoving
  def update_nonmoving(last_moving)
    if !$game_switches[R2_Floor_Damage::FDR_DAMAGE_SWITCH]
      @standingtime += 1 if !$game_map.interpreter.running?
      actor.check_floor_effect if @standingtime > R2_Floor_Damage::FDR_DAMAGE_INT
      @standingtime = 0 if @standingtime > R2_Floor_Damage::FDR_DAMAGE_INT
    end
    r2_fdr_update_nonmoving(last_moving)
  end
end

class Game_Actor < Game_Battler
  alias r2_state_block_floor_damage execute_floor_damage
  def execute_floor_damage
    state_ids = self.states.collect {|obj| obj.id }
    return if state_ids.include?(R2_Floor_Damage::BLOCK_STATES)
    r2_state_block_floor_damage
    case $game_map.terrain_tag($game_player.x, $game_player.y)
    when R2_Floor_Damage::POISON_TERRAIN_REGION
      chance = R2_Floor_Damage::CHANCE_POISON
      state = R2_Floor_Damage::POISON_STATE
    when R2_Floor_Damage::LAVA_TERRAIN_REGION
      chance = R2_Floor_Damage::CHANCE_BURN
      state = R2_Floor_Damage::BURN_STATE
    when R2_Floor_Damage::SHOCK_TERRAIN_REGION
      chance = R2_Floor_Damage::CHANCE_SHOCK
      state = R2_Floor_Damage::SHOCK_STATE
    else
      return
    end
    return if $game_switches[R2_Floor_Damage::INFLICT_STATE] == false
    roll = rand(100).to_i + 1
    if roll <= chance
      act = $game_actors[@actor_id]
      act.add_state(state) unless act.state?(state)
    end
  end
end
I modified a script by adding the options you wanted.
You can make the extra options 0 if you don't want them.
Ruby:
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Damage for more types of Floors Script v 1.2
#Author = Kio Kurashi
#Credit = Kio Kurashi
#Modded by Roninator2
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Notes:
#  Currently this script only works for three types of Floor damage. It doesn't
#  nessesarily need to be Poison, Lava, and Shock, however. If more than the
#  provided number of Floors are needed I can add more.
#  Options added to allow inflicting states when damaged
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Instructions:
#  The editable section is directly bellow. For each you will have a Terrain tag,
#  and a Damage ammount. The Terrain tag will be a number between 0 and 7.
#  as the number on the tiles. Damage will be the Base damage that is
#  applied for each number.
#Important:
#  The map tileset must be properly configured.
#  The tile that will be a damage tile must be marked as a damage tile. go figure
#  The tile must also have the terrain tag matching the settings below.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Update:
#  The script will now apply a damage effect at the specified interval
#  60 = 1 second
#  Also available is a switch to turn the interval damage off.
#  Turn switch on to stop interval damage.
#~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#~     BEGINING OF EDITABLE SECTION
#~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

module R2_Floor_Damage
 
NORMAL_TERRAIN_REGION = 0
NORMAL_TERRAIN_DAMAGE = 0
 
POISON_TERRAIN_REGION = 1   # Poison terrain tag
POISON_TERRAIN_DAMAGE = 10  # Poison damage
CHANCE_POISON = 15          # Chance to inflict poison
POISON_STATE = 2            # Poison state

LAVA_TERRAIN_REGION = 2     # Burn terrain tag
LAVA_TERRAIN_DAMAGE = 40    # Burn damage
CHANGE_BURN = 25            # Chance to inflict burn
BURN_STATE = 25             # Burn state

SHOCK_TERRAIN_REGION = 3    # Shock terrain tag
SHOCK_TERRAIN_DAMAGE = 20   # Shock damage
CHANGE_SHOCK = 50           # Chance to inflict shock
SHOCK_STATE = 35            # Shock state

FDR_DAMAGE_INT = 60         # interval at which the damage effect will apply again.
FDR_DAMAGE_SWITCH = 151     # Turn switch on to turn off interval damage

BLOCK_STATES = [160, 190]   # States that will block damage
INFLICT_STATE = 191         # Switch used to inflict states

end
#~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#~     END OF EDITABLE SECTION
#~       Editing beyond this point without prior knowledge is dangerous!!
#~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
class Game_Actor
  def basic_floor_damage
    case $game_map.terrain_tag($game_player.x, $game_player.y)
    when R2_Floor_Damage::NORMAL_TERRAIN_REGION
      return R2_Floor_Damage::NORMAL_TERRAIN_DAMAGE
    when R2_Floor_Damage::POISON_TERRAIN_REGION
      return R2_Floor_Damage::POISON_TERRAIN_DAMAGE
    when R2_Floor_Damage::LAVA_TERRAIN_REGION
      return R2_Floor_Damage::LAVA_TERRAIN_DAMAGE
    when R2_Floor_Damage::SHOCK_TERRAIN_REGION
      return R2_Floor_Damage::SHOCK_TERRAIN_DAMAGE
    when nil
      return 10
    end
  end
end

class Game_Player < Game_Character
  alias r2_fdr_initialize initialize
  def initialize
    @standingtime = 0
    r2_fdr_initialize
  end
  alias r2_input_move_fdr move_by_input
  def move_by_input
    @standingtime = 0 if $game_player.moving?
    r2_input_move_fdr
  end
  alias r2_fdr_update_nonmoving update_nonmoving
  def update_nonmoving(last_moving)
    if !$game_switches[R2_Floor_Damage::FDR_DAMAGE_SWITCH]
      @standingtime += 1 if !$game_map.interpreter.running?
      actor.check_floor_effect if @standingtime > R2_Floor_Damage::FDR_DAMAGE_INT
      @standingtime = 0 if @standingtime > R2_Floor_Damage::FDR_DAMAGE_INT
    end
    r2_fdr_update_nonmoving(last_moving)
  end
end

class Game_Actor < Game_Battler
  alias r2_state_block_floor_damage execute_floor_damage
  def execute_floor_damage
    state_ids = self.states.collect {|obj| obj.id }
    return if state_ids.include?(R2_Floor_Damage::BLOCK_STATES)
    r2_state_block_floor_damage
    case $game_map.terrain_tag($game_player.x, $game_player.y)
    when R2_Floor_Damage::POISON_TERRAIN_REGION
      chance = R2_Floor_Damage::CHANCE_POISON
      state = R2_Floor_Damage::POISON_STATE
    when R2_Floor_Damage::LAVA_TERRAIN_REGION
      chance = R2_Floor_Damage::CHANCE_BURN
      state = R2_Floor_Damage::BURN_STATE
    when R2_Floor_Damage::SHOCK_TERRAIN_REGION
      chance = R2_Floor_Damage::CHANCE_SHOCK
      state = R2_Floor_Damage::SHOCK_STATE
    else
      return
    end
    return if $game_switches[R2_Floor_Damage::INFLICT_STATE] == false
    roll = rand(100).to_i
    if roll <= chance
      act = $game_actors[@actor_id]
      act.add_state(state)
    end
  end
end
So that works, but it keeps repeating the poison state even after the characters have the status. How would I fix it to where when a character gets poisoned it doesn't repeat.
it doesn't repeat
I added an unless statement. try it now.
I added an unless statement. try it now.
It worked! Thanks for the help.
It worked!
I just realized I had a typo in the script. Fixed and updated the roll number so that it will get a number between 1-100, before it would have returned 0-99

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/poison-tiles-question.143709/