Notice: fwrite(): Write of 44 bytes failed with errno=28 No space left on device in /home/rmrk/domains/rmrk.net/public_html/Sources/Cache/APIs/FileBased.php on line 96
Time-Based Encounters
Main Menu
  • Welcome to The RPG Maker Resource Kit.

Time-Based Encounters

Started by modern algebra, April 20, 2009, 10:18:41 PM

0 Members and 1 Guest are viewing this topic.

modern algebra

Timed Encounter Rates
Version: 1.0
Author: modern algebra
Date: April 20, 2009

Version History




  • <Version 1.0> 04.20.2009 - Original Release

Description



This script allows it so that encounters are not based on step count, but rather on seconds.

Features


  • Can use seconds rather than steps to determine random encounters
  • Can be toggled on and off easily, allowing for some maps to have this feature while others are step-based.

Screenshots

Not necessary or useful

Instructions

See inside the header for instructions

Script




#==============================================================================
#  Timed Encounter Rates
#  Version: 1.0
#  Author: modern algebra (rmrk.net)
#  Date: April 20, 2009
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Description:
#    This script sets it so that encounters are not based on step count, but
#   rather on seconds.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Instructions:
#    Insert this script above Main and below other custom scripts.
#
#    The encounter rate determines the average number of seconds until an
#   an encounter, and encounters will occur whether or not the player is
#   moving.
#
#    To turn it back to regular encounters by steps, all that is necessary is
#   to type the following into a call script:
#
#      $game_player.change_encounter_type (x)
#
#   where x is either true or false, true being time-based encounters and
#   false being step-based encounters. If you do not include x, it will simply
#   toggle between the two.
#==============================================================================

#==============================================================================
# ** Game_Player
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased methods - initialize, make_encounter_count, update
#    new method - change_encounter_type
#==============================================================================

class Game_Player
 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 # * Object Initialization
 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 alias odrngb_wl65_tmencounters_int_2b54 initialize
 def initialize (*args)
   # Run Original Method
   odrngb_wl65_tmencounters_int_2b54 (*args)
   # Initialize time_encounter boolean
   @time_encounters = true
 end
 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 # * Make Encounter Count
 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 alias magbra_w3565_mkencnt_tmdenrs_4r3bt make_encounter_count
 def make_encounter_count (*args)
   # Run Original Method
   magbra_w3565_mkencnt_tmdenrs_4r3bt (*args)
   # Make encounter count by frames
   @encounter_count *= 60 if @time_encounters
 end
 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 # * Frame Update
 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 alias modalg_wltr_upd_timed_encounters_74b6 update
 def update (*args)
   # Run Original Method
   modalg_wltr_upd_timed_encounters_74b6 (*args)
   # Reduce @encounter_count
   update_encounter if @time_encounters && !moving?
 end
 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 # * Change Encounter Type
 #    boolean : true => time encounters; false => step encounters
 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 def change_encounter_type (boolean = nil)
   @time_encounters = boolean == nil ? !@time_encounters : boolean
   make_encounter_count
 end
end


Credit




  • modern algebra

Thanks


  • wltr3565, for requesting the script

Support



Please post in this topic for the swiftest response.

Known Compatibility Issues

No currently known compatibility issues.

Demo



No demo is necessary. Please see the script.




Charbel

thanks  :D
I'm happy to see new scripts made by you
I hope you make many others
I don't speak English very well  ;)