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.

[FILLED] No Encounter

Hi. I am looking for "No Encounter" script. Well, the concept is simple, as long as one of the actors wears an equipment that has this element, random encounters will be disabled. I'm not sure if anyone has made this already or not but obviously I can't find one. your assistance will be very appriciated. Thank you!
Saru
 
Insert anywhere.

Code:
module Disable_Encounters
  # switch_id => true or false, ...
  Switches_That_Disable = {}
  # variable_id => value, ...
  Variables_That_Disable = {}
  # weapon_id, ...
  Weapons_That_Disable = []
  # armor_id, ..
  Armors_That_Disable = []
  def self.encounters_disabled?
    Switches_That_Disable.each do |s_id, boolean|
      if $game_switches[s_id] == boolean
        return true
      end
    end
    Variables_That_Disable.each do |v_id, n|
      if $game_variables[v_id] == n
        return true
      end
    end
    $game_party.actors.each do |actor|
      if Weapons_That_Disable.include?(actor.weapon_id) ||
         Armors_That_Disable.include?(actor.armor1_id) ||
         Armors_That_Disable.include?(actor.armor2_id) ||
         Armors_That_Disable.include?(actor.armor3_id) ||
         Armors_That_Disable.include?(actor.armor4_id)
        return true
      end
    end
  end
end

class Game_System
  alias seph_noenc_gmsys_ecndis encounter_disabled
  def encounter_disabled
    if Disable_Encounters.encounters_disabled?
      return true
    end
    return self.seph_noenc_gmsys_ecndis
  end
end

I threw in Switches, variables, weapons or armors that can disable encounters is switch is off or on, variable is certain value, or any actor has a weapon or armor equipped.

Let me know if you need any help with the setup.
 
This looks cool! I will use it and if there is any problem I would probably be whining around here again lol ^^ Thank you again and keep making great scripts like you always do!
Saru
 

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