Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #=========================================================================
- # JLT Ace Actor Alignment System v1.00
- # Author: JLT (Jaxx L. Timing)
- # Version Date: 7/21/2013 (v1.00)
- #=========================================================================
- # Description:
- # This script enables you to assign your actors an "alignment" between
- # good and evil or however you choose to define it. You can set an initial
- # alignment as well as add or subtract from the alignment variable through
- # script calls.
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- # 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].alignment += number - to add points
- # $game_actors[actor_id].alignment -= number - to remove points
- #
- # - To set an actor's initial alignment enter <Initial_Align: number>
- # into the actor's notebox, all actors are neutral, or '0,' alignment by default.
- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- #~ ------------------------------------------------------------------------------------
- #~ ------------------------------------------------------------------------------------
- #~ ------------------------------------------------------------------------------------
- #~ ------------------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- # * Customize the appearence of the alignment bar below.
- #--------------------------------------------------------------------------
- #~ ------------------------------------------------------------------------------------
- #~ ------------------------------------------------------------------------------------
- #~ ------------------------------------------------------------------------------------
- #~ ------------------------------------------------------------------------------------
- module JLT_Alignment_Settings
- VOCAB_ALIGNMENT = "ALIGNMENT"
- ALIGNMENT_TEXT_COLOR = 0
- # Choose the term that is displayed next to the bar.
- # I wouldn't recommend making this term more than 9-10 characters long, it will squish the bar a lot.
- MAX = 100 # Change the upper and lower bounds of the bar.
- # For example, if you set this to 100, the lowest alignment will be -100 and the maximum will be 100.
- ALIGNMENT_LIST = ["Pure Evil", "Evil", "Bad", "Neutral", "Good", "Saint", "Divine"]
- ALIGNMENT_LIST_COLORS = [ 18, 10, 2, 8, 14, 6, 0]
- # The end slots of the array define what the alignment is if it exceeds your set maximum or minimum value.
- # What this means is that your actor will not become, for example, "Divine" or "Pure Evil" unless his alignment
- # goes above 100, if your MAX = 100, or dips below -100.
- # Add as many alignments as you like as long as there are an odd number.
- # List the colors you want each alignment text to be, make sure the positions in the arrays match.
- SLIDER_ICON = 529 # Choose icon to use as a slider over the bar.
- GAUGE_COLOR_1 = 8 # Choose left-most color on bar.
- GAUGE_COLOR_2 = 0 # Choose right-most color on bar.
- USE_LEFT_BOUND_ICON = true # To turn on the left boundary icon, set to true.
- LEFT_BOUND_ICON = 531 # Choose the icon for the left boundary of the bar.
- USE_RIGHT_BOUND_ICON = true # To turn on the right boundary icon, set to true.
- RIGHT_BOUND_ICON = 532 # Choose the icon for the right boundary of the bar.
- USE_INCREMENT_ICON = true # To turn on increment icons, set to true.
- INCREMENT_ICON = 530 # Choose the icon for the the incrememnts of the bar.
- end
- #~ ------------------------------------------------------------------------------------
- #~ ------------------------------------------------------------------------------------
- #~ ------------------------------------------------------------------------------------
- #~ ------------------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- # * End of customization settings, do not edit below here unless you know what you're doing.
- #--------------------------------------------------------------------------
- #~ ------------------------------------------------------------------------------------
- #~ ------------------------------------------------------------------------------------
- #~ ------------------------------------------------------------------------------------
- #~ ------------------------------------------------------------------------------------
- include JLT_Alignment_Settings
- class Window_MenuStatus
- #--------------------------------------------------------------------------
- # alias: Draw Simple Status
- #--------------------------------------------------------------------------
- alias jlt_draw_actor_simp_status_alignment_jksdgb draw_actor_simple_status
- def draw_actor_simple_status(actor, x, y)
- checker = 0
- gauge_length = MAX * 2
- gauge_segments = ALIGNMENT_LIST.size
- gauge_length_per_segment = gauge_length / gauge_segments
- slider_low_x = VOCAB_ALIGNMENT.size * 7.4 - 9
- slider_high_x = 101
- actual_gauge_length = slider_high_x - slider_low_x
- slider_init_x = (slider_high_x - slider_low_x) / 2
- super
- make_font_smaller
- change_color(text_color(ALIGNMENT_TEXT_COLOR), enabled = true)
- draw_text(x, y + line_height * 2.8, width, line_height, VOCAB_ALIGNMENT)
- normal_color
- var1 = $game_actors[actor.id].alignment
- slider_adjust = var1 * 2 * slider_init_x / (MAX * 2)
- draw_gauge(x + VOCAB_ALIGNMENT.size * 7.4, y + line_height * 2.45 + 2, 117 - (VOCAB_ALIGNMENT.size * 7.4), 1.0, text_color(GAUGE_COLOR_1), text_color(GAUGE_COLOR_2))
- draw_left_bound_icon(USE_LEFT_BOUND_ICON, LEFT_BOUND_ICON, x, slider_low_x, y, line_height)
- draw_right_bound_icon(USE_RIGHT_BOUND_ICON, RIGHT_BOUND_ICON, x, slider_high_x, y, line_height)
- draw_increment_icon(ALIGNMENT_LIST, USE_INCREMENT_ICON, INCREMENT_ICON, actual_gauge_length, slider_init_x, x, slider_low_x, y, line_height)
- draw_icon(SLIDER_ICON, x + slider_low_x + slider_init_x + draw_alignment_text(ALIGNMENT_LIST_COLORS, var1, MAX, slider_adjust, x, y, line_height, width, ALIGNMENT_LIST, gauge_length_per_segment, slider_init_x), y + line_height * 2.73 + 2)
- make_font_bigger
- jlt_draw_actor_simp_status_alignment_jksdgb(actor, x, y)
- end
- #--------------------------------------------------------------------------
- # new: Calculate Array_ID for any alignment not min, max, or middle
- #--------------------------------------------------------------------------
- def calc_alignment(var1, gauge_length_per_segment, max)
- array_id = 0
- segment_overflow_check = 1.5
- condition = segment_overflow_check + gauge_length_per_segment
- while condition < MAX
- condition = segment_overflow_check + gauge_length_per_segment
- segment_overflow_check = segment_overflow_check + gauge_length_per_segment
- if var1 >= segment_overflow_check
- array_id += 1
- end
- if var1 <= -segment_overflow_check
- array_id -= 1
- end
- end
- return array_id
- end
- #--------------------------------------------------------------------------
- # new: Draw left boundary icon
- #--------------------------------------------------------------------------
- def draw_left_bound_icon(use_left_bound, left_bound_icon, x, slider_low_x, y, line_height)
- if use_left_bound
- draw_icon(left_bound_icon, x + slider_low_x, y + line_height * 2.73 + 2)
- end
- return
- end
- #--------------------------------------------------------------------------
- # new: Draw right boundary icon
- #--------------------------------------------------------------------------
- def draw_right_bound_icon(use_right_bound, right_bound_icon, x, slider_high_x, y, line_height)
- if use_right_bound
- draw_icon(right_bound_icon, x + slider_high_x + 1, y + line_height * 2.73 + 2)
- end
- return
- end
- #--------------------------------------------------------------------------
- # new: Draw increment icons
- #--------------------------------------------------------------------------
- def draw_increment_icon(alignment_list, use_increment, increment_icon, actual_gauge_length, slider_init_x, x, slider_low_x, y, line_height)
- if use_increment
- draw_icon(increment_icon, x + slider_low_x + slider_init_x + 1, y + line_height * 2.73 + 2)
- number_of_increments = alignment_list.size / 2
- increment_multiplier = 1
- while number_of_increments > 0
- draw_icon(increment_icon, x + slider_low_x + slider_init_x + 1 + (increment_multiplier * (actual_gauge_length / (alignment_list.size - 1))), y + line_height * 2.73 + 2)
- draw_icon(increment_icon, x + slider_low_x + slider_init_x + 1 - (increment_multiplier * (actual_gauge_length / (alignment_list.size - 1))), y + line_height * 2.73 + 2)
- increment_multiplier = increment_multiplier + 1
- number_of_increments = number_of_increments - 2
- end
- end
- return
- end
- #--------------------------------------------------------------------------
- # new: Draw alignment text
- #--------------------------------------------------------------------------
- def draw_alignment_text(alignment_list_colors, var1, max, slider_adjust, x, y, line_height, width, alignment_list, gauge_length_per_segment, slider_init_x)
- checker = 0
- if var1 <= -max;
- slider_adjust = 0
- slider_adjust -= slider_init_x
- change_color(text_color(alignment_list_colors[0]), enabled = true)
- draw_text(x + 120, y + line_height * 2.8, width, line_height, alignment_list[0])
- normal_color
- return slider_adjust
- end
- if var1 >= MAX;
- slider_adjust = 0
- slider_adjust += slider_init_x
- change_color(text_color(alignment_list_colors[alignment_list.size - 1]), enabled = true)
- draw_text(x + 120, y + line_height * 2.8, width, line_height, alignment_list[alignment_list.size - 1])
- normal_color
- return slider_adjust
- end
- if var1 < gauge_length_per_segment && var1 > -gauge_length_per_segment
- change_color(text_color(alignment_list_colors[(alignment_list.size - 1) / 2]), enabled = true)
- draw_text(x + 120, y + line_height * 2.8, width, line_height, alignment_list[(alignment_list.size - 1) / 2])
- normal_color
- return slider_adjust
- end
- if checker == 0
- alignment_list_colors
- change_color(text_color(alignment_list_colors[((alignment_list.size - 1) / 2) + calc_alignment(var1, gauge_length_per_segment, max)]), enabled = true)
- draw_text(x + 120, y + line_height * 2.8, width, line_height, alignment_list[((alignment_list.size - 1) / 2) + calc_alignment(var1, gauge_length_per_segment, max)])
- normal_color
- return slider_adjust
- end
- 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 :alignment
- #--------------------------------------------------------------------------
- # alias: Setup
- #--------------------------------------------------------------------------
- alias jlt_game_actor_setup_66vfgbr setup
- def setup(actor_id)
- @alignment = 0
- @pre_align = $data_actors[actor_id].note[/<Initial_Align:*\s*(\W\d+)>/im]
- if $1 && $1 != ""; @alignment = $1.to_i; end
- jlt_game_actor_setup_66vfgbr(actor_id)
- end
- end
- #==============================================================================
- # ** Window_Status
- #------------------------------------------------------------------------------
- # This window displays full status specs on the status screen.
- #==============================================================================
- class Window_Status < Window_Selectable
- #--------------------------------------------------------------------------
- # alias: Draw Block 1
- #--------------------------------------------------------------------------
- alias jlt_draw_block1_add_alignment_8923hdvz refresh
- def refresh
- jlt_draw_block1_add_alignment_8923hdvz
- checker = 0
- gauge_length = MAX * 2
- gauge_segments = ALIGNMENT_LIST.size
- gauge_length_per_segment = gauge_length / gauge_segments
- slider_low_x = VOCAB_ALIGNMENT.size * 7.4 - 9
- slider_high_x = 101
- actual_gauge_length = slider_high_x - slider_low_x
- slider_init_x = (slider_high_x - slider_low_x) / 2
- make_font_smaller
- change_color(text_color(ALIGNMENT_TEXT_COLOR), enabled = true)
- draw_text(x, y + line_height, width, line_height, VOCAB_ALIGNMENT)
- normal_color
- var1 = $game_actors[@actor.id].alignment
- slider_adjust = var1 * 2 * slider_init_x / (MAX * 2)
- draw_gauge(x + VOCAB_ALIGNMENT.size * 7.4, y + line_height - 7, 117 - (VOCAB_ALIGNMENT.size * 7.4), 1.0, text_color(GAUGE_COLOR_1), text_color(GAUGE_COLOR_2))
- draw_left_bound_icon(USE_LEFT_BOUND_ICON, LEFT_BOUND_ICON, x, slider_low_x, y, line_height)
- draw_right_bound_icon(USE_RIGHT_BOUND_ICON, RIGHT_BOUND_ICON, x, slider_high_x, y, line_height)
- draw_increment_icon(ALIGNMENT_LIST, USE_INCREMENT_ICON, INCREMENT_ICON, actual_gauge_length, slider_init_x, x, slider_low_x, y, line_height)
- draw_icon(SLIDER_ICON, x + slider_low_x + slider_init_x + draw_alignment_text(ALIGNMENT_LIST_COLORS, var1, MAX, slider_adjust, x, y, line_height, width, ALIGNMENT_LIST, gauge_length_per_segment, slider_init_x), y + line_height)
- make_font_bigger
- end
- #--------------------------------------------------------------------------
- # new: Calculate Array_ID for any alignment not min, max, or middle
- #--------------------------------------------------------------------------
- def calc_alignment(var1, gauge_length_per_segment, max)
- array_id = 0
- segment_overflow_check = 1.5
- condition = segment_overflow_check + gauge_length_per_segment
- while condition < MAX
- condition = segment_overflow_check + gauge_length_per_segment
- segment_overflow_check = segment_overflow_check + gauge_length_per_segment
- if var1 >= segment_overflow_check
- array_id += 1
- end
- if var1 <= -segment_overflow_check
- array_id -= 1
- end
- end
- return array_id
- end
- #--------------------------------------------------------------------------
- # new: Draw left boundary icon
- #--------------------------------------------------------------------------
- def draw_left_bound_icon(use_left_bound, left_bound_icon, x, slider_low_x, y, line_height)
- if use_left_bound
- draw_icon(left_bound_icon, x + slider_low_x, y + line_height)
- end
- return
- end
- #--------------------------------------------------------------------------
- # new: Draw right boundary icon
- #--------------------------------------------------------------------------
- def draw_right_bound_icon(use_right_bound, right_bound_icon, x, slider_high_x, y, line_height)
- if use_right_bound
- draw_icon(right_bound_icon, x + slider_high_x + 1, y + line_height)
- end
- return
- end
- #--------------------------------------------------------------------------
- # new: Draw increment icons
- #--------------------------------------------------------------------------
- def draw_increment_icon(alignment_list, use_increment, increment_icon, actual_gauge_length, slider_init_x, x, slider_low_x, y, line_height)
- if use_increment
- draw_icon(increment_icon, x + slider_low_x + slider_init_x + 1, y + line_height)
- number_of_increments = alignment_list.size / 2
- increment_multiplier = 1
- while number_of_increments > 0
- draw_icon(increment_icon, x + slider_low_x + slider_init_x + 1 + (increment_multiplier * (actual_gauge_length / (alignment_list.size - 1))), y + line_height)
- draw_icon(increment_icon, x + slider_low_x + slider_init_x + 1 - (increment_multiplier * (actual_gauge_length / (alignment_list.size - 1))), y + line_height)
- increment_multiplier = increment_multiplier + 1
- number_of_increments = number_of_increments - 2
- end
- end
- return
- end
- #--------------------------------------------------------------------------
- # new: Draw alignment text
- #--------------------------------------------------------------------------
- def draw_alignment_text(alignment_list_colors, var1, max, slider_adjust, x, y, line_height, width, alignment_list, gauge_length_per_segment, slider_init_x)
- checker = 0
- if var1 <= -max;
- slider_adjust = 0
- slider_adjust -= slider_init_x
- change_color(text_color(alignment_list_colors[0]), enabled = true)
- draw_text(x + 120, y + line_height, width, line_height, alignment_list[0])
- normal_color
- return slider_adjust
- end
- if var1 >= MAX;
- slider_adjust = 0
- slider_adjust += slider_init_x
- change_color(text_color(alignment_list_colors[alignment_list.size - 1]), enabled = true)
- draw_text(x + 120, y + line_height, width, line_height, alignment_list[alignment_list.size - 1])
- normal_color
- return slider_adjust
- end
- if var1 < gauge_length_per_segment && var1 > -gauge_length_per_segment
- change_color(text_color(alignment_list_colors[(alignment_list.size - 1) / 2]), enabled = true)
- draw_text(x + 120, y + line_height, width, line_height, alignment_list[(alignment_list.size - 1) / 2])
- normal_color
- return slider_adjust
- end
- if checker == 0
- alignment_list_colors
- change_color(text_color(alignment_list_colors[((alignment_list.size - 1) / 2) + calc_alignment(var1, gauge_length_per_segment, max)]), enabled = true)
- draw_text(x + 120, y + line_height, width, line_height, alignment_list[((alignment_list.size - 1) / 2) + calc_alignment(var1, gauge_length_per_segment, max)])
- normal_color
- return slider_adjust
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement