Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Zorothegallade's Earthbound-like PSI menu.
- #HOW TO USE
- #This script will make all of the actor's skills appear in the same menu regardless of category.
- #They will be separated into rows depending on their type.
- #Make sure the database is arranged so that skills of the same type are grouped together.
- #They will appear in the window in the same order they are in the database
- #This script is free for use for commercial and noncommercial use, as long as you give credit to the author (Zorothegallade or Ares Vaiarelli)
- module ZOROGALLADE_PSIMENU
- ##############START OF CONFIG##############
- HEADER_COLOR = Color.new(200,200,200, 255) #change the color of the header
- MAX_COLUMNS = 5 #maximum number of columns, aka max levels of a skill
- WHITELISTED_CHARACTERS = /[^αβγδΣ]/ #Only these characters from the skill name will appear in the menu
- ##############END OF CONFIG##############
- end
- class Window_SkillList < Window_Selectable
- attr_accessor :current_header
- def col_max
- return ZOROGALLADE_PSIMENU::MAX_COLUMNS
- end
- def draw_all_items
- item_max.times {|i| draw_item(i) }
- end
- def include?(item)
- true
- end
- def make_item_list
- @data = []
- current_type = nil
- i = 0
- @actor.skills.each do |skill|
- p i
- if current_type and current_type != skill.stype_id
- (col_max - i % col_max).times do
- @data.push(nil)
- i += 1
- end
- end
- current_type = skill.stype_id
- @data.push(skill)
- i += 1
- end
- end
- def item_rect(index)
- rect = Rect.new
- rect.width = item_width
- rect.height = item_height
- rect.x = 100 + index % col_max * (item_width + spacing)
- rect.y = index / col_max * item_height
- rect
- end
- def item_width
- (width - standard_padding * 2 + spacing - 100) / col_max - spacing
- end
- def draw_item(index)
- skill = @data[index]
- if skill
- rect = item_rect(index)
- rect.width -= 4
- draw_item_name(skill, rect.x, rect.y, enable?(skill))
- draw_skill_cost(rect, skill)
- if @current_header != skill.stype_id
- change_color (ZOROGALLADE_PSIMENU::HEADER_COLOR)
- draw_text(0, item_rect(index).y, 200, line_height, $data_system.skill_types[skill.stype_id],0)
- @current_header = skill.stype_id
- end
- end
- end
- def draw_item_name(item, x, y, enabled = true, width = 172)
- return unless item
- draw_icon(item.icon_index, x, y, enabled)
- change_color(normal_color, enabled)
- text = item.name
- text.gsub!(ZOROGALLADE_PSIMENU::WHITELISTED_CHARACTERS) { "" }
- draw_text(x + 24, y, width, line_height, item.name)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment