Infective States

Made for a request here.

This script allows the "infection" of states.

Actor/Enemy will spread the infection to one of their party member at each turn's end.

Features:

[1] Infective States

[2] Re-infective (renewing state timer)

[3] Able to set chance of infection for each turn's end

How to Use:

[1] Paste the script below Material and above Main

[2] Set up the infective state ids in the script's setting area

Compatibility:

This script uses alias method, it's unlikely to conflict with other scripts.

If you find it not working, simply put it below other custom scripts.

Terms of Use:

Free for both commercial and non-commercial

Script:

Spoiler
Code:
#==============================================================================# ■ Meow Face Infective States#------------------------------------------------------------------------------# Randomly infect another character at each turn's end#==============================================================================module SICKMEOW #DO NOT REMOVE!#==============================================================================# Settings Area#==============================================================================  STATES = [28,3,5,6] #State IDs that are infective  CHANCE = 2 # 1/X rate of infect chance (eg, 1/2 = 50%)#==============================================================================# End of Settings Area# Edit anything past this line at your own risk!#==============================================================================endclass Game_Battler < Game_BattlerBase  alias on_meow_end on_turn_end  def on_turn_end    on_meow_end    sick = SICKMEOW::STATES    target = rand($game_party.battle_members.size)    etarget = rand($game_troop.members.size)    states.each do |state|      if sick.include?(state.id) && rand(SICKMEOW::CHANCE) == 0        if actor?          $game_party.battle_members[target].add_state(state.id)        elsif enemy?          $game_troop.members[etarget].add_state(state.id)        end      end    end  endend
Fixed script format, credit Meow Face.
Code:
#==============================================================================
# ■ Meow Face Infective States
#------------------------------------------------------------------------------
# Randomly infect another character at each turn's end
#==============================================================================
module SICKMEOW
#DO NOT REMOVE!
#==============================================================================
# Settings Area
#============================================================================== 
STATES = [28,3,5,6] #State IDs that are infective 
CHANCE = 2 # 1/X rate of infect chance (eg, 1/2 = 50%)
#==============================================================================
# End of Settings Area# Edit anything past this line at your own risk!
#==============================================================================
end
class Game_Battler < Game_BattlerBase 
  alias on_meow_end on_turn_end 
  def on_turn_end   
    on_meow_end   
    sick = SICKMEOW::STATES   
    target = rand($game_party.battle_members.size)   
    etarget = rand($game_troop.members.size)   
    states.each do |state|     
      if sick.include?(state.id) && rand(SICKMEOW::CHANCE) == 0       
        if actor?         
          $game_party.battle_members[target].add_state(state.id)       
        elsif enemy?         
          $game_troop.members[etarget].add_state(state.id)       
        end
      end   
    end 
  end
 end

Original thread: https://forums.rpgmakerweb.com/threads/infective-states.52009/