Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- # DSI Limit Variable Range
- # -- Last Updated: 2017.08.11
- # -- Author: dsiver144
- # -- Level: Easy
- # -- Requires: n/a
- #==============================================================================
- $imported = {} if $imported.nil?
- $imported["DSI-LimitVariableRange"] = true
- #==============================================================================
- # + Updates
- # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # 2017.08.11 - Finish first version.
- #==============================================================================
- # + Instructions
- # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # To install this script, open up your script editor and copy/paste this script
- # to an open slot below ▼Materials but above ▼Main. Remember to save.
- #==============================================================================
- module DSIVER144
- module VARIABLE
- LIMITS = {} # Do not delete this line.
- #--------------------------------------------------------------------------
- # Configurable [Start]
- #--------------------------------------------------------------------------
- # LIMIT[ variable_id ] = [ min_value, max_value ]
- # You can add as much as you want.
- #--------------------------------------------------------------------------
- LIMITS[63] = [0, 100]
- LIMITS[64] = [0, 100]
- #--------------------------------------------------------------------------
- # Configurable [End]
- #--------------------------------------------------------------------------
- end # VARIABLE
- end # DSIVER144
- class Game_Variables
- #--------------------------------------------------------------------------
- # * Set Variable [Overwrite]
- #--------------------------------------------------------------------------
- def []=(variable_id, value)
- @data[variable_id] = value
- if DSIVER144::VARIABLE::LIMITS.has_key?(variable_id)
- min_value = DSIVER144::VARIABLE::LIMITS[variable_id][0]
- max_value = DSIVER144::VARIABLE::LIMITS[variable_id][1]
- # This line for comparing between 3 values and return the value in range.
- get_min_max = [[min_value, value].max, max_value].min
- @data[variable_id] = get_min_max
- end
- on_change
- end
- end # Game_Variables
- #===============================================================================
- # END OF SCRIPT
- #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement