Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #=========================================================================
- # JLT Ace Infamy System v1.00
- # Author: JLT (Jaxx L. Timing)
- # Version Date: 7/21/2013 (v1.00)
- #=========================================================================
- # Description:
- # This script enables you to use an infamy system in your projects.
- # You can set an initial infamy value as well as add or subtract from
- # a character's infamy through script calls. Most aspects of the system
- # are customizable.
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # Instructions:
- # Download http://postimg.org/image/obdosejb7/ and insert it into your game's
- # Graphics/System folder. Open your resource manager and import the new icons.
- # Place this script below materials and above main and you are good to go.
- #
- # - To add or subtract from a characters alignment points use a script call
- # $game_actors[actor_id].infamy += number - to add points
- # $game_actors[actor_id].infamy -= number - to remove points
- #
- # - To set an actor's inital alignment enter <Initial_Infamy: number>
- # into the actor's note box, by default, actors start with 0 infamy.
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- module JLT_Infamy_Settings
- #~ -------------------------------------------------------------------------------------------
- #~ -------------------------------------------------------------------------------------------
- #~ -------------------------------------------------------------------------------------------
- #~ -------------------------------------------------------------------------------------------
- #--------------------------------------------------------------------------------------------
- # * Customize the appearence of the infamy bar below.
- #--------------------------------------------------------------------------------------------
- #~ -------------------------------------------------------------------------------------------
- #~ -------------------------------------------------------------------------------------------
- #~ -------------------------------------------------------------------------------------------
- #~ -------------------------------------------------------------------------------------------
- MAX_INFAMY = 100 # Change the scale of your infamy gauge,
- # by default it is on a scale of 0 to 100.
- # There's no real reason to change this, but you can if you want.
- INFAMY_TEXT_COLOR = 0 # color id
- VOCAB_INFAMY = "Infamy"
- SHOW_MODE_TEXT = true
- INFAMY_MODES = ["CLEAR", "CAUTION", "DANGER", "WANTED"]
- INFAMY_MODE_NAME_COLORS = [0, 0, 0, 0]
- SHOW_MODE_ICONS = true
- INFAMY_MODES_ICONS = [0, 0, 534, 533]
- # Choose the names of your modes, the final mode will only show when the gauge is full.
- # This applies even if you change the mode weight below.
- SHOW_LARGE_MAX_INFAMY_TEXT = true
- MAX_INFAMY_TEXT = "WANTED"
- MAX_INFAMY_TEXT_COLOR = 18
- INFAMY_MODE_WEIGHTS = [45, 75, 90, 100]
- # Explaination: Say you only want the mode right before the final one
- # to show up when the bar is 95% full, set that mode's weight to 95.
- # !!! Mode weight is calculated in percents !!!
- # !!! Even if you change Max_Infamy to be higher/lower these numbers should be between 1 - 100 !!!
- INFAMY_MODE_COLORS = [8, 0, 0, 14, 14, 17, 2, 18]
- # Change the gauge gradient for various modes.
- # The array is set up like so:
- # [first mode_left color, first mode_right color, second mode_left color, etc...]
- #~ -------------------------------------------------------------------------------------------
- #~ -------------------------------------------------------------------------------------------
- #~ -------------------------------------------------------------------------------------------
- #~ -------------------------------------------------------------------------------------------
- #--------------------------------------------------------------------------------------------
- # * End of customization settings, do not edit below here unless you know what you're doing.
- #--------------------------------------------------------------------------------------------
- #~ -------------------------------------------------------------------------------------------
- #~ -------------------------------------------------------------------------------------------
- #~ -------------------------------------------------------------------------------------------
- #~ -------------------------------------------------------------------------------------------
- end
- include JLT_Infamy_Settings
- #==============================================================================
- # ** Window_MenuStatus
- #------------------------------------------------------------------------------
- # This window displays party member status on the menu screen.
- #==============================================================================
- class Window_MenuStatus
- #============================================================================
- #--------------------------------------------------------------------------
- # * alias: Draw Item
- #--------------------------------------------------------------------------
- alias jlt_window_menustatus_infamy_sui89 draw_item
- def draw_item(index)
- jlt_window_menustatus_infamy_sui89(index)
- actor = $game_party.members[index]
- enabled = $game_party.battle_members.include?(actor)
- rect = item_rect(index)
- draw_infamy_bar(actor, rect.x + 1, rect.y + 1)
- end
- #--------------------------------------------------------------------------
- # * new: Draw Infamy Info
- #--------------------------------------------------------------------------
- def draw_infamy_bar(actor, x, y)
- gauge_rate = infamy_value(actor, MAX_INFAMY)
- width = 96
- height = 10
- draw_infamy_gauge(x, y + 70, width, height, gauge_rate, text_color(get_infamy_gauge_color(x, y, actor, INFAMY_MODE_WEIGHTS, INFAMY_MODE_COLORS, "left")), text_color(get_infamy_gauge_color(x, y, actor, INFAMY_MODE_WEIGHTS, INFAMY_MODE_COLORS, "right")))
- make_font_smaller
- change_color(text_color(INFAMY_TEXT_COLOR))
- draw_text(x + 1, y + 75, width, line_height, VOCAB_INFAMY)
- normal_color
- make_font_bigger
- if SHOW_MODE_TEXT
- draw_infamy_mode_text(x, y, get_infamy_mode_text_color(actor, INFAMY_MODE_WEIGHTS))
- end
- if SHOW_MODE_ICONS
- draw_infamy_icons(actor, x, y)
- end
- if SHOW_LARGE_MAX_INFAMY_TEXT && infamy_value(actor, MAX_INFAMY) == 1
- word_buffer = 96 - INFAMY_MODES[INFAMY_MODES.size - 1].size * 14.5
- make_font_bigger
- change_color(text_color(MAX_INFAMY_TEXT_COLOR))
- draw_text(x + word_buffer, y + 45, width, line_height * 2, MAX_INFAMY_TEXT)
- make_font_smaller
- end
- end
- #--------------------------------------------------------------------------
- # * new: Draw Infamy Gauge
- #--------------------------------------------------------------------------
- def draw_infamy_gauge(x, y, width, height, rate, color1, color2)
- fill_w = (width * rate).to_i
- gauge_y = y + line_height - 8
- contents.fill_rect(x, gauge_y, width, height, gauge_back_color)
- contents.gradient_fill_rect(x + 1, gauge_y + 1, fill_w-2, height-2, color1, color2)
- end
- #--------------------------------------------------------------------------
- # * new: Retrieve Infamy
- #--------------------------------------------------------------------------
- def infamy_value(actor, max_infamy)
- infamous_value = $game_actors[actor.id].infamy.to_f / max_infamy
- if infamous_value > 1
- infamous_value = 1
- end
- if infamous_value < 0
- infamous_value = 0
- end
- return infamous_value
- end
- #--------------------------------------------------------------------------
- # * new: Retrieve Gauge Color
- #--------------------------------------------------------------------------
- def get_infamy_gauge_color(x, y, actor, infamy_weight, infamy_mode_colors, left_or_right)
- counter = infamy_weight.size
- size = counter - 1
- while counter > 0
- if $game_actors[actor.id].infamy.to_f >= infamy_weight[size]
- draw_infamy_mode_text(x, y, size)
- size = size * 2
- if left_or_right == "right"
- size = size + 1
- end
- return infamy_mode_colors[size]
- end
- counter = counter - 1
- size = size - 1
- end
- if $game_actors[actor.id].infamy.to_f <= infamy_weight[0]
- draw_infamy_mode_text(x, y, 0)
- infamy_color_id = infamy_mode_colors[1]
- if left_or_right == "left"
- infamy_color_id = infamy_mode_colors[0]
- end
- end
- return infamy_color_id
- end
- #--------------------------------------------------------------------------
- # * new: Retrieve Gauge Color
- #--------------------------------------------------------------------------
- def get_infamy_mode_text_color(actor, infamy_weight)
- counter = infamy_weight.size
- size = counter - 1
- while counter > 0
- if $game_actors[actor.id].infamy.to_f >= infamy_weight[size]
- return size
- end
- counter = counter - 1
- size = size - 1
- end
- if $game_actors[actor.id].infamy.to_f <= infamy_weight[0]
- return 0
- end
- end
- #--------------------------------------------------------------------------
- # *new: Infamy Mode Text
- #--------------------------------------------------------------------------
- def draw_infamy_mode_text(x, y, size)
- buffer = 96 - (5 * INFAMY_MODES[size].size)
- contents.font.size -= 12
- change_color(text_color(INFAMY_MODE_NAME_COLORS[size]))
- draw_text(x + buffer, y + 80, width, line_height, INFAMY_MODES[size])
- normal_color
- contents.font.size += 12
- end
- #--------------------------------------------------------------------------
- # * new: Draw Infamy Icons
- # enabled : Enabled flag. When false, draw semi-transparently.
- #--------------------------------------------------------------------------
- def draw_infamy_icons(actor, x, y)
- draw_icon(INFAMY_MODES_ICONS[get_infamy_mode_text_color(actor, INFAMY_MODE_WEIGHTS)], x + 75, y, enabled = true)
- end
- #============================================================================
- end
- #==============================================================================
- # ** Game_Actor
- #------------------------------------------------------------------------------
- # This class handles actors. It is used within the Game_Actors class
- # ($game_actors) and is also referenced from the Game_Party class ($game_party).
- #==============================================================================
- class Game_Actor < Game_Battler
- #============================================================================
- #--------------------------------------------------------------------------
- # * Public Instance Variables
- #--------------------------------------------------------------------------
- attr_accessor :infamy
- #--------------------------------------------------------------------------
- # alias: Actor Setup
- #--------------------------------------------------------------------------
- alias jlt_game_actor_setup_infamy_jksef6734 setup
- def setup(actor_id)
- @infamy = 0
- @pre_infamy = $data_actors[actor_id].note[/<Initial_Infamy:*\s*(\W\d+)>/im]
- if $1 && $1 != ""; @infamy = $1.to_i; end
- jlt_game_actor_setup_infamy_jksef6734(actor_id)
- end
- #============================================================================
- end
- #==============================================================================
- # ** Window_Status
- #------------------------------------------------------------------------------
- # This window displays full status specs on the status screen.
- #==============================================================================
- class Window_Status < Window_Selectable
- #============================================================================
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- alias jlt_window_status_refresh_infamy_gauge_njfs76 refresh
- def refresh
- jlt_window_status_refresh_infamy_gauge_njfs76
- draw_infamy_bar(@actor, x + 8, y + 49)
- end
- #--------------------------------------------------------------------------
- # * new: Draw Infamy Info
- #--------------------------------------------------------------------------
- def draw_infamy_bar(actor, x, y)
- gauge_rate = infamy_value(actor, MAX_INFAMY)
- width = 96
- height = 10
- draw_infamy_gauge(x, y + 70, width, height, gauge_rate, text_color(get_infamy_gauge_color(x, y, actor, INFAMY_MODE_WEIGHTS, INFAMY_MODE_COLORS, "left")), text_color(get_infamy_gauge_color(x, y, actor, INFAMY_MODE_WEIGHTS, INFAMY_MODE_COLORS, "right")))
- make_font_smaller
- change_color(text_color(INFAMY_TEXT_COLOR))
- draw_text(x + 1, y + 75, width, line_height, VOCAB_INFAMY)
- normal_color
- make_font_bigger
- if SHOW_MODE_TEXT
- draw_infamy_mode_text(x, y, get_infamy_mode_text_color(actor, INFAMY_MODE_WEIGHTS))
- end
- if SHOW_MODE_ICONS
- draw_infamy_icons(actor, x, y)
- end
- if SHOW_LARGE_MAX_INFAMY_TEXT && infamy_value(actor, MAX_INFAMY) == 1
- word_buffer = 96 - INFAMY_MODES[INFAMY_MODES.size - 1].size * 14.5
- make_font_bigger
- change_color(text_color(MAX_INFAMY_TEXT_COLOR))
- draw_text(x + word_buffer, y + 45, width, line_height * 2, INFAMY_MODES[INFAMY_MODES.size - 1])
- make_font_smaller
- end
- end
- #--------------------------------------------------------------------------
- # * new: Draw Infamy Gauge
- #--------------------------------------------------------------------------
- def draw_infamy_gauge(x, y, width, height, rate, color1, color2)
- fill_w = (width * rate).to_i
- gauge_y = y + line_height - 8
- contents.fill_rect(x, gauge_y, width, height, gauge_back_color)
- contents.gradient_fill_rect(x + 1, gauge_y + 1, fill_w-2, height-2, color1, color2)
- end
- #--------------------------------------------------------------------------
- # * new: Retrieve Infamy
- #--------------------------------------------------------------------------
- def infamy_value(actor, max_infamy)
- infamous_value = $game_actors[actor.id].infamy.to_f / max_infamy
- if infamous_value > 1
- infamous_value = 1
- end
- if infamous_value < 0
- infamous_value = 0
- end
- return infamous_value
- end
- #--------------------------------------------------------------------------
- # * new: Retrieve Gauge Color
- #--------------------------------------------------------------------------
- def get_infamy_gauge_color(x, y, actor, infamy_weight, infamy_mode_colors, left_or_right)
- counter = infamy_weight.size
- size = counter - 1
- while counter > 0
- if $game_actors[actor.id].infamy.to_f >= infamy_weight[size]
- draw_infamy_mode_text(x, y, size)
- size = size * 2
- if left_or_right == "right"
- size = size + 1
- end
- return infamy_mode_colors[size]
- end
- counter = counter - 1
- size = size - 1
- end
- if $game_actors[actor.id].infamy.to_f <= infamy_weight[0]
- draw_infamy_mode_text(x, y, 0)
- infamy_color_id = infamy_mode_colors[1]
- if left_or_right == "left"
- infamy_color_id = infamy_mode_colors[0]
- end
- end
- return infamy_color_id
- end
- #--------------------------------------------------------------------------
- # * new: Retrieve Gauge Color
- #--------------------------------------------------------------------------
- def get_infamy_mode_text_color(actor, infamy_weight)
- counter = infamy_weight.size
- size = counter - 1
- while counter > 0
- if $game_actors[actor.id].infamy.to_f >= infamy_weight[size]
- return size
- end
- counter = counter - 1
- size = size - 1
- end
- if $game_actors[actor.id].infamy.to_f <= infamy_weight[0]
- return 0
- end
- end
- #--------------------------------------------------------------------------
- # *new: Infamy Mode Text
- #--------------------------------------------------------------------------
- def draw_infamy_mode_text(x, y, size)
- buffer = 96 - (5 * INFAMY_MODES[size].size)
- contents.font.size -= 12
- change_color(text_color(INFAMY_MODE_NAME_COLORS[size]))
- draw_text(x + buffer, y + 80, width, line_height, INFAMY_MODES[size])
- normal_color
- contents.font.size += 12
- end
- #--------------------------------------------------------------------------
- # * new: Draw Infamy Icons
- # enabled : Enabled flag. When false, draw semi-transparently.
- #--------------------------------------------------------------------------
- def draw_infamy_icons(actor, x, y)
- draw_icon(INFAMY_MODES_ICONS[get_infamy_mode_text_color(actor, INFAMY_MODE_WEIGHTS)], x + 75, y, enabled = true)
- end
- #============================================================================
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement