Script Request
RGSS3 Script RequestsCan you please update your title to refer what kind of script you're requesting? Please don't use vague titles like "script request" in the ... script request forum.
yep - we already know you have a script request, because of where you're posting 😉 Give people and idea of what you want without even opening the thread.
Having said that ... random encounters are not limited per map, so there's no way of knowing how many encounters are left. It depends on the number of steps you set up and how long the player spends wandering around the map. This is not something a scripter (or you) could determine - it's entirely up to the player.
Having said that ... random encounters are not limited per map, so there's no way of knowing how many encounters are left. It depends on the number of steps you set up and how long the player spends wandering around the map. This is not something a scripter (or you) could determine - it's entirely up to the player.
I think I know what he is asking. In some games, there are a fixed number of encounters on a map, and once you have won that many fights, no more random fights occur (at least until the map is told to reset the random fights). I recall the Ar Tonelico games had something like this. Am I right?
Then he would have to have another script that handles that, as the default scripts do not limit the number of encounters. If that's the case, anyone doing this request would need to see that script because they need to know how it counts and how it determines how many there will be.
Easy enough to do I think.
Script 1: Enter Battle from the Menu
Script 2: Encounter Limits Per Map
Script 1: Enter Battle from the Menu
#===============================================================================# Script: Menu Battle Start# Author: Selchar#-------------------------------------------------------------------------------=beginThis script adds a menu command that allows you to instantly start a randombattle, limited of course to the troops set for the current map and region youare standing on.=end#-------------------------------------------------------------------------------module Selchar module Menu_Battle Command_Name = "Enter Battle" endend#===============================================================================# Rest of the Script#===============================================================================$imported = {} if $imported.nil?$imported[:Sel_Menu_Battle] = trueclass Game_Player < Game_Character attr_accessor :encounter_countendclass Window_MenuCommand < Window_Command alias :enter_battle_command :add_original_commands def add_original_commands enter_battle_command add_command(Selchar::Menu_Battle::Command_Name, :enter_battle_handler, menu_battle_enable) end def menu_battle_enable return false if $game_map.encounter_list.empty? return false if $game_system.encounter_disabled return true endendclass Scene_Menu < Scene_MenuBase alias :enter_battle_command :create_command_window # See Info [ 1 ] def create_command_window enter_battle_command handle_name = :enter_battle_handler method_name = :enter_battle @command_window.set_handler(handle_name,method(method_name)) end def enter_battle return_scene $game_player.encounter_count = 0 endend#===============================================================================# End of File#===============================================================================
Code:
#===============================================================================# Script: Map Encounter Limit# Author: Selchar#-------------------------------------------------------------------------------=beginThis script allows you to limit the number of random encounters you can... wellencounter!#-------------------------------------------------------------------------------# Map Note Tag#-------------------------------------------------------------------------------<encounter limit: x> -Where x is the limit for that particular map.<encounter refresh> -Allows the maps encounters to refresh when you leave/re-enter it.#-------------------------------------------------------------------------------# Scriptcall#-------------------------------------------------------------------------------$game_map.encounter_limit_refresh -Manually refreshes the encounters on the current map, even when the notetag <encounter refresh> isn't used for the map.=endmodule Selchar module Encounter_Limit #The default limit for all maps, keep under 1000 so that it can be displayed #with the default Menu Display Default = 999 Menu_Display = "Foes: " endend$imported = {} if $imported.nil?$imported[:Sel_Encounter_Limit] = trueclass RPG::Map def encounter_limit return $1.to_i if note =~ /<encounter[ -_?]limit:\s*(.*)>/i return Selchar::Encounter_Limit::Default end def encounter_refresh return true if note =~ /<encounter[ -_?]refresh>/i endendclass Game_System attr_accessor :map_encounter_limits alias :map_encounter_limits_init :initialize def initialize map_encounter_limits_init @map_encounter_limits = {} endendclass Game_Map attr_reader :map_id alias :encounter_limit_setup :setup def setup(map_id) encounter_limit_setup(map_id) setup_encounter_limit encounter_limit_refresh if @map.encounter_refresh end def encounter_limit_refresh $game_system.map_encounter_limits[map_id] = encounter_limit_max end def setup_encounter_limit $game_system.map_encounter_limits[map_id] = encounter_limit_max if $game_system.map_encounter_limits[map_id].nil? end def encounter_limit_max @map.encounter_limit endendclass Scene_Map < Scene_Base #Overwrite since alias won't work in this case def update_encounter return if $game_system.map_encounter_limits[$game_map.map_id] == 0 if $game_player.encounter $game_system.map_encounter_limits[$game_map.map_id] -= 1 SceneManager.call(Scene_Battle) end endend#===============================================================================# Menu Display#===============================================================================class Window_Encounter_Count < Window_Base def initialize super(0, 0, window_width, fitting_height(1)) refresh end def window_width return 160 end def refresh contents.clear draw_encounter_count end def draw_encounter_count text = Selchar::Encounter_Limit::Menu_Display text += "#{$game_system.map_encounter_limits[$game_map.map_id]}/#{$game_map.encounter_limit_max}" cx = text_size(text).width x =window_width-cx-16 draw_text(x, 0, cx, line_height, text) end def open refresh super endendclass Scene_Menu < Scene_MenuBase alias :start_encounter_count :start def start start_encounter_count create_encounter_window end def create_encounter_window @encounter_count_window = Window_Encounter_Count.new @encounter_count_window.x = 0 @encounter_count_window.y = @gold_window.y - @encounter_count_window.height endend#===============================================================================# Compatibility#===============================================================================if $imported[:Sel_Menu_Battle] class Window_MenuCommand < Window_Command alias :encounter_limit_enable :menu_battle_enable def menu_battle_enable return false if $game_system.map_encounter_limits[$game_map.map_id] == 0 return encounter_limit_enable end endend#===============================================================================# End of File#===============================================================================
Original thread: https://forums.rpgmakerweb.com/threads/script-request.32975/
