=begin Custom Vehicle Encounter version: 1.0 Created by: Casper Gaming Compatibility: May not be compatible with scripts that alter how vehicles work. Overwrites: make_encounter_count, make_encounter_troop_id, and update_encounter in Game_Player. FFEATURES: This script will allow you to have encounters on the Boat, Ship, or Airship. It also allows you to change the encounter rate while on each vehicle, and allows you to create a seperate encounter list for each vehicle. All of the features are toggleable. How to use these features is explained below in the setup section. SETUP BELOW IS REQUIRED! CREDIT and TERMS: Please visit https://www.caspergaming.com/terms-of-use/ for terms of use and credit guidelines =end module CASPER_VEHICLE_ENCOUNTERS # Don't Touch BOAT = 10 # Switch ID. When ON, allows encounters in the boat. SHIP = 11 # Switch ID. When ON, allows encounters in the ship. AIRSHIP = 12 # Switch ID. When ON, allows encounters in the airship. # The following switch needs to be ON if you wish to have different troops # encountered while on a vehicle. If OFF, troops encountered while on a vehicle # will not be any different than troops encountered while not on a vehicle. ALLOWCUSTOMENCOUNTER = 13 # Switch ID # The following arrays control the Troop ID's to be encounetred when on the # corresponding vehicle. For example, BOATENCOUNTERS = [1, 2] will enable ONLY # troops 1 and 2 in the database able to be fought while on the Boat. Of course, # You'll need to make sure the switch that enables encounters for that vehicle # is also ON. Vehicles ignore area encounter lists. BOATENCOUNTERS = [1, 2] # These troops can be fought in the boat. SHIPENCOUNTERS = [3, 4] # These troops can be fought in the ship. AIRSHIPENCOUNTERS = [5, 6] # These troops can be fought in the airship. # The following switch needs to be ON if you wish to have different encounter # rates while in each vehicle. If OFF, vehicle encounter rate is set to the # map encounter rate. ALLOWCUSTOMRATE = 14 # Switch ID # The following numbers control how many steps on average before an encounter # happens in the current vehicle. Faster vehicles like the airship and ship # should be set higher because their step counter increases much faster. BOATSTEP = 25 # Average amount of steps before encounter in boat. SHIPSTEP = 35 # Average amount of steps before encounter in ship. AIRSHIPSTEP = 50 # Average amount of steps before encounter in airship. end # Don't Touch this or anything below. class Game_Player < Game_Character include CASPER_VEHICLE_ENCOUNTERS def make_encounter_count if $game_map.map_id != 0 if in_vehicle? and @vehicle_type == 0 and $game_switches[ALLOWCUSTOMRATE] n = BOATSTEP elsif in_vehicle? and @vehicle_type == 1 and $game_switches[ALLOWCUSTOMRATE] n = SHIPSTEP elsif in_vehicle? and @vehicle_type == 2 and $game_switches[ALLOWCUSTOMRATE] n = AIRSHIPSTEP else n = $game_map.encounter_step end @encounter_count = rand(n) + rand(n) + 1 end end def make_encounter_troop_id if $game_switches[ALLOWCUSTOMENCOUNTER] if in_vehicle? and @vehicle_type == 0 encounter_list = BOATENCOUNTERS elsif in_vehicle? and @vehicle_type == 1 encounter_list = SHIPENCOUNTERS elsif in_vehicle? and @vehicle_type == 2 encounter_list = AIRSHIPENCOUNTERS else encounter_list = $game_map.encounter_list.clone for area in $data_areas.values encounter_list += area.encounter_list if in_area?(area) end end if encounter_list.empty? make_encounter_count return 0 end return encounter_list[rand(encounter_list.size)] else encounter_list = $game_map.encounter_list.clone for area in $data_areas.values encounter_list += area.encounter_list if in_area?(area) end if encounter_list.empty? make_encounter_count return 0 end return encounter_list[rand(encounter_list.size)] end end def update_encounter return if $TEST and Input.press?(Input::CTRL) if in_vehicle? and @vehicle_type == 0 and $game_switches[BOAT] == false return if in_vehicle? end if in_vehicle? and @vehicle_type == 1 and $game_switches[SHIP] == false return if in_vehicle? end if in_vehicle? and @vehicle_type == 2 and $game_switches[AIRSHIP] == false return if in_vehicle? end if $game_map.bush?(@x, @y) @encounter_count -= 2 else @encounter_count -= 1 end end end