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
Print Page - Time-Based Encounters

The RPG Maker Resource Kit

RMRK RPG Maker Creation => VX => VX Scripts Database => Topic started by: modern algebra on April 20, 2009, 10:18:41 PM

Title: Time-Based Encounters
Post by: modern algebra on April 20, 2009, 10:18:41 PM
Timed Encounter Rates
Version: 1.0
Author: modern algebra
Date: April 20, 2009

Version History




Description



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

Features


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




Thanks


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.



Creative Commons License
This script by modern algebra is licensed under a Creative Commons Attribution-Non-Commercial-Share Alike 2.5 Canada License.
Title: Re: Time-Based Encounters
Post by: Charbel on April 21, 2009, 05:08:06 PM
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  ;)