Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =begin
- ===============================================================================
- Frysning fuse/split skills.
- ===============================================================================
- With this script you can combine 2 skills in a new one and split that skill back
- in the notetag of the skill use <fuse for combining a skill with an other.
- <fuse [2,80]> means that this skill and skill 2 together will become skill 80
- You can add as much skill sets if you want.
- <fuse [[2,80],[3,81],[4,82]] > etc
- For splitting a skill use:
- <split [1,2]> When this skill is splitted it will give back skill and 1 and 2.
- Split can only contain 2 skill!.
- After combining 2 skills the player will lose them for that actor.
- Splitting them will forget the fused skill and give back the 2 base one's.
- If you want to add to an event just use
- SceneManager.call(Scene_Fusion) for the fusion part.
- SceneManager.call(Scene_Split) for the split part.
- No credits needed, would be great though.
- If you got suggestions/bugs or anything.
- Message on
- http://www.rpgmakervxace.net/
- or
- pastebin
- or reddit
- =end
- #Fusion Start
- class Scene_Fusion < Scene_MenuBase
- @actor_id
- def initialize
- super
- @main_window = Window_MenuStatus.new(0,0)
- @main_window.activate()
- @main_window.select(0)
- @main_window.set_handler(:ok, method(:list_ok))
- @main_window.set_handler(:cancel, method(:list_cancel))
- end
- def update
- super
- if @combineList != nil
- if @combineList.visible == true
- if @detail == nil
- @detail = Window_SkillLearn.new
- else
- @detail.show
- end
- if @combineList.current_item != nil
- @detail.setID(@combineList.current_item[:learnID])
- end
- end
- end
- end
- def list_cancel
- SceneManager.return
- end
- def list_ok
- @main_window.hide
- if @help_window == nil
- @help_window = Window_Help.new(1)
- else
- @help_window.show
- end
- index = @main_window.index
- @help_window.set_text( $game_party.members[index].name)
- if @skill_list == nil
- @skill_list = Window_SkillListPlayer.new
- else
- @skill_list.show
- end
- @actor_id = $game_party.members[index].id
- @skill_list.actorId(@actor_id)
- @skill_list.activate()
- @skill_list.select(0)
- @skill_list.refresh
- @skill_list.set_handler(:cancel, method(:skill_list_cancel))
- @skill_list.set_handler(:ok, method(:skill_list_ok))
- end
- def skill_list_cancel
- @skill_list.hide
- @help_window.hide
- if @combineList != nil
- @combineList.hide
- end
- @main_window.show
- @main_window.refresh
- @main_window.activate()
- @skill_list.select(0)
- end
- def skill_list_ok
- #Getting the current note of the item for the skills
- #that are fuseable
- #We store that info in a tempory string.
- if @skill_list.current_item.note =~ /<fuse (.*)>/i
- tString = $1.split("],[")
- end
- #We get the skills that the actor has and are combineble.
- skills = @skill_list.gData
- #make an empty array to store temporty data.
- uArra=[]
- #loop to the temporty array. to make a new array
- #[n1,n2],[n1,n2]
- tString.each do | item |
- uArra.push(makeArray(item))
- end
- #We make a final skill array that stores the skills.
- finalSkillArray = []
- #We loop through the tempory array.
- #We loop trhought the skills of the actor.
- #if the actor has the current skill and the skill is the array
- #they both get added to the final list.
- uArra.each do | is |
- skills.each do | id, skills |
- if is[0] == id.id.to_s
- finalSkillArray.push(is)
- end
- end
- end
- #we create the second window for the second skills
- #if it does not excist
- #if it excist we show it.
- if@combineList == nil
- @combineList = Window_SkillListSecond.new
- else
- @combineList.show
- end
- #we update the need list so we see which skills can fuse.
- #we activate it and select the first entry.
- @combineList.need_list(finalSkillArray)
- @combineList.refresh
- @combineList.activate()
- @combineList.select(0)
- #we create the handlers for canceling or pressing ok.
- @combineList.set_handler(:ok, method(:SkillListSecond_ok))
- @combineList.set_handler(:cancel, method(:SkillListSecond_cancel))
- end
- def SkillListSecond_cancel
- @detail.hide
- @combineList.hide
- @skill_list.activate()
- end
- def SkillListSecond_ok
- if @command_window == nil
- @command_window = Window_LearnSkill.new
- @command_window.x = Graphics.width / 2 - @command_window.width / 2
- @command_window.y = Graphics.height / 2 - @command_window.height / 2
- @command_window.set_handler(:learn, method(:learn))
- @command_window.set_handler(:cancel, method(:f_cancel))
- @command_window.width = 300
- else
- @command_window.show
- end
- if @combineList.current_item != nil
- @command_window.Set(@combineList.current_item[:learnID])
- @command_window.refresh
- @command_window.select(0)
- @command_window.activate
- @command_window.open
- end
- end
- def learn
- @command_window.close
- $game_actors[@actor_id].learn_skill(@combineList.current_item[:learnID])
- $game_actors[@actor_id].forget_skill(@combineList.current_item[:thisID])
- $game_actors[@actor_id].forget_skill( @skill_list.current_item.id)
- @skill_list.refresh
- @skill_list.activate()
- @skill_list.select(0)
- @combineList.hide
- @detail.hide
- @command_window.hide
- end
- def f_cancel
- @command_window.close
- @combineList.refresh
- @combineList.activate
- end
- def makeArray(stringf)
- replacestring = stringf.gsub('[', '').gsub(']', '').gsub(' ', '')
- replacestring.split(',')
- end
- end
- class Window_SkillListPlayer < Window_ItemList
- def initialize
- super(0,48,Graphics.width-Graphics.width/5*4,Graphics.height-48)
- end
- def make_item_list
- @data = []
- actor = $game_actors[@id]
- actor.skills.each do | feature |
- if feature.note =~ /<fuse (.*)>/i
- @data.push(feature)
- end
- end
- @data.push(nil) if @data.empty?
- end
- def gData
- @data
- end
- def draw_item(index)
- contents.font.size = 18
- item = @data[index]
- if item
- rect = item_rect(index)
- rect.width -= 4
- text = item.name
- draw_text(rect, text)
- end
- end
- def col_max; 1; end
- def current_item
- @data[@index]
- end
- def actorId(id)
- @id = id
- end
- def current_item_enabled?
- true
- end
- end
- class Window_SkillListSecond < Window_ItemList
- def initialize
- super(Graphics.width-Graphics.width/5*4,48,Graphics.width-Graphics.width/5*4,Graphics.height-48)
- end
- def make_item_list
- @data = []
- bigItem = {}
- @fArray.each do | item |
- bigItem = { :thisID =>Integer(item[0]),
- :name => $data_skills[Integer(item[0])].name,
- :learnID => Integer(item[1])}
- @data.push(bigItem)
- end
- @data.push(nil) if @data.empty?
- end
- def draw_item(index)
- contents.font.size = 18
- item = @data[index]
- if item
- rect = item_rect(index)
- rect.width -= 4
- text = item[:name]
- draw_text(rect, text)
- end
- end
- def need_list(data)
- @fArray = data
- end
- def col_max; 1; end
- def current_item
- @data[@index]
- end
- def current_item_enabled?
- true
- end
- end
- class Window_SkillLearn < Window_Base
- def initialize
- super(Graphics.width/5*2,48,Graphics.width-Graphics.width/5*1,Graphics.height-48)
- end
- def refresh
- contents.clear
- contents.font.size = 18
- return unless @id
- draw_text(0,0, contents.width, line_height, $data_skills[@id].name)
- end
- def setID(id)
- @id =id
- refresh
- end
- end
- class Window_LearnSkill < Window_Command
- def initialize
- super(0,0)
- self.openness = 0
- end
- def Set(skillid)
- @id = skillid
- end
- def make_command_list
- return unless @id
- add_command("Learn Skill #{$data_skills[@id].name}", :learn)
- add_command("Cancel", :cancel)
- end
- def window_height
- fitting_height(2)
- end
- end
- #Split part of the script.
- class Scene_Split < Scene_MenuBase
- @actor_id
- def initialize
- super
- @main_window = Window_MenuStatus.new(0,0)
- @main_window.activate()
- @main_window.select(0)
- @main_window.set_handler(:ok, method(:list_ok))
- @main_window.set_handler(:cancel, method(:list_cancel))
- end
- def update
- super
- if @skill_list != nil
- if @skill_list.current_item != nil
- if @skill_list.current_item.note =~ /<split (.*)>/i
- @skillArray = makeArray($1)
- @descriptions.setID(@skillArray)
- end
- end
- end
- end
- def list_cancel
- SceneManager.return
- end
- def list_ok
- @main_window.hide
- if @help_window == nil
- @help_window = Window_Help.new(1)
- else
- @help_window.show
- end
- index = @main_window.index
- @help_window.set_text( $game_party.members[index].name)
- if @skill_list == nil
- @skill_list = Window_FusedListPlayer.new
- else
- @skill_list.show
- end
- @actor_id = $game_party.members[index].id
- @skill_list.actorId(@actor_id)
- @skill_list.activate()
- @skill_list.select(0)
- @skill_list.refresh
- @skill_list.set_handler(:cancel, method(:skill_list_cancel))
- @skill_list.set_handler(:ok, method(:skill_list_ok))
- @descriptions = Window_SkillForget.new
- end
- def skill_list_cancel
- @skill_list.hide
- @help_window.hide
- @descriptions.hide
- @main_window.show
- @main_window.refresh
- @main_window.activate()
- @skill_list.select(0)
- end
- def skill_list_ok
- if @command_window == nil
- @command_window = Window_ForgetSkill.new
- @command_window.x = Graphics.width / 2 - @command_window.width / 2
- @command_window.y = Graphics.height / 2 - @command_window.height / 2
- @command_window.set_handler(:forget, method(:forget_skills))
- @command_window.set_handler(:cancel, method(:f_cancel))
- @command_window.width = 300
- else
- @command_window.show
- end
- @command_window.Set(@skill_list.current_item.id)
- @command_window.refresh
- @command_window.select(0)
- @command_window.activate
- @command_window.open
- end
- def forget_skills
- @command_window.close
- $game_actors[@actor_id].forget_skill(@forgotid)
- $game_actors[@actor_id].learn_skill(Integer(@skillArray[0]))
- $game_actors[@actor_id].learn_skill(Integer(@skillArray[0]))
- @skill_list.refresh
- @skill_list.activate()
- @skill_list.select(0)
- @descriptions.hide
- @command_window.hide
- end
- def f_cancel
- @command_window.close
- @skill_list.refresh
- @skill_list.activate()
- @skill_list.select(0)
- end
- def makeArray(stringf)
- replacestring = stringf.gsub('[', '').gsub(']', '').gsub(' ', '')
- replacestring.split(',')
- end
- end
- class Window_FusedListPlayer < Window_ItemList
- def initialize
- super(0,48,Graphics.width-Graphics.width/5*4,Graphics.height-48)
- end
- def make_item_list
- @data = []
- actor = $game_actors[@id]
- actor.skills.each do | feature |
- if feature.note =~ /<split (.*)>/i
- @data.push(feature)
- end
- end
- @data.push(nil) if @data.empty?
- end
- def gData
- @data
- end
- def draw_item(index)
- contents.font.size = 18
- item = @data[index]
- if item
- rect = item_rect(index)
- rect.width -= 4
- text = item.name
- draw_text(rect, text)
- end
- end
- def col_max; 1; end
- def current_item
- @data[@index]
- end
- def actorId(id)
- @id = id
- end
- def current_item_enabled?
- true
- end
- end
- class Window_SkillForget < Window_Base
- def initialize
- super(Graphics.width/5*2,48,Graphics.width-Graphics.width/5*1,Graphics.height-48)
- end
- def refresh
- contents.clear
- contents.font.size = 18
- return unless @id
- draw_text(0,0, contents.width, line_height, $data_skills[@id].name)
- draw_text(0,18, contents.width, line_height, $data_skills[@id2].name)
- end
- def setID(id)
- @id =Integer(id[0])
- @id2 = Integer(id[1])
- refresh
- end
- end
- class Window_ForgetSkill < Window_Command
- def initialize
- super(0,0)
- self.openness = 0
- end
- def Set(skillid)
- @id = skillid
- end
- def make_command_list
- return unless @id
- add_command("Forget Skill #{$data_skills[@id].name}", :forget)
- add_command("Cancel", :cancel)
- end
- def window_height
- fitting_height(2)
- end
- end
- #Delete this if you don't want to special colors.
- class Window_SkillList < Window_Selectable
- def draw_item(index)
- skill = @data[index]
- if skill
- rect = item_rect(index)
- rect.width -= 4
- draw_item_nameThing(skill, rect.x, rect.y, enable?(skill))
- draw_skill_cost(rect, skill)
- end
- end
- def draw_item_nameThing(item, x, y, enabled = true, width = 172)
- return unless item
- draw_icon(item.icon_index, x, y, enabled)
- if item.note =~ /<split (.*)>/i then
- change_color(text_color(14), enabled)
- elsif item.note =~ /<fuse (.*)>/i then
- change_color(text_color(3), enabled)
- else
- change_color(normal_color, enabled)
- end
- draw_text(x + 24, y, width, line_height, item.name)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement