Panel Equip SystemVersion: 1
By: CottonJ
Introduction
Sorry but the script is pretty large. and due to the fact that the script isn't tested to work without some of the scripts in the demo, I feel it unneccisary to post the script. I will try to post as many screenshots as I can to make up for it. Also... there is nudity in the demo..... but I doubt that'll matter. It's pixel nudity.
Features
<Post a bulleted list of features here. This section is optional.>
Screenshots


I would post more but I'm insanely sleepy right now... I got like no sleep workin on that last night and there are still bugs.
Demo
The Demo Contains the RTAB and a few add-ons (Made By Others),
Edits to the system, The Actual Panel Script, Actor Bags, Visual Equipment for Battlers, and a Debug System to help you figure out if an item hasn't been written in the database... so to speak.
http://www.zshare.net/download/71547602cff69959/
Script
Instructions
Edit the items in the tab labeled item database. x = blank panel. l = linkable panel, o = item panel.
LEVELUP = 1 (ID of the Level Up Item)
LEVELUPDOUBLER = 2 (ID of the Level Doubler Item)
LEVELUPTRIPLER = 3 (ID of the Level Tripler Item)
ASSISTITEMS = [1,2,3] (IDs of assist items) (LevelUps)
ASSISTARMORS = [1,2,3,4] (IDs of assist armors) (Weapon and Armor Links)
ABILITYVAR = 1 (ID of Ability changing armor)
$weapon_abilities[1] = [2,3,4] ...[Weapon ID] = [Skill IDs Learned from Ability Armors]
$armor_abilities[8] = [9] ...[Weapon ID] = [Skill IDs Learned from Ability Armors]
Visual Equipment
ARMOR[6] = "_outfit1" (ArmorID = armor name augment)
WEAPON[1] = "_weapon1" (WeaponID = armor name augment)
Compatibility
Made to work with te rtab and rpg maker xp
Credits and Thanks
Kain. Demonfire
Author's Notes
If there are any questions or comments... requests? here.
Terms and Conditions
---
By: CottonJ
Introduction
Sorry but the script is pretty large. and due to the fact that the script isn't tested to work without some of the scripts in the demo, I feel it unneccisary to post the script. I will try to post as many screenshots as I can to make up for it. Also... there is nudity in the demo..... but I doubt that'll matter. It's pixel nudity.
Features
<Post a bulleted list of features here. This section is optional.>
- Kingdom Hearts 358/2 Days Style Panelling System
- Equip Level Ups, instead of Leveling Up through experience (Gain a Level Up Item through experience.)
- Equip Weapon and Armor Attachments.
- Assign Items to specific actors.
- Learn Skills through Weapon Panels.
- "There is also more !!"
Screenshots


I would post more but I'm insanely sleepy right now... I got like no sleep workin on that last night and there are still bugs.
Demo
The Demo Contains the RTAB and a few add-ons (Made By Others),
Edits to the system, The Actual Panel Script, Actor Bags, Visual Equipment for Battlers, and a Debug System to help you figure out if an item hasn't been written in the database... so to speak.
http://www.zshare.net/download/71547602cff69959/
Script
Content Hidden
Spoiler
- #o = panel
- #l = link
- #x = space
- #+==============================================================================
- #
- #+------------------------------------------------------------------------------
- #
- #+------------------------------------------------------------------------------
- # Item Database
- #+------------------------------------------------------------------------------
- #
- #+------------------------------------------------------------------------------
- #
- #+==============================================================================
- #+==============================================================================
- # Module COTTONJJ
- #+------------------------------------------------------------------------------
- # Sets up Special Item IDs
- #+==============================================================================
- module COTTONJJ
- LEVELUP = 1 #Item ID of Level Up Item.
- LEVELUPDOUBLER = 2 #Item ID of Level Up Doubler
- LEVELUPTRIPLER = 3 #Item ID of Level Up Tripler
- ASSISTITEMS = [1,2,3] #ID Hash of Assist Item IDs (Level Ups)
- ASSISTARMORS = [1,2,3,4] #ID Hash of Assist Armor IDs (Weapon Accessories
- ABILITYVAR = 1 #ID of Ability Armor
- ITEMBAG = false #Set to true if actors are allowed individual bags.
- BLANKICON = "" #Name of Icon on Link Panels
- RTAB = false #Set true if using RTAB
- CUSTOMXY = false #Set true only if you want your battlers sideview.
- GAINLEVELITEM = false #Set true if actors gain level ups through exp.
- end
- #+==============================================================================
- # Global Panel Variables
- #+==============================================================================
- $panels = []
- $panels2 = []
- $panels3 = []
- $panels[0] = []
- $panels[1] = []
- $panels[2] = []
- $panels[3] = []
- $panels[4] = []
- $panels2[0] = []
- $panels2[1] = []
- $panels2[2] = []
- $panels2[3] = []
- $panels2[4] = []
- $panels3[0] = []
- $panels3[1] = []
- $panels3[2] = []
- $panels3[3] = []
- $panels3[4] = []
- $item_panels = []
- #+==============================================================================
- # Weapon Panels [1]
- #+------------------------------------------------------------------------------
- # [1] Devestation Blade
- #+==============================================================================
- #Panel Size, (Item Class), EquippedHash, (Item ID)
- $item_panels.push([[
- "o",
- "l",
- "l",
- "l"], "Weapon", [[-1,[]]], 1])
- #+==============================================================================
- # [2] Soul of the Blacksmith
- #+==============================================================================
- $item_panels.push([[
- "xxl",
- "lloll",
- "xxl"], "Weapon", [[-1,[]]], 2])
- #+==============================================================================
- # [3] 9mm Pistol
- #+==============================================================================
- $item_panels.push([[
- "ollll",
- "llxx",
- "lxxx",
- "xxxx"], "Weapon", [[-1,[]]], 3])
- #+==============================================================================
- # [4] Key Blade
- #+==============================================================================
- $item_panels.push([[
- "xl",
- "lol",
- "xl",
- "xl",
- "xl"], "Weapon", [[-1,[]]], 4])
- #+==============================================================================
- # Armor Panels [1]
- #+------------------------------------------------------------------------------
- # Panel Size, (Item Class), EquippedHash, (Item ID), LinkType1, [LinkType2]
- #+------------------------------------------------------------------------------
- # [1] Ability Chain
- #+==============================================================================
- $item_panels.push([[
- "oxxx",
- "xxxx",
- "xxxx",
- "xxxx"], "Armor", [[-1,[]]], 1, "WeaponLink", "Ability"])
- #+==============================================================================
- # [2] Power Chain
- #+==============================================================================
- $item_panels.push([[
- "oxxx",
- "xxxx",
- "xxxx",
- "xxxx"], "Armor", [[-1,[]]], 2, "WeaponLink", "AddStat", [[1,"atk"],[1,"str"]]])
- #+==============================================================================
- # [3] Defense Chain
- #+==============================================================================
- $item_panels.push([[
- "oxxx",
- "xxxx",
- "xxxx",
- "xxxx"], "Armor", [[-1,[]]], 3, "WeaponLink", "AddStat", [[1,"def"],[1,"mdef"]]])
- #+==============================================================================
- # [4] Speed Chain
- #+==============================================================================
- $item_panels.push([[
- "oxxx",
- "xxxx",
- "xxxx",
- "xxxx"], "Armor", [[-1,[]]], 4, "WeaponLink", "AddStat", [[1,"agi_plus"],[1,"dex_plus"]]])
- #+==============================================================================
- # [5] Lollipop Outfit
- #+==============================================================================
- $item_panels.push([[
- "oxxx",
- "xxxx",
- "xxxx",
- "xxxx"], "Armor", [[-1,[]]], 5])
- #+==============================================================================
- # [6] Basic Outfit
- #+==============================================================================
- $item_panels.push([[
- "olxx",
- "xxxx",
- "xxxx",
- "xxxx"], "Armor", [[-1,[]]], 6])
- #+==============================================================================
- # [7] Off Gucci Outfit
- #+==============================================================================
- $item_panels.push([[
- "oxxx",
- "lxxx",
- "xxxx",
- "xxxx"], "Armor", [[-1,[]]], 7])
- #+==============================================================================
- # [8] Wonder Woman Costume
- #+==============================================================================
- $item_panels.push([[
- "olxx",
- "lxxx",
- "xxxx",
- "xxxx"], "Armor", [[-1,[]]], 8])
- #+==============================================================================
- # Item Panels
- #+------------------------------------------------------------------------------
- # Panel Size, (Item Class), [EquippedHash], (Item ID), LinkType1, [LinkType2]
- #+------------------------------------------------------------------------------
- # [1] Level Up
- #+==============================================================================
- $item_panels.push([[
- "o"], "Item", [[-1,[]]], 1, "LevelUp"])
- #+==============================================================================
- # [2] Level Up Doubler
- #+==============================================================================
- $item_panels.push([[
- "xol",
- "ll"], "Item", [[-1,[]]], 2, "2x", "Level"])
- #+==============================================================================
- # [3] Level Up Tripler
- #+==============================================================================
- $item_panels.push([[
- "l",
- "ol",
- "xl"], "Item", [[-1,[]]], 3, "3x", "Level"])
- #+==============================================================================
- # [4] Revitalize
- #+==============================================================================
- $item_panels.push([[
- "o"], "Item", [[-1,[]]], 4])
- #+==============================================================================
- # Skill Panels
- #+------------------------------------------------------------------------------
- # Panel Size, (Item Class), [EquippedHash], (Item ID), LinkType1, [LinkType2]
- #+------------------------------------------------------------------------------
- # [1] Struggle
- #+==============================================================================
- #$item_panels.push([[
- #"o"], "Skill", [[-1,[]]], 1])
- #+==============================================================================
- # Weapon Abilities
- #+------------------------------------------------------------------------------
- # Weapon_ID = [SkillIDs]
- #+==============================================================================
- $weapon_abilities = []
- $weapon_abilities[1] = [2,3,4]
- $weapon_abilities[2] = [5,7,9]
- $armor_abilities = []
- #$armor_abilities[8] = [9]
- class Scene_Menu
- def update_status
- # If B button was pressed
- if Input.trigger?(Input::B)
- # Play cancel SE
- $game_system.se_play($data_system.cancel_se)
- # Make command window active
- @command_window.active = true
- @status_window.active = false
- @status_window.index = -1
- return
- end
- # If C button was pressed
- if Input.trigger?(Input::C)
- # Branch by command window cursor position
- case @command_window.index
- when 1 # skill
- # If this actor's action limit is 2 or more
- if $game_party.actors[@status_window.index].restriction >= 2
- # Play buzzer SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # Play decision SE
- $game_system.se_play($data_system.decision_se)
- # Switch to skill screen
- $scene = Scene_Skill.new(@status_window.index)
- when 2 # equipment
- # Play decision SE
- $game_system.se_play($data_system.decision_se)
- # Switch to equipment screen
- $scene = Scene_Panels.new(@status_window.index)
- when 3 # status
- # Play decision SE
- $game_system.se_play($data_system.decision_se)
- # Switch to status screen
- $scene = Scene_Status.new(@status_window.index)
- end
- return
- end
- end
- end
- class Scene_Panels
- attr_accessor :window_panels
- attr_accessor :window
- attr_accessor :window_itempanel
- def initialize(actor_index = 0, equip_index = 0)
- @actor_index = actor_index
- @equip_index = equip_index
- end
- def main
- @window = true
- @wait = 0
- @actor = $game_party.actors[@actor_index]
- draw_windows
- Graphics.transition
- loop do
- Input.update
- Graphics.update
- update
- break if $scene != self
- end
- Graphics.freeze
- dispose
- end
- def draw_windows
- @help_window = Window_Help.new
- @window_panels = Window_Panels.new(@actor)
- @window_panels.help_window = @help_window
- @window_equipped = Window_Equipped.new(@actor)
- @window_equipped.draw_oldpanels
- @window_itempanel = Window_ItemPanel.new
- @window_equipped.active = false
- @window_itempanel.active = false
- @window_category = Window_Category.new
- end
- def dispose
- @window_equipped.save_panels
- @help_window.dispose
- @window_panels.dispose
- @window_equipped.dispose
- @window_itempanel.dispose
- @window_category.dispose
- end
- def update
- if @wait > 0
- @wait -= 1
- return
- end
- @window_panels.update
- @help_window.update
- @window_equipped.update
- @window_itempanel.update
- @window_category.update
- @window_panels.index = 0 if @window_panels.index < 0
- if @window_panels.active == true
- @window_panels.update_help
- update_right
- elsif @window_equipped.active == true && @window_itempanel.active == true
- @window_panels.update_help("Place Panel(s)")
- #@window = true
- update_left
- elsif @window_equipped.active == true
- @window_panels.update_help("Pick Up Panel(s)")
- update_left_delete
- elsif @window_category.active == true
- @window_panels.update_help("Change Category")
- update_category
- end
- end
- def run_equip(equip,id)
- return @actor.run_equip(equip,id)
- end
- def update_category
- @window_panels.refresh(@window_category.index)
- if Input.trigger?(Input::DOWN)
- $game_system.se_play($data_system.cursor_se)
- @window_panels.index = 0
- @window_panels.active = true
- @window_equipped.active = false
- @window_category.active = false
- end
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- # Switch to menu screen
- $scene = Scene_Menu.new(2)
- return
- end
- end
- def update_to_category
- @window_panels.active = false
- @window_equipped.active = false
- #@window_equipped.active = false
- @window_category.active = true
- return
- end
- def update_left(window = @window)
- @window_itempanel.refresh(@window_equipped.index)
- if Input.trigger?(Input::C)
- if window == true
- @item = get_item(@window_panels.index)
- else
- @item = @window_itempanel.item
- end
- if @item != false
- if @item[4] == nil
- if can_be_placed?(@item, @window_equipped.index)
- if @item[1] == "Weapon"
- #if @actor.weapon != nil and @actor.weapon.weapon_accessories.empty?
- if @actor.weapon_id < 1
- panel_weapon
- @jj = nil
- return
- end
- #end
- elsif @item[1] == "Item"
- panel_weapon
- @jj = nil
- return
- else
- if window == true
- m = @window_panels.item
- else
- #print(get_item3(@window_itempanel.item))
- m = get_item3(@window_itempanel.item)
- end
- if window == true
- @item = get_item(@window_panels.index)
- else
- @item = @window_itempanel.item
- #print(@item)
- end
- if @item[1] == "Armor"
- if @item[4] == nil
- m = $data_armors[@item[3]].kind
- case m
- when 0
- if @actor.armor1_id < 1
- panel_weapon
- @jj = nil
- return
- end
- when 1
- if @actor.armor2_id < 1
- panel_weapon
- @jj = nil
- return
- end
- when 2
- if @actor.armor3_id < 1
- panel_weapon
- @jj = nil
- return
- end
- when 3
- if @actor.armor4_id < 1
- panel_weapon
- @jj = nil
- return
- end
- end
- end
- else
- #print("a")
- end
- end
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- else
- case @item[4]
- when "WeaponLink"
- if can_be_placed?(@item, @window_equipped.index, "Weapon")
- panel_weaponlink
- @jj = nil
- return
- end
- when "LevelUp"
- o = can_be_placed?(@item, @window_equipped.index, true)
- if o.is_a?(Array)
- if o[0] == true
- panel_levellink(o)
- @jj = nil
- return
- end
- elsif can_be_placed?(@item, @window_equipped.index)
- panel_level
- @jj = nil
- return
- end
- when "2x"
- if can_be_placed?(@item, @window_equipped.index)
- panel_doubler
- @jj = nil
- return
- end
- when "3x"
- if can_be_placed?(@item, @window_equipped.index)
- panel_tripler
- @jj = nil
- return
- end
- end
- end
- end
- $game_system.se_play($data_system.buzzer_se)
- @item = false
- end
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- @window_itempanel.clear_panels
- #@window_panels.index = @window_panels.index - 1
- #@window_panels.index = 0 if @window_panels.index == -1
- @window_panels.refresh(@window_category.index)
- @window_panels.active = true
- @window_equipped.active = false
- @window_itempanel.active = false
- @item = false
- return
- end
- end
- def update_return_right(index)
- $game_system.se_play($data_system.cancel_se)
- @window_itempanel.clear_panels
- @window_panels.active = true
- @window_equipped.active = false
- if index / 9 > (@window_panels.data.size - 1)
- @window_panels.index = (@window_panels.data.size - 1)
- if @window_panels.index < 0
- @window_panels.index = 0
- end
- else
- @window_panels.index = (index / 9) - 2
- if @window_panels.index < 0
- @window_panels.index = 0
- end
- end
- @window_panels.refresh(@window_category.index)
- @window_itempanel.active = false
- @item = false
- return
- end
- def unequip(item,equip_type = 0,link_panel = nil)
- case item
- when RPG::Item
- @actor.bag.remove(item)
- when RPG::Skill
- pr = "Skill"
- else
- if equip_type == 4
- g = get_item2(item)
- if g[4] == "WeaponLink"
- if link_panel.is_a?(RPG::Weapon)
- @actor.unequip_weaponaccessory(item)
- elsif link_panel.is_a?(RPG::Armor)
- @actor.unequip_armoraccessory(link_panel.kind,item)
- end
- if g[5] == "Ability"
- if link_panel.is_a?(RPG::Weapon)
- a = @actor.weapon.weapon_accessories.dup
- v = @actor.weapon.weapon_accessories.size
- o = 0
- for i in 0...v
- if a[i].id == COTTONJJ::ABILITYVAR
- o += 1
- end
- end
- @actor.forget_skill($weapon_abilities[@actor.weapon_id][o])
- elsif link_panel.is_a?(RPG::Armor)
- case link_panel.kind
- when 0
- g = @actor.armor1_id
- when 1
- g = @actor.armor2_id
- when 2
- g = @actor.armor3_id
- when 3
- g = @actor.armor4_id
- end
- a = @actor.armors[link_panel.kind].armor_accessories.dup
- v = @actor.armors[link_panel.kind].armor_accessories.size
- o = 0
- for i in 0...v
- if a[i].id == COTTONJJ::ABILITYVAR
- o += 1
- end
- end
- @actor.forget_skill($armor_abilities[g][o])
- end
- elsif g[5] == "AddStat"
- if link_panel.is_a?(RPG::Weapon)
- for i in 0...@item[6].size
- case @item[6][i][1]
- when "name"
- $data_weapons[@actor.weapon_id].name = @item[6][i][2]
- when "icon_name"
- $data_weapons[@actor.weapon_id].icon_name = @item[6][i][2]
- when "description"
- $data_weapons[@actor.weapon_id].description = @item[6][i][2]
- when "animation1_id"
- $data_weapons[@actor.weapon_id].animation1_id = @item[6][i][2]
- when "animation2_id"
- $data_weapons[@actor.weapon_id].animation2_id = @item[6][i][2]
- when "atk"
- $data_weapons[@actor.weapon_id].atk -= @item[6][i][0]
- when "def"
- $data_weapons[@actor.weapon_id].pdef -= @item[6][i][0]
- when "mdef"
- $data_weapons[@actor.weapon_id].mdef -= @item[6][i][0]
- when "str"
- $data_weapons[@actor.weapon_id].str_plus -= @item[6][i][0]
- when "dex_plus"
- $data_weapons[@actor.weapon_id].dex_plus -= @item[6][i][0]
- when "agi_plus"
- $data_weapons[@actor.weapon_id].agi_plus -= @item[6][i][0]
- when "int_plus"
- $data_weapons[@actor.weapon_id].int_plus -= @item[6][i][0]
- when "element_set"
- $data_weapons[@actor.weapon_id].element_set.delete(@item[6][i][0])
- when "plus_state_set"
- $data_weapons[@actor.weapon_id].plus_state_set.delete(@item[6][i][0])
- when "minus_state_set"
- $data_weapons[@actor.weapon_id].minus_state_set.delete(@item[6][i][0])
- end
- end
- elsif link_panel.is_a?(RPG::Armor)
- case link_panel.kind
- when 0
- g = @actor.armor1_id
- when 1
- g = @actor.armor2_id
- when 2
- g = @actor.armor3_id
- when 3
- g = @actor.armor4_id
- end
- for i in 0...@item[6].size
- case @item[6][i][1]
- when "name"
- $data_armors[g].name = @item[6][i][2]
- when "icon_name"
- $data_armors[g].icon_name = @item[6][i][2]
- when "description"
- $data_armors[g].description = @item[6][i][2]
- when "kind"
- $data_armors[g].kind = @item[6][i][2]
- when "auto_state_id"
- $data_armors[g].auto_state_id = @item[6][i][2]
- when "def"
- $data_armors[g].pdef -= @item[6][i][0]
- when "mdef"
- $data_armors[g].mdef -= @item[6][i][0]
- when "str"
- $data_armors[g].str_plus -= @item[6][i][0]
- when "dex_plus"
- $data_armors[g].dex_plus -= @item[6][i][0]
- when "agi_plus"
- $data_armors[g].agi_plus -= @item[6][i][0]
- when "int_plus"
- $data_armors[g].int_plus -= @item[6][i][0]
- when "element_set"
- $data_armors[g].element_set.remove(@item[6][i][0])
- when "plus_state_set"
- $data_armors[g].plus_state_set.remove(@item[6][i][0])
- when "minus_state_set"
- $data_armors[g].minus_state_set.remove(@item[6][i][0])
- end
- end
- end
- end
- end
- else
- @actor.equip(equip_type, 0)
- end
- end
- end
- def update_left_delete
- if Input.trigger?(Input::C)
- if @window_equipped.data[@window_equipped.index] != nil
- if not @window_equipped.data[@window_equipped.index].is_a?(Array)
- $game_system.se_play($data_system.cancel_se)
- @item = get_itemequipped(@window_equipped.index)
- @item2 = @window_equipped.item
- if @item2.is_a?(RPG::Weapon)
- if @actor.weapon != nil
- if @actor.weapon.weapon_accessories != nil
- if @actor.weapon.weapon_accessories.empty? == false
- @window_panels.help_window.set_text("The weapon is occupied.")
- @wait = 25
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- end
- end
- end
- if @item[2].include?([@actor.id,@window_equipped.index])
- @item[2].delete([@actor.id,@window_equipped.index])
- end
- g = 0
- if @item2.is_a?(RPG::Armor)
- g = @item2.kind + 1
- if COTTONJJ::ASSISTARMORS.include?(@item2.id)
- if @actor.weapon != nil
- if @actor.weapon.weapon_accessories != nil
- #if @actor.weapon.weapon_accessories.empty? == false
- l = @actor.weapon
- #end
- end
- end
- end
- end
- unequip(@item2,g,l)
- @window_itempanel.draw_panels(@item,@window_equipped.index,@window_equipped.item)
- @window_itempanel.refresh(@window_equipped.index)
- @window_equipped.clear_panel(@item,@window_equipped.index,@item2)
- @window_panels.refresh(@window_category.index)
- @window_itempanel.active = true
- @window = false
- return
- end
- end
- $game_system.se_play($data_system.buzzer_se)
- end
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- # Switch to menu screen
- $scene = Scene_Menu.new(2)
- return
- end
- end
- def update_right
- if @window_panels.index < 0 or @window_panels.data[@window_panels.index] == nil
- update_to_category
- end
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- # Switch to menu screen
- $scene = Scene_Menu.new(2)
- return
- end
- if Input.trigger?(Input::C)
- @item = get_item(@window_panels.index)
- if @item != false
- $game_system.se_play($data_system.decision_se)
- @window_panels.active = false
- @window_equipped.active = true
- @window_itempanel.draw_panels(@item,@window_equipped.index,@window_panels.item)
- @window_itempanel.active = true
- @window = true
- return
- end
- $game_system.se_play($data_system.buzzer_se)
- end
- if Input.trigger?(Input::LEFT)
- $game_system.se_play($data_system.cancel_se)
- @window_panels.active = false
- @window_equipped.active = true
- @window = false
- a = @window_panels.index
- @window_equipped.index = ((a * 9) + 8) + (9*2)
- end
- end
- end
- class Scene_Panels
- def panel_weapon
- @item[2].push([@actor.id,@window_equipped.index])
- if @window == true
- m = @window_panels.item
- else
- m = get_item3(@window_itempanel.item)
- end
- @window_equipped.set_panel(@item,@window_equipped.index,m)
- @window_itempanel.clear_panels
- #item = @window_panels.item
- if @window == true
- item = @window_panels.item
- else
- item = get_item3(@window_itempanel.item)
- end
- $game_system.se_play($data_system.equip_se)
- if item.is_a?(RPG::Weapon)
- @actor.equip(0, item.id)
- end
- if item.is_a?(RPG::Armor)
- item_type = item.kind + 1
- @actor.equip(item_type, item.id)
- end
- if item.is_a?(RPG::Item)
- @actor.equip_item(item.id)
- end
- @window_panels.refresh(@window_category.index)
- @window_panels.active = true
- @window_equipped.active = false
- @window_itempanel.active = false
- if @window_panels.index == -1
- @window_panels.index = 0
- end
- if @window_panels.index > @window_panels.data.size
- @window_panels.index = @window_panels.data.size
- end
- @window_panels.refresh(@window_category.index)
- @window_panels.index -= 1 if @window_panels.item == nil
- end
- def panel_weaponlink
- @item[2].push([@actor.id,@window_equipped.index])
- g = @window_equipped.item[1]
- k = @window_equipped.item[6]
- #print(@window_equipped.item[6])
- @window_equipped.set_panel(@item,@window_equipped.index,@window_panels.item,true,k)
- @window_itempanel.clear_panels
- item = @window_panels.item
- $game_system.se_play($data_system.equip_se)
- if item.is_a?(RPG::Armor)
- if k.is_a?(RPG::Weapon)
- @actor.equip_weaponaccessory(item)
- elsif k.is_a?(RPG::Armor)
- @actor.equip_armoraccessory($data_armors[g].kind,item)
- end
- end
- case @item[5]
- when "Ability"
- #Learn Skill based on Panel
- if k.is_a?(RPG::Weapon)
- a = @actor.weapon.weapon_accessories.dup
- v = @actor.weapon.weapon_accessories.size
- o = 0
- for i in 0...v
- if a[i].id == COTTONJJ::ABILITYVAR
- o += 1
- end
- end
- if $weapon_abilities[@actor.weapon_id] != nil
- if $weapon_abilities[@actor.weapon_id][o-1] != nil
- @actor.learn_skill($weapon_abilities[@actor.weapon_id][o-1])
- end
- end
- elsif k.is_a?(RPG::Armor)
- kind = k.kind#@var_kind if @var_kind != nil #@window_equipped.item.kind
- a = @actor.armors[kind].armor_accessories.dup
- v = @actor.armors[kind].armor_accessories.size
- o = 0
- for i in 0...v
- if a[i].id == COTTONJJ::ABILITYVAR
- o += 1
- end
- end
- case kind
- when 0
- g = @actor.armor1_id
- when 1
- g = @actor.armor2_id
- when 2
- g = @actor.armor3_id
- when 3
- g = @actor.armor4_id
- end
- if $armor_abilities[g] != nil
- if $armor_abilities[g][o-1] != nil
- @actor.learn_skill($armor_abilities[g][o-1])
- end
- end
- @var_kind = nil
- else
- if @window_panels.index == -1
- @window_panels.index = 0
- end
- if @window_panels.index > @window_panels.data.size
- @window_panels.index = @window_panels.data.size
- end
- @window_panels.refresh(@window_category.index)
- @window_panels.index -= 1 if @window_panels.item == nil
- @window_panels.active = true
- @window_equipped.active = false
- @window_itempanel.active = false
- return
- end
- when "AddStat"
- if k.is_a?(RPG::Weapon)
- #Learn Skill based on Panel
- for i in 0...@item[6].size
- case @item[6][i][1]
- when "name"
- $data_weapons[@actor.weapon_id].name = @item[6][i][0]
- when "icon_name"
- $data_weapons[@actor.weapon_id].icon_name = @item[6][i][0]
- when "description"
- $data_weapons[@actor.weapon_id].description = @item[6][i][0]
- when "animation1_id"
- $data_weapons[@actor.weapon_id].animation1_id = @item[6][i][0]
- when "animation2_id"
- $data_weapons[@actor.weapon_id].animation2_id = @item[6][i][0]
- when "atk"
- $data_weapons[@actor.weapon_id].atk += @item[6][i][0]
- when "def"
- $data_weapons[@actor.weapon_id].pdef += @item[6][i][0]
- when "mdef"
- $data_weapons[@actor.weapon_id].mdef += @item[6][i][0]
- when "str"
- $data_weapons[@actor.weapon_id].str_plus += @item[6][i][0]
- when "dex_plus"
- $data_weapons[@actor.weapon_id].dex_plus += @item[6][i][0]
- when "agi_plus"
- $data_weapons[@actor.weapon_id].agi_plus += @item[6][i][0]
- when "int_plus"
- $data_weapons[@actor.weapon_id].int_plus += @item[6][i][0]
- when "element_set"
- $data_weapons[@actor.weapon_id].element_set.push(@item[6][i][0])
- when "plus_state_set"
- $data_weapons[@actor.weapon_id].plus_state_set.push(@item[6][i][0])
- when "minus_state_set"
- $data_weapons[@actor.weapon_id].minus_state_set.push(@item[6][i][0])
- end
- end
- elsif k.is_a?(RPG::Armor)
- kind = @var_kind if @var_kind != nil
- case kind
- when 0
- g = @actor.armor1_id
- when 1
- g = @actor.armor2_id
- when 2
- g = @actor.armor3_id
- when 3
- g = @actor.armor4_id
- end
- for i in 0...@item[6].size
- case @item[6][i][1]
- when "name"
- $data_armors[g].name = @item[6][i][0]
- when "icon_name"
- $data_armors[g].icon_name = @item[6][i][0]
- when "description"
- $data_armors[g].description = @item[6][i][0]
- when "kind"
- $data_armors[g].kind = @item[6][i][0]
- when "auto_state_id"
- $data_armors[g].auto_state_id = @item[6][i][0]
- when "def"
- $data_armors[g].pdef += @item[6][i][0]
- when "mdef"
- $data_armors[g].mdef += @item[6][i][0]
- when "str"
- $data_armors[g].str_plus += @item[6][i][0]
- when "dex_plus"
- $data_armors[g].dex_plus += @item[6][i][0]
- when "agi_plus"
- $data_armors[g].agi_plus += @item[6][i][0]
- when "int_plus"
- $data_armors[g].int_plus += @item[6][i][0]
- when "element_set"
- $data_armors[g].guard_element_set.push(@item[6][i][0])
- when "plus_state_set"
- $data_armors[g].guard_state_set.push(@item[6][i][0])
- when "minus_state_set"
- $data_armors[g].guard_state_set.remove(@item[6][i][0])
- end
- end
- @var_kind = nil
- else
- if @window_panels.index == -1
- @window_panels.index = 0
- end
- if @window_panels.index > @window_panels.data.size
- @window_panels.index = @window_panels.data.size
- end
- @window_panels.refresh(@window_category.index)
- @window_panels.index -= 1 if @window_panels.item == nil
- @window_panels.active = true
- @window_equipped.active = false
- @window_itempanel.active = false
- return
- end
- end
- if @window_panels.index == -1
- @window_panels.index = 0
- end
- if @window_panels.index > @window_panels.data.size
- @window_panels.index = @window_panels.data.size
- end
- @window_panels.refresh(@window_category.index)
- @window_panels.index -= 1 if @window_panels.item == nil
- @window_panels.active = true
- @window_equipped.active = false
- @window_itempanel.active = false
- end
- def panel_levellink(o)
- k = @window_equipped.data[@window_equipped.index]
- @item[2].push([@actor.id,@window_equipped.index])
- @window_equipped.set_panel(@item,@window_equipped.index,@window_panels.item,true)
- @window_itempanel.clear_panels
- item = @window_panels.item
- $game_system.se_play($data_system.equip_se)
- if item.is_a?(RPG::Item)
- a = @actor.level
- case k[3]
- when "2x"
- @actor.level = @actor.level + 2
- when "3x"
- @actor.level = @actor.level + 3
- else
- @actor.level = @actor.level + 1
- end
- $game_party.lose_item(COTTONJJ::LEVELUP,1)
- end
- if @window_panels.index == -1
- @window_panels.index = 0
- end
- if @window_panels.index > @window_panels.data.size
- @window_panels.index = @window_panels.data.size
- end
- @window_panels.refresh(@window_category.index)
- @window_panels.index -= 1 if @window_panels.item == nil
- @window_panels.active = true
- @window_equipped.active = false
- @window_itempanel.active = false
- end
- def panel_level
- @item[2].push([@actor.id,@window_equipped.index])
- @window_equipped.set_panel(@item,@window_equipped.index,@window_panels.item)
- @window_itempanel.clear_panels
- item = @window_panels.item
- $game_system.se_play($data_system.equip_se)
- if item.is_a?(RPG::Item)
- a = @actor.level
- @actor.level = @actor.level + 1
- $game_party.lose_item(COTTONJJ::LEVELUP,1)
- end
- if @window_panels.index == -1
- @window_panels.index = 0
- end
- if @window_panels.index > @window_panels.data.size
- @window_panels.index = @window_panels.data.size
- end
- @window_panels.refresh(@window_category.index)
- @window_panels.index -= 1 if @window_panels.item == nil
- @window_panels.active = true
- @window_equipped.active = false
- @window_itempanel.active = false
- end
- def panel_doubler
- @item[2].push([@actor.id,@window_equipped.index])
- @window_equipped.set_panel(@item,@window_equipped.index,@window_panels.item)
- @window_itempanel.clear_panels
- item = @window_panels.item
- $game_system.se_play($data_system.equip_se)
- if item.is_a?(RPG::Item)
- a = @actor.level
- $game_party.lose_item(COTTONJJ::LEVELUPDOUBLER,1)
- end
- if @window_panels.index == -1
- @window_panels.index = 0
- end
- if @window_panels.index > @window_panels.data.size
- @window_panels.index = @window_panels.data.size
- end
- @window_panels.refresh(@window_category.index)
- @window_panels.index -= 1 if @window_panels.item == nil
- @window_panels.active = true
- @window_equipped.active = false
- @window_itempanel.active = false
- end
- def panel_tripler
- @item[2].push([@actor.id,@window_equipped.index])
- @window_equipped.set_panel(@item,@window_equipped.index,@window_panels.item)
- @window_itempanel.clear_panels
- item = @window_panels.item
- $game_system.se_play($data_system.equip_se)
- if item.is_a?(RPG::Item)
- a = @actor.level
- $game_party.lose_item(COTTONJJ::LEVELUPTRIPLER,1)
- end
- if @window_panels.index == -1
- @window_panels.index = 0
- end
- if @window_panels.index > @window_panels.data.size
- @window_panels.index = @window_panels.data.size
- end
- @window_panels.refresh(@window_category.index)
- @window_panels.index -= 1 if @window_panels.item == nil
- @window_panels.active = true
- @window_equipped.active = false
- @window_itempanel.active = false
- end
- def can_be_placed?(item, index, link = false)
- size = []
- #if not item[2].include?(@actor.id)
- #if not item[2].include?(index)
- #size.push(index)
- #Determine string settings
- for k in 0...item[0].size
- string = item[0][k]
- for i in 0...string.size
- string += string.slice(0,1)
- case string.slice!(0,1)
- when "x"
- else
- size.push(index + i + (k*9))
- end
- end
- end
- if size.size > 1
- for i in 0...size.size
- if size[i] > 108
- return false
- end
- for k in 0...size.size
- if (size[i] % 9) == 8
- if (size[k] % 9) == 0
- return false
- end
- end
- end
- end
- end
- equip = 0 if link == false
- if link != false
- equip = 0 if link == "Weapon"
- equip = 1 if link == "Shield"
- equip = 2 if link == "Head"
- equip = 3 if link == "Body"
- equip = 4 if link == "Accessory"
- end
- @size = size
- @link = link
- @plink = item
- @glink = index
- loop do
- size = @size
- link = @link
- Graphics.update
- Input.update
- if @window_equipped.item.is_a?(Array)
- item = run_equip(equip,@window_equipped.item[1])
- if @window_equipped.item[0] == "Link"
- if @plink[4] == "LevelUp"
- if @window_equipped.item[2] == "Level"
- return [true,@plink[4]]
- end
- end
- if @link != false
- if @window_equipped.item[2] == nil
- if get_item3(item).is_a?(RPG::Weapon)
- if $weapon_abilities[@window_equipped.item[1]] != nil
- case @window_itempanel.item[5]
- when "Ability"
- if @actor.weapon.weapon_accessories == nil
- @actor.weapon.weapon_accessories = []
- end
- a = @actor.weapon.weapon_accessories.dup
- v = @actor.weapon.weapon_accessories.size
- o = 0
- for i in 0...v
- if a[i].id == COTTONJJ::ABILITYVAR
- o += 1
- end
- end
- if $weapon_abilities[@window_equipped.item[1]][o] != nil
- return true
- else
- end
- else
- return true
- end
- else
- case @window_itempanel.item[5]
- when "Ability"
- @window_panels.update_help("No More Available Abilities")
- @wait = 25
- return false
- else
- return true
- end
- end
- elsif get_item3(item).is_a?(RPG::Armor)
- if $armor_abilities[@window_equipped.item[1]] != nil
- case @window_itempanel.item[5]
- when "Ability"
- kind = get_item3(item).kind
- @var_kind = kind
- #print(kind)
- if @actor.armors[kind].armor_accessories == nil
- @actor.armors[kind].armor_accessories = []
- end
- a = @actor.armors[kind].armor_accessories.dup
- v = @actor.armors[kind].armor_accessories.size
- o = 0
- for i in 0...v
- if a[i].id == COTTONJJ::ABILITYVAR
- o += 1
- end
- end
- if $armor_abilities[@window_equipped.item[1]][o] != nil
- return true
- else
- end
- else
- return true
- end
- else
- case @window_itempanel.item[5]
- when "Ability"
- @window_panels.update_help("No More Available Abilities")
- @wait = 25
- return false
- else
- return true
- end
- end
- end
- @window_panels.update_help("No More Available Abilities")
- @wait = 25
- return false
- end
- end
- else
- if @link != false
- return false
- end
- end
- else
- if @link != false
- return false
- end
- end
- if @window_equipped.item.is_a?(RPG::Item)
- if get_itemequipped(@window_equipped.index) != nil
- return false
- end
- end
- equip = 0 if equip == nil
- item = run_equip(equip,@window_equipped.item.id)
- for k in 0...108
- size2 = []
- item = get_itemequipped(k)
- #item = @window_itempanel.item if item == false
- #item = [["oxxx","xxxx","xxxx","xxxx"],"x",["x","x",["x",k]]] if item == false
- if item != false
- #if item[2]
- for i in 0...item[2].size
- if item[2][i][0] == @actor.id
- index = item[2][i][1]
- end
- end
- for k in 0...item[0].size
- string = item[0][k]
- for i in 0...string.size
- string += string.slice(0,1)
- case string.slice!(0,1)
- when "x"
- else
- size2.push(index + i+(k*9))
- end
- end
- end
- pr = 108
- for i in 0...108
- if size2.include?(size[i])
- pr -= 1
- end
- end
- if link != false
- if pr >= 108
- @jj = true
- else
- return false
- end
- else
- if pr < 108
- return false
- else
- #print("a")
- @jj = true
- end
- end
- else
- #return false
- end
- end
- break if equip >= 5
- if link == false
- equip += 1
- end
- end
- #print("a")
- return @jj if @jj != nil
- #print("c")
- return true
- #end
- #end
- return @jj if @jj != nil
- return false
- end
- def get_item(index)
- item = @window_panels.data[index]
- case item
- when RPG::Item
- pr = "Item"
- when RPG::Weapon
- pr = "Weapon"
- when RPG::Armor
- pr = "Armor"
- when RPG::Skill
- pr = "Skill"
- end
- id = item.id
- #If Weapon is in Database
- for i in 0...$item_panels.size
- if pr == $item_panels[i][1]
- if $item_panels[i][3] == item.id
- return $item_panels[i]
- end
- end
- end
- return false
- end
- def get_itemequipped(index)
- item = @window_equipped.data[index]
- case item
- when RPG::Item
- pr = "Item"
- when RPG::Weapon
- pr = "Weapon"
- when RPG::Armor
- pr = "Armor"
- when RPG::Skill
- pr = "Skill"
- end
- id = item.id
- #If Weapon is in Database
- for i in 0...$item_panels.size
- if pr == $item_panels[i][1]
- if $item_panels[i][3] == item.id
- return $item_panels[i]
- end
- end
- end
- if @window_equipped.data[index].is_a?(Array)
- #[2][2][1]
- return [["oxxx","xxxx","xxxx","xxxx"],"x",["x","x",["x",index]]]
- end
- return false
- end
- def get_item2(item)
- case item
- when RPG::Item
- pr = "Item"
- when RPG::Weapon
- pr = "Weapon"
- when RPG::Armor
- pr = "Armor"
- when RPG::Skill
- pr = "Skill"
- end
- id = item.id
- #If Weapon is in Database
- for i in 0...$item_panels.size
- if pr == $item_panels[i][1]
- if $item_panels[i][3] == item.id
- return $item_panels[i]
- end
- end
- end
- return false
- end
- def get_item3(item)
- case item[1]
- when "Item"
- return $data_items[item[3]]
- when "Weapon"
- return $data_weapons[item[3]]
- when "Armor"
- return $data_armors[item[3]]
- when "Skill"
- return $data_skills[item[3]]
- end
- return false
- end
- end
- class Window_Base < Window
- def black_color
- return Color.new(0, 0, 0)
- end
- def activepanel_color
- return Color.new(200, 200, 200)
- end
- def activelink_color
- return Color.new(100, 200, 100)
- end
- def linkpanel_color
- return Color.new(50, 100, 50)
- end
- end
- #==============================================================================
- # ** Window_Panels
- #------------------------------------------------------------------------------
- # This window displays items in possession on the item and battle screens.
- #==============================================================================
- class Window_Panels < Window_Base
- attr_accessor :data
- attr_reader :index # cursor position
- attr_reader :help_window # help window
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize(actor)
- super(320, 64 + 64, 320, (416) - 64)
- @actor = actor
- @column_max = 1
- @item_max = 99999
- @column_max = 1
- #@index = -1
- @data = []
- refresh
- @index = 0
- # If in battle, move window to center of screen
- # and make it semi-transparent
- if $game_temp.in_battle
- self.y = 64
- self.height = 256
- self.back_opacity = 160
- end
- end
- #--------------------------------------------------------------------------
- # * Get Item
- #--------------------------------------------------------------------------
- def item
- return @data[@index]
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh(k=0)
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- end
- @data = []
- # Add item
- # Add equippable weapons
- #for i in [email hidden]
- # skill = $data_skills[@actor.skills[i]]
- # if skill != nil
- # @data.push(skill)
- # end
- #end
- #s1 = "All"
- #s2 = "Weapons"
- #s3 = "Armors"
- #s4 = "Assist"
- #s5 = "Items"
- #@commands = [s1,s2,s3,s4,s5]
- if k == 0 or k == 4 or k == 3
- for i in 1...$data_items.size
- if $game_party.item_number(i) > 0
- if k == 3
- if COTTONJJ::ASSISTITEMS.include?(i)
- @data.push($data_items[i])
- end
- elsif k == 4
- if COTTONJJ::ASSISTITEMS.include?(i)
- else
- @data.push($data_items[i])
- end
- else
- @data.push($data_items[i])
- end
- end
- end
- end
- # Also add weapons and items if outside of battle
- unless $game_temp.in_battle
- if k == 0 or k == 1
- for i in 1...$data_weapons.size
- if $game_party.weapon_number(i) > 0
- if @actor.equippable?($data_weapons[i])
- @data.push($data_weapons[i])
- end
- end
- end
- end
- if k == 0 or k == 2 or k == 3
- for i in 1...$data_armors.size
- if $game_party.armor_number(i) > 0
- if @actor.equippable?($data_armors[i])
- if k == 3
- if COTTONJJ::ASSISTARMORS.include?(i)
- @data.push($data_armors[i])
- end
- elsif k == 2
- if COTTONJJ::ASSISTARMORS.include?(i)
- else
- @data.push($data_armors[i])
- end
- else
- @data.push($data_armors[i])
- end
- end
- end
- end
- end
- end
- @data = @data.compact
- # If item count is not 0, make a bit map and draw all items
- @item_max = @data.size
- if @item_max > 0
- self.contents = Bitmap.new(width - 32, row_max * 32)
- for i in 0...@item_max
- draw_item(i)
- end
- end
- end
- #--------------------------------------------------------------------------
- # * Draw Item
- # index : item number
- #--------------------------------------------------------------------------
- def draw_item(index)
- item = @data[index]
- case item
- when RPG::Item
- number = $game_party.item_number(item.id)
- when RPG::Weapon
- number = $game_party.weapon_number(item.id)
- when RPG::Armor
- number = $game_party.armor_number(item.id)
- end
- if item.is_a?(RPG::Item) and
- $game_party.item_can_use?(item.id)
- self.contents.font.color = normal_color
- elsif @actor.skill_can_use?(item.id)
- self.contents.font.color = normal_color
- elsif @actor.equippable?(item)
- self.contents.font.color = normal_color
- else
- self.contents.font.color = disabled_color
- end
- x = index % @column_max * (320 + 32)
- y = index / @column_max * 32# - self.oy
- rect = Rect.new(x, y, self.width / @column_max - 32, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- bitmap = RPG::Cache.icon(item.icon_name)
- opacity = self.contents.font.color == normal_color ? 255 : 128
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
- self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
- self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
- self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
- end
- #--------------------------------------------------------------------------
- # * Help Text Update
- #--------------------------------------------------------------------------
- def update_help(text = nil)
- if text != nil
- @help_window.set_text(text)
- else
- @help_window.set_text(self.item == nil ? "" : self.item.description)
- end
- end
- def update
- super
- # If cursor is movable
- if self.active and @item_max > 0 and @index >= 0
- # If pressing down on the directional buttons
- if Input.repeat?(Input::DOWN)
- # If column count is 1 and directional button was pressed down with no
- # repeat, or if cursor position is more to the front than
- # (item count - column count)
- if (@column_max == 1 and Input.trigger?(Input::DOWN)) or
- @index < @item_max - @column_max
- # Move cursor down
- $game_system.se_play($data_system.cursor_se)
- @index = (@index + @column_max) % @item_max
- end
- end
- # If the up directional button was pressed
- if Input.repeat?(Input::UP)
- # If column count is 1 and directional button was pressed up with no
- # repeat, or if cursor position is more to the back than column count
- if (@column_max == 1 and Input.trigger?(Input::UP)) or
- @index >= @column_max
- # Move cursor up
- $game_system.se_play($data_system.cursor_se)
- if (@index - 1) == -1
- $scene.update_to_category
- @index = 0
- return
- end
- @index = (@index - @column_max + @item_max) % @item_max
- end
- end
- # If the right directional button was pressed
- if Input.repeat?(Input::RIGHT)
- # If column count is 2 or more, and cursor position is closer to front
- # than (item count -1)
- if @column_max >= 2 and @index < @item_max - 1
- # Move cursor right
- $game_system.se_play($data_system.cursor_se)
- @index += 1
- end
- end
- # If the left directional button was pressed
- if Input.repeat?(Input::LEFT)
- # If column count is 2 or more, and cursor position is more back than 0
- if @column_max >= 2 and @index > 0
- # Move cursor left
- $game_system.se_play($data_system.cursor_se)
- @index -= 1
- end
- end
- # If R button was pressed
- if Input.repeat?(Input::R)
- # If bottom row being displayed is more to front than bottom data row
- if self.top_row + (self.page_row_max - 1) < (self.row_max - 1)
- # Move cursor 1 page back
- $game_system.se_play($data_system.cursor_se)
- @index = [@index + self.page_item_max, @item_max - 1].min
- self.top_row += self.page_row_max
- end
- end
- # If L button was pressed
- if Input.repeat?(Input::L)
- # If top row being displayed is more to back than 0
- if self.top_row > 0
- # Move cursor 1 page forward
- $game_system.se_play($data_system.cursor_se)
- @index = [@index - self.page_item_max, 0].max
- self.top_row -= self.page_row_max
- end
- end
- end
- # Update help text (update_help is defined by the subclasses)
- if self.active and @help_window != nil
- update_help
- end
- # Update cursor rectangle
- update_cursor_rect
- end
- #--------------------------------------------------------------------------
- # * Set Cursor Position
- # index : new cursor position
- #--------------------------------------------------------------------------
- def index=(index)
- @index = index
- # Update Help Text (update_help is defined by the subclasses)
- if self.active and @help_window != nil
- update_help
- end
- # Update cursor rectangle
- update_cursor_rect
- end
- #--------------------------------------------------------------------------
- # * Get Row Count
- #--------------------------------------------------------------------------
- def row_max
- # Compute rows from number of items and columns
- return (@item_max + @column_max - 1) / @column_max
- end
- #--------------------------------------------------------------------------
- # * Get Top Row
- #--------------------------------------------------------------------------
- def top_row
- # Divide y-coordinate of window contents transfer origin by 1 row
- # height of 32
- return self.oy / 32
- end
- #--------------------------------------------------------------------------
- # * Set Top Row
- # row : row shown on top
- #--------------------------------------------------------------------------
- def top_row=(row)
- # If row is less than 0, change it to 0
- if row < 0
- row = 0
- end
- # If row exceeds row_max - 1, change it to row_max - 1
- if row > row_max - 1
- row = row_max - 1
- end
- # Multiply 1 row height by 32 for y-coordinate of window contents
- # transfer origin
- self.oy = row * 32
- end
- #--------------------------------------------------------------------------
- # * Get Number of Rows Displayable on 1 Page
- #--------------------------------------------------------------------------
- def page_row_max
- # Subtract a frame height of 32 from the window height, and divide it by
- # 1 row height of 32
- return (self.height - 32) / 32
- end
- #--------------------------------------------------------------------------
- # * Get Number of Items Displayable on 1 Page
- #--------------------------------------------------------------------------
- def page_item_max
- # Multiply row count (page_row_max) times column count (@column_max)
- return page_row_max * @column_max
- end
- #--------------------------------------------------------------------------
- # * Set Help Window
- # help_window : new help window
- #--------------------------------------------------------------------------
- def help_window=(help_window)
- @help_window = help_window
- # Update help text (update_help is defined by the subclasses)
- if self.active and @help_window != nil
- update_help
- end
- end
- #--------------------------------------------------------------------------
- # * Update Cursor Rectangle
- #--------------------------------------------------------------------------
- def update_cursor_rect
- # If cursor position is less than 0
- if @index < 0
- self.cursor_rect.empty
- return
- end
- # Get current row
- row = @index / @column_max
- # If current row is before top row
- if row < self.top_row
- # Scroll so that current row becomes top row
- self.top_row = row
- end
- # If current row is more to back than back row
- if row > self.top_row + (self.page_row_max - 1)
- # Scroll so that current row becomes back row
- self.top_row = row - (self.page_row_max - 1)
- end
- # Calculate cursor width
- cursor_width = self.width / @column_max - 32
- # Calculate cursor coordinates
- x = @index % @column_max * (cursor_width + 32)
- y = @index / @column_max * 32 - self.oy
- # Update cursor rectangle
- self.cursor_rect.set(x, y, cursor_width, 32)
- end
- end
- #==============================================================================
- # ** Window_Panels
- #------------------------------------------------------------------------------
- # This window displays items in possession on the item and battle screens.
- #==============================================================================
- class Window_Equipped < Window_Base
- attr_accessor :data
- attr_reader :index # cursor position
- attr_reader :help_window # help window
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize(actor)
- super(0, 64, 320, 416)
- @item_max = 99999
- @actor = actor
- @column_max = 9
- @data = []
- @data2 = []
- @data3 = []
- refresh
- @index = 0
- # If in battle, move window to center of screen
- # and make it semi-transparent
- if $game_temp.in_battle
- self.y = 64
- self.height = 256
- self.back_opacity = 160
- end
- end
- #--------------------------------------------------------------------------
- # * Set Cursor Position
- # index : new cursor position
- #--------------------------------------------------------------------------
- def index=(index)
- @index = index
- # Update Help Text (update_help is defined by the subclasses)
- if self.active and @help_window != nil
- update_help
- end
- # Update cursor rectangle
- update_cursor_rect
- end
- #--------------------------------------------------------------------------
- # * Get Row Count
- #--------------------------------------------------------------------------
- def row_max
- # Compute rows from number of items and columns
- return (@item_max + @column_max - 1) / @column_max
- end
- #--------------------------------------------------------------------------
- # * Get Top Row
- #--------------------------------------------------------------------------
- def top_row
- # Divide y-coordinate of window contents transfer origin by 1 row
- # height of 32
- return self.oy / 32
- end
- #--------------------------------------------------------------------------
- # * Set Top Row
- # row : row shown on top
- #--------------------------------------------------------------------------
- def top_row=(row)
- # If row is less than 0, change it to 0
- if row < 0
- row = 0
- end
- # If row exceeds row_max - 1, change it to row_max - 1
- if row > row_max - 1
- row = row_max - 1
- end
- # Multiply 1 row height by 32 for y-coordinate of window contents
- # transfer origin
- self.oy = row * 32
- end
- #--------------------------------------------------------------------------
- # * Get Number of Rows Displayable on 1 Page
- #--------------------------------------------------------------------------
- def page_row_max
- # Subtract a frame height of 32 from the window height, and divide it by
- # 1 row height of 32
- return (self.height - 32) / 32
- end
- #--------------------------------------------------------------------------
- # * Get Number of Items Displayable on 1 Page
- #--------------------------------------------------------------------------
- def page_item_max
- # Multiply row count (page_row_max) times column count (@column_max)
- return page_row_max * @column_max
- end
- #--------------------------------------------------------------------------
- # * Set Help Window
- # help_window : new help window
- #--------------------------------------------------------------------------
- def help_window=(help_window)
- @help_window = help_window
- # Update help text (update_help is defined by the subclasses)
- if self.active and @help_window != nil
- update_help
- end
- end
- #--------------------------------------------------------------------------
- # * Get Item
- #--------------------------------------------------------------------------
- def item
- return @data[@index]
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- end
- # Add item
- # If item count is not 0, make a bit map and draw all items
- @item_max = 108
- @data = []
- if @item_max > 0
- self.contents = Bitmap.new(width - 32, row_max * 32)
- for i in 0...@item_max
- draw_item(i)
- end
- end
- end
- #--------------------------------------------------------------------------
- # * Draw Item
- # index : item number
- #--------------------------------------------------------------------------
- def draw_item(index)
- @data[index] = []
- x = index % @column_max * 32
- y = index / @column_max * 32 - self.oy
- rect = Rect.new(x + 2, y + 2, 28, 28)
- self.contents.fill_rect(rect, Color.new(0, 0, 0))
- end
- def clear_panel(item,index,item2)
- panels = item[0].dup
- @string = []
- item2 = item2
- #if index != nil
- for i in 0...item[2].size
- if item[2][i][0] == @actor.id
- if item[2][i][1] != index
- if panels[0].slice(0,1) != "o"
- index = item[2][i][1]
- #print(item[2][i][1])
- end
- end
- end
- end
- #else
- #index = @window_equipped.index
- #end
- for k in 0...item[0].size
- @string[k] = panels[k]
- for i in 0...@string[k].size
- @string[k] += @string[k].slice(0,1)
- case @string[k].slice!(0,1)
- when "x"
- else
- x = (index + i + (k * 9)) % @column_max * 32
- y = (index + i + (k * 9)) / @column_max * 32 - self.oy
- rect = Rect.new(x + 2, y + 2, 28, 28)
- color = black_color
- g = index + i + (k * 9)
- if @data[g] != nil
- #if @data[g].is_a?(Array)
- if $scene.get_item2(item2)[4] == "WeaponLink" or
- $scene.get_item2(item2)[4] == "LevelUp"
- bitmap = RPG::Cache.icon(COTTONJJ::BLANKICON)
- color = linkpanel_color
- end
- end
- self.contents.fill_rect(rect, color)
- if bitmap != nil
- opacity = self.contents.font.color == normal_color ? 255 : 128
- self.contents.blt(x + 4, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
- @data2[index + i + 27] = true# if new_color == true
- if $scene.window == true
- m = $scene.window_panels.item
- else
- m = $scene.get_item3($scene.window_itempanel.item)
- end
- m = @data3[g]
- print(@data3[g])
- @data[g] = ["Link",m.id,nil,nil,nil,nil,m]
- if item[5] == "Level"
- @data[g] = ["Link",m.id,"Level",item[4]]
- end
- else
- @data[g] = nil
- end
- end
- end
- end
- end
- def set_panel(item,index,item2,new_color = false,m = nil)
- panels = item[0]
- item2 = item2
- @string = []
- for k in 0...item[0].size
- @string[k] = panels[k]
- for i in 0...@string[k].size
- @string[k] += @string[k].slice(0,1)
- case @string[k].slice!(0,1)
- when "o"
- x = (index + i+(k * 9)) % @column_max * 32
- y = (index + i+(k * 9)) / @column_max * 32 - self.oy
- rect = Rect.new(x + 2, y + 2, 28, 28)
- color = activepanel_color
- color = activelink_color if new_color == true
- self.contents.fill_rect(rect, color)
- bitmap = RPG::Cache.icon(item2.icon_name)
- opacity = self.contents.font.color == normal_color ? 255 : 128
- self.contents.blt(x + 4, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
- @data2[index + i+(k * 9)] = true if new_color == true
- @data[index + i+(k * 9)] = $scene.window_panels.item
- @data3[index + i+(k * 9)] = m
- when "l"
- x = (index + i+(k * 9)) % @column_max * 32
- y = (index + i+(k * 9)) / @column_max * 32 - self.oy
- rect = Rect.new(x + 2, y + 2, 28, 28)
- self.contents.fill_rect(rect, linkpanel_color)
- bitmap = RPG::Cache.icon(COTTONJJ::BLANKICON)
- opacity = self.contents.font.color == normal_color ? 255 : 128
- self.contents.blt(x + 4, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
- if $scene.window == true
- m = $scene.window_panels.item
- else
- m = $scene.get_item3($scene.window_itempanel.item)
- end
- @data2[index + i+(k * 9)] = true if new_color == true
- @data[index + i+(k * 9)] = ["Link",$scene.window_panels.item.id,nil,nil,nil,nil,m]
- if item[5] == "Level"
- @data[index + i+(k * 9)] = ["Link",$scene.window_panels.item.id,"Level",item[4]]
- end
- when "x"
- end
- end
- end
- end
- def draw_oldpanels
- @data = $panels[@actor.id]
- @data2 = $panels2[@actor.id]
- for i in 0...@item_max
- o = $panels[@actor.id][i]
- if o != nil
- if o.is_a?(Array)
- if o[0] == "Link"
- draw_panelicon(i - (9*3),true,"Level")
- end
- else
- if o.is_a?(RPG::Item) or o.is_a?(RPG::Weapon) or o.is_a?(RPG::Armor)
- if @actor.weapon != nil
- if @actor.weapon.weapon_accessories != nil
- if @actor.weapon.weapon_accessories.include?(o)
- draw_panelicon(i-(9*3),false,o,true)
- else
- if $panels2[@actor.id][i]
- draw_panelicon(i-(9*3),false,o,true)
- else
- draw_panelicon(i-(9*3),false,o)
- end
- end
- else
- draw_panelicon(i-(9*3),false,o)
- end
- else
- draw_panelicon(i-(9*3),false,o)
- end
- end
- end
- end
- end
- end
- def level_on_levelink(o,index)
- for i in 0...@item_max
- if $panels[@actor.id][i].is_a?(RPG::Item)
- if $panels[@actor.id][i].id == 2
- if $panels2[@actor.id][i] == true
- return true
- end
- end
- end
- end
- end
- def draw_panelicon(index,link = false,item = nil,new_color = false)
- if link == true
- x = (index) % @column_max * 32
- y = ((index) / @column_max * 32 - self.oy) + 96
- rect = Rect.new(x + 2, y + 2, 28, 28)
- self.contents.fill_rect(rect, linkpanel_color)
- bitmap = RPG::Cache.icon(COTTONJJ::BLANKICON)
- opacity = self.contents.font.color == normal_color ? 255 : 128
- self.contents.blt(x + 4, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
- return
- end
- x = (index) % @column_max * 32
- y = ((index) / @column_max * 32 - self.oy) + 96
- rect = Rect.new(x + 2, y + 2, 28, 28)
- color = activepanel_color
- color = activelink_color if new_color == true
- self.contents.fill_rect(rect, color)
- bitmap = RPG::Cache.icon(item.icon_name)
- opacity = self.contents.font.color == normal_color ? 255 : 128
- self.contents.blt(x + 4, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
- end
- def save_panels
- $panels[@actor.id] = @data
- $panels2[@actor.id] = @data2
- $panels3[@actor.id] = @data3
- end
- #--------------------------------------------------------------------------
- # * Help Text Update
- #--------------------------------------------------------------------------
- def update_help
- @help_window.set_text(self.item == nil ? "" : self.item.description)
- end
- def update_cursor_rect
- # If cursor position is less than 0
- if @index < 0
- self.cursor_rect.empty
- return
- end
- # Get current row
- row = @index / @column_max
- # If current row is before top row
- if row < self.top_row
- # Scroll so that current row becomes top row
- self.top_row = row
- end
- # If current row is more to back than back row
- if row > self.top_row + (self.page_row_max - 1)
- # Scroll so that current row becomes back row
- self.top_row = row - (self.page_row_max - 1)
- end
- # Calculate cursor width
- cursor_width = 32
- # Calculate cursor coordinates
- x = @index % @column_max * (cursor_width)
- y = @index / @column_max * 32 - self.oy
- # Update cursor rectangle
- self.cursor_rect.set(x, y, cursor_width, 32)
- end
- def update
- super
- # If cursor is movable
- if self.active and @item_max > 0 and @index >= 0
- # If pressing down on the directional buttons
- if Input.repeat?(Input::DOWN)
- # If column count is 1 and directional button was pressed down with no
- # repeat, or if cursor position is more to the front than
- # (item count - column count)
- if (@column_max == 1 and Input.trigger?(Input::DOWN)) or
- @index < @item_max - @column_max
- # Move cursor down
- $game_system.se_play($data_system.cursor_se)
- @index = (@index + @column_max) % @item_max
- end
- end
- # If the up directional button was pressed
- if Input.repeat?(Input::UP)
- # If column count is 1 and directional button was pressed up with no
- # repeat, or if cursor position is more to the back than column count
- if (@column_max == 1 and Input.trigger?(Input::UP)) or
- @index >= @column_max
- # Move cursor up
- $game_system.se_play($data_system.cursor_se)
- @index = (@index - @column_max + @item_max) % @item_max
- end
- end
- # If the right directional button was pressed
- if Input.repeat?(Input::RIGHT)
- # If column count is 2 or more, and cursor position is closer to front
- # than (item count -1)
- if @column_max >= 2 and @index < @item_max - 1
- # Move cursor right
- $game_system.se_play($data_system.cursor_se)
- o = @index % 9
- if (o) == 8
- $scene.update_return_right(@index)
- #@index = @index - 8
- return
- end
- @index += 1
- else
- #@index = @index - 8
- $scene.update_return_right(@index)
- return
- end
- end
- # If the left directional button was pressed
- if Input.repeat?(Input::LEFT)
- # If column count is 2 or more, and cursor position is more back than 0
- if @column_max >= 2 and @index > 0
- # Move cursor left
- $game_system.se_play($data_system.cursor_se)
- o = @index % 9
- if (o) == 0
- #@index = @index + 8
- return
- end
- @index -= 1
- end
- end
- # If R button was pressed
- if Input.repeat?(Input::R)
- # If bottom row being displayed is more to front than bottom data row
- if self.top_row + (self.page_row_max - 1) < (self.row_max - 1)
- # Move cursor 1 page back
- $game_system.se_play($data_system.cursor_se)
- @index = [@index + self.page_item_max, @item_max - 1].min
- self.top_row += self.page_row_max
- end
- end
- # If L button was pressed
- if Input.repeat?(Input::L)
- # If top row being displayed is more to back than 0
- if self.top_row > 0
- # Move cursor 1 page forward
- $game_system.se_play($data_system.cursor_se)
- @index = [@index - self.page_item_max, 0].max
- self.top_row -= self.page_row_max
- end
- end
- end
- # Update help text (update_help is defined by the subclasses)
- if self.active and @help_window != nil
- update_help
- end
- # Update cursor rectangle
- update_cursor_rect
- end
- end
- #==============================================================================
- # ** Window_PartyCommand
- #------------------------------------------------------------------------------
- # This window is used to select whether to fight or escape on the battle
- # screen.
- #==============================================================================
- class Window_Category < Window_Base
- attr_reader :index # cursor position
- attr_reader :help_window # help window
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- super(320, 64, 320, 64)
- self.contents = Bitmap.new(width - 32, height - 32)
- #self.back_opacity = 160
- s1 = "All"
- s2 = "Weapons"
- s3 = "Armors"
- s4 = "Assist"
- s5 = "Items"
- @commands = [s1,s2,s3,s4,s5]
- @item_max = 5
- @column_max = 5
- @index = 0
- self.active = false
- draw_item(0, normal_color)
- draw_item(1, normal_color)
- draw_item(2, normal_color)
- draw_item(3, normal_color)
- draw_item(4, normal_color)
- end
- #--------------------------------------------------------------------------
- # * Set Cursor Position
- # index : new cursor position
- #--------------------------------------------------------------------------
- def index=(index)
- @index = index
- # Update Help Text (update_help is defined by the subclasses)
- if self.active and @help_window != nil
- update_help
- end
- # Update cursor rectangle
- update_cursor_rect
- end
- #--------------------------------------------------------------------------
- # * Get Row Count
- #--------------------------------------------------------------------------
- def row_max
- # Compute rows from number of items and columns
- return (@item_max + @column_max - 1) / @column_max
- end
- #--------------------------------------------------------------------------
- # * Get Top Row
- #--------------------------------------------------------------------------
- def top_row
- # Divide y-coordinate of window contents transfer origin by 1 row
- # height of 32
- return self.oy / 32
- end
- #--------------------------------------------------------------------------
- # * Set Top Row
- # row : row shown on top
- #--------------------------------------------------------------------------
- def top_row=(row)
- # If row is less than 0, change it to 0
- if row < 0
- row = 0
- end
- # If row exceeds row_max - 1, change it to row_max - 1
- if row > row_max - 1
- row = row_max - 1
- end
- # Multiply 1 row height by 32 for y-coordinate of window contents
- # transfer origin
- self.oy = row * 32
- end
- #--------------------------------------------------------------------------
- # * Get Number of Rows Displayable on 1 Page
- #--------------------------------------------------------------------------
- def page_row_max
- # Subtract a frame height of 32 from the window height, and divide it by
- # 1 row height of 32
- return (self.height - 32) / 32
- end
- #--------------------------------------------------------------------------
- # * Get Number of Items Displayable on 1 Page
- #--------------------------------------------------------------------------
- def page_item_max
- # Multiply row count (page_row_max) times column count (@column_max)
- return page_row_max * @column_max
- end
- #--------------------------------------------------------------------------
- # * Set Help Window
- # help_window : new help window
- #--------------------------------------------------------------------------
- def help_window=(help_window)
- @help_window = help_window
- # Update help text (update_help is defined by the subclasses)
- if self.active and @help_window != nil
- update_help
- end
- end
- #--------------------------------------------------------------------------
- # * Draw Item
- # index : item number
- # color : text character color
- #--------------------------------------------------------------------------
- def draw_item(index, color)
- self.contents.font.color = color
- g = (320 - 32) / @item_max
- rect = Rect.new(index * g, 0, g - 5, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- self.contents.draw_text(rect, @commands[index], 1)
- end
- #--------------------------------------------------------------------------
- # * Cursor Rectangle Update
- #--------------------------------------------------------------------------
- def update_cursor_rect
- g = (320 - 32) / @item_max
- self.cursor_rect.set(@index * g, 0, g - 5, 32)
- end
- def update
- super
- # If cursor is movable
- if self.active and @item_max > 0 and @index >= 0
- # If pressing down on the directional buttons
- # If the right directional button was pressed
- if Input.repeat?(Input::RIGHT)
- # If column count is 2 or more, and cursor position is closer to front
- # than (item count -1)
- if @column_max >= 2 and @index < @item_max - 1
- # Move cursor right
- $game_system.se_play($data_system.cursor_se)
- @index += 1
- end
- end
- # If the left directional button was pressed
- if Input.repeat?(Input::LEFT)
- # If column count is 2 or more, and cursor position is more back than 0
- if @column_max >= 2 and @index > 0
- # Move cursor left
- $game_system.se_play($data_system.cursor_se)
- @index -= 1
- end
- end
- # If R button was pressed
- if Input.repeat?(Input::R)
- # If bottom row being displayed is more to front than bottom data row
- if self.top_row + (self.page_row_max - 1) < (self.row_max - 1)
- # Move cursor 1 page back
- $game_system.se_play($data_system.cursor_se)
- @index = [@index + self.page_item_max, @item_max - 1].min
- self.top_row += self.page_row_max
- end
- end
- # If L button was pressed
- if Input.repeat?(Input::L)
- # If top row being displayed is more to back than 0
- if self.top_row > 0
- # Move cursor 1 page forward
- $game_system.se_play($data_system.cursor_se)
- @index = [@index - self.page_item_max, 0].max
- self.top_row -= self.page_row_max
- end
- end
- end
- # Update help text (update_help is defined by the subclasses)
- if self.active and @help_window != nil
- update_help
- end
- # Update cursor rectangle
- update_cursor_rect
- end
- end
- class Window_ItemPanel < Window_Base
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- super(0, 64, 320, 480)
- @item = []
- @column_max = 9
- self.back_opacity = 0
- self.opacity = 0
- self.contents = Bitmap.new(width - 32, height - 32)
- end
- def refresh(index)
- self.x = (index % @column_max * 32) - 6
- self.y = ((index / @column_max * 32 - self.oy) + 64) - 6
- end
- def clear_panels
- self.contents.clear
- end
- def item
- return @item
- end
- def draw_panels(item, index, item2)
- @item = item
- #panels = item[0]
- #@string1 = panels[0]
- #@string2 = panels[1]
- #@string3 = panels[2]
- #@string4 = panels[3]
- item2 = item2
- for k in 0...item[0].size
- string = item[0][k]
- for i in 0...string.size
- string += string.slice(0,1)
- case string.slice!(0,1)
- when "o"
- x = i % @column_max * 32
- y = (i / @column_max * 32 - self.oy) + (k*32)
- rect = Rect.new(x + 2, y + 2, 28, 28)
- self.contents.fill_rect(rect, activepanel_color)
- bitmap = RPG::Cache.icon(item2.icon_name)
- opacity = self.contents.font.color == normal_color ? 255 : 128
- self.contents.blt(x + 4, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
- when "l"
- x = i % @column_max * 32
- y = (i / @column_max * 32 - self.oy) + (k*32)
- rect = Rect.new(x + 2, y + 2, 28, 28)
- self.contents.fill_rect(rect, linkpanel_color)
- bitmap = RPG::Cache.icon(COTTONJJ::BLANKICON)
- opacity = self.contents.font.color == normal_color ? 255 : 128
- self.contents.blt(x + 4, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
- when "x"
- x = i % @column_max * 32
- y = (i / @column_max * 32 - self.oy) + (k*32)
- rect = Rect.new(x + 2, y + 2, 28, 28)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- end
- end
- end
- end
- end
- module RPG
- class Weapon
- alias initcj initialize
- def initialize
- @weapon_accessories = []
- initcj
- end
- attr_accessor :weapon_accessories
- end
- class Armor
- alias initcj initialize
- def initialize
- @armor_accessories = []
- initcj
- end
- attr_accessor :armor_accessories
- end
- end
- class Game_Actor < Game_Battler
- attr_accessor :fake_level
- attr_accessor :gain
- attr_accessor :weapon
- attr_accessor :armors
- alias initcj initialize
- def initialize(actor_id)
- initcj(actor_id)
- @weapon = $data_weapons[@weapon_id].dup if $data_weapons[@weapon_id] != nil
- @armors = []
- @armors[0] = $data_armors[@armor1_id].dup if $data_armors[@armor1_id] != nil
- @armors[1] = $data_armors[@armor2_id].dup if $data_armors[@armor2_id] != nil
- @armors[2] = $data_armors[@armor3_id].dup if $data_armors[@armor3_id] != nil
- @armors[3] = $data_armors[@armor4_id].dup if $data_armors[@armor4_id] != nil
- @gain = true
- @fake_level = @level
- end
- def equip_weaponaccessory(item)
- @weapon = $data_weapons[@weapon_id]# if @weapon.weapon_accessories == nil
- if @weapon.weapon_accessories == nil
- @weapon.weapon_accessories = []
- end
- @weapon.weapon_accessories.push(item)
- $game_party.lose_armor(item.id, 1)
- end
- def unequip_weaponaccessory(item)
- @weapon = $data_weapons[@weapon_id]# if @weapon.weapon_accessories == nil
- if @weapon.weapon_accessories == nil
- @weapon.weapon_accessories = []
- end
- for i in [email hidden]_accessories.size
- if @weapon.weapon_accessories[i] == item
- @weapon.weapon_accessories[i] = nil
- break
- end
- end
- @weapon.weapon_accessories = @weapon.weapon_accessories.compact
- $game_party.gain_armor(item.id, 1)
- end
- def equip_armoraccessory(equip_type, item)
- case equip_type
- when 0
- g = @armor1_id
- when 1
- g = @armor2_id
- when 2
- g = @armor3_id
- when 3
- g = @armor4_id
- end
- @armors[equip_type] = $data_armors[g]
- if @armors[equip_type].armor_accessories == nil
- @armors[equip_type].armor_accessories = []
- end
- @armors[equip_type].armor_accessories.push(item)
- $game_party.lose_armor(item.id, 1)
- end
- def unequip_armoraccessory(equip_type, item)
- case equip_type
- when 0
- g = @armor1_id
- when 1
- g = @armor2_id
- when 2
- g = @armor3_id
- when 3
- g = @armor4_id
- end
- @armors[equip_type] = $data_armors[g]
- for i in 0...@armors[equip_type].armor_accessories.size
- if @armors[equip_type].armor_accessories[i] == item
- @armors[equip_type].armor_accessories[i] = nil
- break
- end
- end
- @armors[equip_type].armor_accessories = @armors[equip_type].armor_accessories.compact
- $game_party.gain_armor(item.id, 1)
- end
- def weapon_equips
- return @actor.weapon.weapon_accessories
- end
- def armor_equips(equip_type)
- return @actor.armors[equip_type].armor_accessories
- end
- def equip(equip_type, id)
- case equip_type
- when 0 # Weapon
- if id == 0 or $game_party.weapon_number(id) > 0
- $game_party.gain_weapon(@weapon_id, 1)
- @weapon_id = id
- $game_party.lose_weapon(id, 1)
- @weapon = $data_weapons[@weapon_id].dup if $data_weapons[@weapon_id] != nil
- end
- when 1 # Shield
- if id == 0 or $game_party.armor_number(id) > 0
- update_auto_state($data_armors[@armor1_id], $data_armors[id])
- $game_party.gain_armor(@armor1_id, 1)
- @armor1_id = id
- $game_party.lose_armor(id, 1)
- @armors[0] = $data_armors[@armor1_id].dup if $data_armors[@armor1_id] != nil
- end
- when 2 # Head
- if id == 0 or $game_party.armor_number(id) > 0
- update_auto_state($data_armors[@armor2_id], $data_armors[id])
- $game_party.gain_armor(@armor2_id, 1)
- @armor2_id = id
- $game_party.lose_armor(id, 1)
- @armors[1] = $data_armors[@armor2_id].dup if $data_armors[@armor2_id] != nil
- end
- when 3 # Body
- if id == 0 or $game_party.armor_number(id) > 0
- #print("a")
- update_auto_state($data_armors[@armor3_id], $data_armors[id])
- $game_party.gain_armor(@armor3_id, 1)
- @armor3_id = id
- $game_party.lose_armor(id, 1)
- @armors[2] = $data_armors[@armor3_id].dup if $data_armors[@armor3_id] != nil
- end
- when 4 # Accessory
- if id == 0 or $game_party.armor_number(id) > 0
- update_auto_state($data_armors[@armor4_id], $data_armors[id])
- $game_party.gain_armor(@armor4_id, 1)
- @armor4_id = id
- $game_party.lose_armor(id, 1)
- @armors[3] = $data_armors[@armor4_id].dup if $data_armors[@armor4_id] != nil
- end
- end
- end
- end
- class Game_Actor < Game_Battler
- def exp=(exp)
- @exp = exp#[[exp, 9999999].min, 0].max
- while @exp >= @exp_list[@fake_level+1] and @exp_list[@fake_level+1] > 0
- if @gain == true && COTTONJJ::GAINLEVELITEM == true
- $game_party.gain_item(COTTONJJ::LEVELUP, 1)
- else
- @level += 1
- end
- @fake_level += 1
- # NEW - David
- $d_new_skill = nil
- for j in $data_classes[@class_id].learnings
- if j.level == @fake_level
- learn_skill(j.skill_id)
- # NEW - David
- skill = $data_skills[j.skill_id]
- $d_new_skill = skill.name
- end
- end
- end
- while @exp < @exp_list[@level]
- if item_number(COTTONJJ::LEVELUP) < 1
- @fake_level -= 1
- if COTTONJJ::GAINLEVELITEM == false
- @level -= 1
- end
- else
- if COTTONJJ::GAINLEVELITEM == false
- @level -= 1
- else
- $game_party.lose_item(COTTONJJ::LEVELUP, 1)
- end
- @fake_level -= 1
- end
- end
- @hp = [@hp, self.maxhp].min
- @sp = [@sp, self.maxsp].min
- #@fake_level = @level
- end
- def level=(level)
- # Check up and down limits
- @level = level
- #@fake_level = @level
- #level = [[level, $data_actors[@actor_id].final_level].min, 1].max
- # Change EXP
- @gain = false
- self.exp = @exp_list[level]
- @gain = true
- end
- def run_equip(equip_type,id)
- case equip_type
- when 0 # Weapon
- for i in 0...$item_panels.size
- return $item_panels[i] if $item_panels[i][3] == id && $item_panels[i][1] == "Weapon"
- end
- when 5
- for i in 0...$item_panels.size
- return $item_panels[i] if $item_panels[i][3] == id && $item_panels[i][1] == "Item"
- end
- end
- for i in 0...$item_panels.size
- return $item_panels[i] if $item_panels[i][3] == id && $item_panels[i][1] == "Armor"
- end
- return false
- end
- end
- class Game_Actor < Game_Battler
- attr_accessor :bag
- alias initcj2 initialize
- def initialize(actor_id)
- initcj2(actor_id)
- @bag = {}
- end
- def equip_item(item_id,n = 1)
- if item_id > 0
- @bag[item_id] = item_number(item_id) + n
- end
- $game_party.lose_item(item_id,n)
- end
- def unequip_item(item_id,n = 1)
- n = -(n)
- if item_id > 0
- @bag[item_id] = item_number(item_id) + n
- end
- $game_party.gain_item(item_id,n)
- end
- def item_number(item_id)
- # If quantity data is in the hash, use it. If not, return 0
- return @bag.include?(item_id) ? @bag[item_id] : 0
- end
- #--------------------------------------------------------------------------
- # * Determine if Item is Usable
- # item_id : item ID
- #--------------------------------------------------------------------------
- def item_can_use?(item_id)
- # If item quantity is 0
- if item_number(item_id) == 0
- # Unusable
- return false
- end
- # Get usable time
- occasion = $data_items[item_id].occasion
- # If in battle
- if $game_temp.in_battle
- # If useable time is 0 (normal) or 1 (only battle) it's usable
- return (occasion == 0 or occasion == 1)
- end
- # If useable time is 0 (normal) or 2 (only menu) it's usable
- return (occasion == 0 or occasion == 2)
- end
- end
- #==============================================================================
- # ** Window_Item
- #------------------------------------------------------------------------------
- # This window displays items in possession on the item and battle screens.
- #==============================================================================
- class Window_Item < Window_Selectable
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize(actor = nil)
- super(0, 64, 640, 416)
- @actor = actor
- @column_max = 2
- refresh
- self.index = 0
- # If in battle, move window to center of screen
- # and make it semi-transparent
- if $game_temp.in_battle
- self.y = 64
- self.height = 256
- self.back_opacity = 160
- end
- end
- #--------------------------------------------------------------------------
- # * Get Item
- #--------------------------------------------------------------------------
- def item
- return @data[self.index]
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- end
- @data = []
- # Add item
- #if $game_temp.in_battle
- if COTTONJJ::ITEMBAG == false
- for i in 1...$data_items.size
- if $game_party.item_number(i) > 0
- @data.push($data_items[i])
- end
- end
- else
- if $game_temp.in_battle
- for i in 1...$data_items.size
- if @actor != nil
- if @actor.item_number(i) > 0
- @data.push($data_items[i])
- end
- end
- end
- else
- for i in 1...$data_items.size
- if $game_party.item_number(i) > 0
- @data.push($data_items[i])
- end
- end
- end
- end
- # Also add weapons and items if outside of battle
- unless $game_temp.in_battle
- for i in 1...$data_weapons.size
- if $game_party.weapon_number(i) > 0
- @data.push($data_weapons[i])
- end
- end
- for i in 1...$data_armors.size
- if $game_party.armor_number(i) > 0
- @data.push($data_armors[i])
- end
- end
- end
- # If item count is not 0, make a bit map and draw all items
- @item_max = @data.size
- if @item_max > 0
- self.contents = Bitmap.new(width - 32, row_max * 32)
- for i in 0...@item_max
- draw_item(i)
- end
- end
- end
- #--------------------------------------------------------------------------
- # * Draw Item
- # index : item number
- #--------------------------------------------------------------------------
- def draw_item(index)
- item = @data[index]
- case item
- when RPG::Item
- if @actor != nil && COTTONJJ::ITEMBAG == true
- number = @actor.item_number(item.id)
- else
- number = $game_party.item_number(item.id)
- end
- when RPG::Weapon
- number = $game_party.weapon_number(item.id)
- when RPG::Armor
- number = $game_party.armor_number(item.id)
- end
- if @actor != nil && COTTONJJ::ITEMBAG == true
- b = @actor.item_can_use?(item.id)
- else
- b = $game_party.item_can_use?(item.id)
- end
- if item.is_a?(RPG::Item) and b == true
- self.contents.font.color = normal_color
- else
- self.contents.font.color = disabled_color
- end
- x = 4 + index % 2 * (288 + 32)
- y = index / 2 * 32
- rect = Rect.new(x, y, self.width / @column_max - 32, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- bitmap = RPG::Cache.icon(item.icon_name)
- opacity = self.contents.font.color == normal_color ? 255 : 128
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
- self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
- self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
- self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
- end
- #--------------------------------------------------------------------------
- # * Help Text Update
- #--------------------------------------------------------------------------
- def update_help
- @help_window.set_text(self.item == nil ? "" : self.item.description)
- end
- end
- class Scene_Battle
- def start_item_select
- # Make item window
- @item_window = Window_Item.new(@active_battler == nil ? @active_actor : @active_battler)
- # Associate help window
- @item_window.help_window = @help_window
- # Disable actor command window
- @actor_command_window.active = false
- @actor_command_window.visible = false
- end
- #--------------------------------------------------------------------------
- # * Item action result compilation
- #--------------------------------------------------------------------------
- def make_item_action_result(battler = nil)
- if COTTONJJ::RTAB == true
- # Acquiring the item
- @item = $data_items[battler.current_action.item_id]
- # When with the item and so on is cut off and it becomes not be able to use
- if battler.is_a?(Game_Actor)
- b = battler.item_can_use?(@item.id)
- else
- b = $game_party.item_can_use?(@item.id)
- end
- unless b == true
- # It moves to step 6
- battler.phase = 6
- return
- end
- # In case of consumable
- if @item.consumable
- # The item which you use is decreased 1
- $game_party.lose_item(@item.id, 1)
- end
- # Setting animation ID
- battler.anime1 = @item.animation1_id
- battler.anime2 = @item.animation2_id
- # Setting common event ID
- battler.event = @item.common_event_id
- # Deciding the object
- index = battler.current_action.target_index
- target = $game_party.smooth_target_actor(index)
- # Setting the object side battler
- set_target_battlers(@item.scope, battler)
- # Applying the effect of the item
- for target in battler.target
- target.item_effect(@item, battler)
- end
- else
- # Get item
- @item = $data_items[@active_battler.current_action.item_id]
- # If unable to use due to items running out
- if @active_battler.is_a?(Game_Actor) && COTTONJJ::ITEMBAG == true
- b = @active_battler.item_can_use?(@item.id)
- else
- b = $game_party.item_can_use?(@item.id)
- end
- unless b == true
- # It moves to step 6
- @phase4_step = 1
- return
- end
- # If consumable
- if @item.consumable
- # Decrease used item by 1
- $game_party.lose_item(@item.id, 1)
- end
- # Display item name on help window
- @help_window.set_text(@item.name, 1)
- # Set animation ID
- @animation1_id = @item.animation1_id
- @animation2_id = @item.animation2_id
- # Set common event ID
- @common_event_id = @item.common_event_id
- # Decide on target
- index = @active_battler.current_action.target_index
- target = $game_party.smooth_target_actor(index)
- # Set targeted battlers
- set_target_battlers(@item.scope)
- # Apply item effect
- for target in @target_battlers
- target.item_effect(@item)
- end
- end
- end
- #--------------------------------------------------------------------------
- # * Frame renewal (actor command phase: Item selection)
- #--------------------------------------------------------------------------
- def update_phase3_item_select
- if COTTONJJ::RTAB == true
- # During command selecting when it becomes incapacitation,
- unless @active_actor.inputable?
- @active_actor.current_action.clear
- command_delete
- # To command input of the following actor
- phase3_next_actor
- return
- end
- # The item window is put in visible state
- @item_window.visible = true
- # Renewing the item window
- @item_window.update
- # The B when button is pushed,
- if Input.trigger?(Input::B)
- # Performing cancellation SE
- $game_system.se_play($data_system.cancel_se)
- # End selection of item
- end_item_select
- return
- end
- #When C button is pushed,
- if Input.trigger?(Input::C)
- # Acquiring the data which presently is selected in the item window
- @item = @item_window.item
- if @active_actor.is_a?(Game_Actor) && COTTONJJ::ITEMBAG == true
- b = @active_actor.item_can_use?(@item.id)
- else
- b = $game_party.item_can_use?(@item.id)
- end
- # When you cannot use,
- unless b == true
- # Performing buzzer SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # Performing decision SE
- $game_system.se_play($data_system.decision_se)
- # Setting action
- @active_actor.current_action.item_id = @item.id
- # The item window is put in invisibility state
- @item_window.visible = false
- # When the effective range is the enemy single unit,
- if @item.scope == 1
- # Starting the selection of the enemy
- start_enemy_select
- # When the effective range is the friend single unit,
- elsif @item.scope == 3 or @item.scope == 5
- # Starting the selection of the actor
- start_actor_select
- # When the effective range is not the single unit,
- else
- # Setting action
- @active_actor.current_action.kind = 2
- # End selection of item
- end_item_select
- # To command input of the following actor
- phase3_next_actor
- end
- return
- end
- else
- # Make item window visible
- @item_window.visible = true
- # Update item window
- @item_window.update
- # If B button was pressed
- if Input.trigger?(Input::B)
- # Play cancel SE
- $game_system.se_play($data_system.cancel_se)
- # End item selection
- end_item_select
- return
- end
- # If C button was pressed
- if Input.trigger?(Input::C)
- # Get currently selected data on the item window
- @item = @item_window.item
- # If it can't be used
- if @active_actor.is_a?(Game_Actor) && COTTONJJ::ITEMBAG == true
- b = @active_actor.item_can_use?(@item.id)
- else
- b = $game_party.item_can_use?(@item.id)
- end
- # When you cannot use,
- unless b == true
- # Performing buzzer SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # Play decision SE
- $game_system.se_play($data_system.decision_se)
- # Set action
- @active_battler.current_action.item_id = @item.id
- # Make item window invisible
- @item_window.visible = false
- # If effect scope is single enemy
- if @item.scope == 1
- # Start enemy selection
- start_enemy_select
- # If effect scope is single ally
- elsif @item.scope == 3 or @item.scope == 5
- # Start actor selection
- start_actor_select
- # If effect scope is not single
- else
- # End item selection
- end_item_select
- # Go to command input for next actor
- phase3_next_actor
- end
- return
- end
- end
- end
- end
- class Scene_Title
- alias cjupdate update
- def update
- if $DEBUG
- if Input.trigger?(Input::R)
- print("...:Weapons:...")
- g = []
- for k in 0...$item_panels.size
- if $item_panels[k][1] == "Weapon"
- for i in 1...$data_weapons.size
- if $item_panels[k][3] == i
- g.push($data_weapons[i])
- end
- end
- end
- end
- if g.empty? == false
- p = $data_weapons.dup
- for i in 0...g.size
- p.delete(g[i])
- end
- end
- if p != nil
- for i in 0...p.size
- if p[i] != nil
- print p[i],"\n",p[i].name,"\n",p[i].id
- end
- end
- if p.compact.empty?
- print("None")
- end
- end
- print("...:Armors:...")
- g = []
- for k in 0...$item_panels.size
- if $item_panels[k][1] == "Armor"
- for i in 1...$data_armors.size
- if $item_panels[k][3] == i
- g.push($data_armors[i])
- end
- end
- end
- end
- if g.empty? == false
- p = $data_armors.dup
- for i in 0...g.size
- p.delete(g[i])
- end
- end
- if p != nil
- for i in 0...p.size
- if p[i] != nil
- print p[i],"\n",p[i].name,"\n",p[i].id
- end
- end
- if p.compact.empty?
- print("None")
- end
- end
- print("...:Items:...")
- g = []
- for k in 0...$item_panels.size
- if $item_panels[k][1] == "Item"
- for i in 1...$data_items.size
- if $item_panels[k][3] == i
- g.push($data_items[i])
- end
- end
- end
- end
- if g.empty? == false
- p = $data_items.dup
- for i in 0...g.size
- p.delete(g[i])
- end
- end
- if p != nil
- for i in 0...p.size
- if p[i] != nil
- print p[i],"\n",p[i].name,"\n",p[i].id
- end
- end
- if p.compact.empty?
- print("None")
- end
- end
- j = false
- for k in 0...$item_panels.size
- if $item_panels[k][1] == "Skill"
- j = true
- end
- end
- if j == true
- print("...:Skills:...")
- g = []
- for k in 0...$item_panels.size
- if $item_panels[k][1] == "Skill"
- for i in 1...$data_skills.size
- if $item_panels[k][3] == i
- g.push($data_skills[i])
- end
- end
- end
- end
- if g.empty? == false
- p = $data_skills.dup
- for i in 0...g.size
- p.delete(g[i])
- end
- end
- if p != nil
- for i in 0...p.size
- if p[i] != nil
- print p[i],"\n",p[i].name,"\n",p[i].id
- end
- end
- if p.compact.empty?
- print("None")
- end
- end
- end
- end
- end
- cjupdate
- #$data_skills = load_data("Data/Skills.rxdata")
- #$data_items = load_data("Data/Items.rxdata")
- #$data_weapons = load_data("Data/Weapons.rxdata")
- #$data_armors = load_data("Data/Armors.rxdata")
- end
- end
- #==============================================================================
- # ** Scene_Save
- #------------------------------------------------------------------------------
- # This class performs save screen processing.
- #==============================================================================
- class Scene_Save < Scene_File
- #--------------------------------------------------------------------------
- # * Alias Methods
- #--------------------------------------------------------------------------
- alias cjwsd write_save_data
- #--------------------------------------------------------------------------
- # * Write Save Data
- # file : write file object (opened)
- #--------------------------------------------------------------------------
- def write_save_data(file)
- # Call original method
- cjwsd(file)
- # Write save data
- Marshal.dump($panels, file)
- Marshal.dump($panels2, file)
- Marshal.dump($panels3, file)
- end
- end
- #==============================================================================
- # ** Scene_Load
- #------------------------------------------------------------------------------
- # This class performs load screen processing.
- #==============================================================================
- class Scene_Load < Scene_File
- #--------------------------------------------------------------------------
- # * Alias Methods
- #--------------------------------------------------------------------------
- alias cjrsd read_save_data
- #--------------------------------------------------------------------------
- # * Read Save Data
- # file : file object for reading (opened)
- #--------------------------------------------------------------------------
- def read_save_data(file)
- # Call original method
- cjrsd(file)
- # Load saved data
- #$panels = []
- #$panels2 = []
- #$panels3 = []
- #$panels.load_save(Marshal.load(file))
- $panels = Marshal.load(file)
- $panels2 = Marshal.load(file)
- $panels3 = Marshal.load(file)
- end
- end
- if COTTONJJ::CUSTOMXY == true
- class Game_Actor < Game_Battler
- def screen_x
- # Return after calculating x-coordinate by order of members in party
- if self.index != nil
- return self.index * 40 + 50
- else
- return 0
- end
- end
- def screen_y
- return 370 - (self.index * 30 + 50)
- end
- end
- class Game_Enemy < Game_Battler
- def screen_x
- if $game_troop.enemies.size > 4
- o = 280
- else
- o = 400
- end
- # Return after calculating x-coordinate by order of members in party
- return o + @member_index * 40 + 50
- end
- def screen_y
- return 370 - ((@member_index % 4) * 30 + 50)
- end
- end
- end
Expand to see the code.
Instructions
Edit the items in the tab labeled item database. x = blank panel. l = linkable panel, o = item panel.
LEVELUP = 1 (ID of the Level Up Item)
LEVELUPDOUBLER = 2 (ID of the Level Doubler Item)
LEVELUPTRIPLER = 3 (ID of the Level Tripler Item)
ASSISTITEMS = [1,2,3] (IDs of assist items) (LevelUps)
ASSISTARMORS = [1,2,3,4] (IDs of assist armors) (Weapon and Armor Links)
ABILITYVAR = 1 (ID of Ability changing armor)
$weapon_abilities[1] = [2,3,4] ...[Weapon ID] = [Skill IDs Learned from Ability Armors]
$armor_abilities[8] = [9] ...[Weapon ID] = [Skill IDs Learned from Ability Armors]
Visual Equipment
ARMOR[6] = "_outfit1" (ArmorID = armor name augment)
WEAPON[1] = "_weapon1" (WeaponID = armor name augment)
Compatibility
Made to work with te rtab and rpg maker xp
Credits and Thanks
Kain. Demonfire
Author's Notes
If there are any questions or comments... requests? here.
Terms and Conditions
---