¡Bienvenido a Universo Maker!
¿Es esta la primera vez que visitas el foro? Si es así te recomendamos que te registres para tener completo acceso a todas las áreas y secciones del foro, así también podrás participar activamente en la comunidad. Si ya tienes una cuenta, conectate cuanto antes.
Iniciar Sesión Registrarme

No estás conectado. Conéctate o registrate

Ver el tema anterior Ver el tema siguiente Ir abajo Mensaje [Página 1 de 1.]

#1 [RM ACE] Árbol de habilidades de Raizen el Miér Sep 17, 2014 12:40 pm

Reputación del mensaje :100% (2 votos)

caleb465

avatar

   
Árbol de habilidades
   RPG Maker VX Ace
Os traigo un script que he encontrado que incluye un árbol de habilidades, como los hay en muchos RPGs, el script es muy personalizable, por lo que dice el autor.
   
Sobre el Script:
Las habilidades pueden requerir cierto nivel en la habilidad anterior para poder desbloquearlas, puedes adjuntar una imagen a su habilidad correspondiente, pero no es necesario.
Imágenes: Ninguna, pero hay un "tráiler"
Imagen 1 - Imagen 2
Instrucciones:
Paso 1: Instalar el script normalmente
   ♦ Paso 2: Editarlo a placer
   
Código:

Enlace de Descarga

Código:
Aqui va el codigo del script [RGSS/2/3]#=======================================================
#         Lune Unlimited Skill Tree
# Author: Raizen
# Comunitty: www.centrorpg.com
# Classic Skill Tree, used in many RPG Games, like
# Diablo, Ragnarok... And many others
#=======================================================

#=======================================================
# Don't modify!!
#=======================================================
$imported = {} if $imported == nil
$imported[:Lune_Skill_Tree] = true
module Lune_Skill_Tree
$data_actors = load_data("Data/Actors.rvdata2")
Actor = Array.new($data_actors.size, Array.new)
#=======================================================
#         Image and basic Settings
#=======================================================

# Add a skill point when leveling?
Add_Skill_pt = true

# To add points manually, just
# Script: add_tree_points(actor_id, points)
# actor_id is the id of the actor, points the quantity.

# Name of cursor image
Cursor = "cursor"
# X axis correction of the cursor position
Cursor_X = 20
# Y axis correction of the cursor position
Cursor_Y = 20


# Image for character selection
# Default size of image for Ace is 384x416, if you do not wish
# an extra image put '' on image name.
Actor_Select = 'actor_select'

#=======================================================
#         Windows and font configuration
#=======================================================
# Size of description window
Win_Size = 100
# Window Opacity, if images are used, put 0
Opacity = 0

# Size of Skill font
Font_Skills = 16
# Size of Description font
Font_Help = 22
# Font Name, put '' to get the default font.
Font_Name = ""

# Correction of skill info position.
Corr_X = -10
Corr_Y = 20

# Position of the text of the total points
Text_Y = 280
Text_X = 100
# Texto
Text = 'Total Points: '


# Text on Option Window
Bot1 = 'Use'
Bot2 = 'Add Point'
Bot3 = 'Cancel'



#=========================================================================
# Actor 8 => Main Configuration
# Note that 0 on the skill parts is the main configuration for that actor.
#=========================================================================
Actor[8][0] = {
# Images of the skill trees, put as many as wanted
# if you do not wish to have images, put '' on the name place
'Tree_Images' => ['fundo save', 'fundo save2'],
# Position of the cursors that change between the trees.
'Tree_Shift' => [[400, 50], [400, 80]],
}
  #=========================================================================
  # Actor 8 => Skill 1 -> Fire                                  
  #=========================================================================
Actor[8][1] = {
'Skill_id' => 51, # Skill ID in the Database
'Maxlevel' => 10, # Skill Maximum Level
'Multiply' => 30, # Effect Multiplier in %, 100 = 100%
'Level' => 1, # Necessary level to add points on the skill
'Level_Add' => 2, # Level Restriction for every point on the skill
'Tree' => 1, # The tree that this skill is on
'Left' => 0, # Skill to the left, 0 for none
'Right' => 4, # Skill to the right, 0 for none
'Down' => 2, # Skill below, 0 for none
'Up' => 0, # Skill above, 0 for none
'X' => 30, # Icon Position in X
'Y' => 50, # Icon Position in Y
'Image' => 'Fire', # Icon Image, for default icons put ''
'Req_skills' => [], # Needed skills to open this skill, any quantity
'Req_levels' => [], # Same as above, but with the levels of each skill
'Desc1' => 'Fire', # Description 1
'Desc2' => 'Requirements: Level 1 + 2x Skill Level', # Description 2
'Desc3' => '', # Description 3
}
  #=========================================================================
  # Actor 8 => Skill 2 -> Flare                                  
  #=========================================================================
Actor[8][2] = {
'Skill_id' => 53, # Skill ID in the Database
'Maxlevel' => 10, # Skill Maximum Level
'Multiply' => 30, # Effect Multiplier in %, 100 = 100%
'Level' => 5, # Necessary level to add points on the skill
'Level_Add' => 3, # Level Restriction for every point on the skill
'Tree' => 1, # The tree that this skill is on
'Left' => 0, # Skill to the left, 0 for none
'Right' => 5, # Skill to the right, 0 for none
'Down' => 3, # Skill below, 0 for none
'Up' => 1, # Skill above, 0 for none
'X' => 30, # Icon Position in X
'Y' => 150, # Icon Position in Y
'Image' => 'Flare', # Icon Image, for default icons put ''
'Req_skills' => [51], # Needed skills to open this skill, any quantity
'Req_levels' => [5], # Same as above, but with the levels of each skill
'Desc1' => 'Flare', # Description 1
'Desc2' => 'Requirements: Level 5 + 3x Skill Level', # Description 2
'Desc3' => '', # Description 3
}
  #=========================================================================
  # Actor 8 => Skill 3 -> Blaze                                
  #=========================================================================
Actor[8][3] = {
'Skill_id' => 54, # Skill ID in the Database
'Maxlevel' => 5, # Skill Maximum Level
'Multiply' => 30, # Effect Multiplier in %, 100 = 100%
'Level' => 20, # Necessary level to add points on the skill
'Level_Add' => 5, # Level Restriction for every point on the skill
'Tree' => 1, # The tree that this skill is on
'Left' => 0, # Skill to the left, 0 for none
'Right' => 0, # Skill to the right, 0 for none
'Down' => 0, # Skill below, 0 for none
'Up' => 2, # Skill above, 0 for none
'X' => 30, # Icon Position in X
'Y' => 250, # Icon Position in Y
'Image' => 'Blaze', # Icon Image, for default icons put ''
'Req_skills' => [51, 53], # Needed skills to open this skill, any quantity
'Req_levels' => [7, 5], # Same as above, but with the levels of each skill
'Desc1' => 'Blaze', # Description 1
'Desc2' => 'Requirements: Level 20 + 5x Skill Level', # Description 2
'Desc3' => '', # Description 3
}
  #=========================================================================
  # Actor 8 => Skill 4 -> Wind                                
  #=========================================================================
Actor[8][4] = {
'Skill_id' => 67, # Skill ID in the Database
'Maxlevel' => 10, # Skill Maximum Level
'Multiply' => 30, # Effect Multiplier in %, 100 = 100%
'Level' => 1, # Necessary level to add points on the skill
'Level_Add' => 2, # Level Restriction for every point on the skill
'Tree' => 1, # The tree that this skill is on
'Left' => 1, # Skill to the left, 0 for none
'Right' => 6, # Skill to the right, 0 for none
'Down' => 5, # Skill below, 0 for none
'Up' => 0, # Skill above, 0 for none
'X' => 130, # Icon Position in X
'Y' => 50, # Icon Position in Y
'Image' => 'Wind', # Icon Image, for default icons put ''
'Req_skills' => [], # Needed skills to open this skill, any quantity
'Req_levels' => [], # Same as above, but with the levels of each skill
'Desc1' => 'Wind', # Description 1
'Desc2' => 'Requirements: Level 1 + 2x Skill Level', # Description 2
'Desc3' => '', # Description 3
}
  #=========================================================================
  # Actor 8 => Skill 5 -> Hurricane                                
  #=========================================================================
Actor[8][5] = {
'Skill_id' => 68, # Skill ID in the Database
'Maxlevel' => 5, # Skill Maximum Level
'Multiply' => 30, # Effect Multiplier in %, 100 = 100%
'Level' => 10, # Necessary level to add points on the skill
'Level_Add' => 5, # Level Restriction for every point on the skill
'Tree' => 1, # The tree that this skill is on
'Left' => 2, # Skill to the left, 0 for none
'Right' => 7, # Skill to the right, 0 for none
'Down' => 0, # Skill below, 0 for none
'Up' => 4, # Skill above, 0 for none
'X' => 130, # Icon Position in X
'Y' => 150, # Icon Position in Y
'Image' => 'Hurricane', # Icon Image, for default icons put ''
'Req_skills' => [67], # Needed skills to open this skill, any quantity
'Req_levels' => [5], # Same as above, but with the levels of each skill
'Desc1' => 'Hurricane', # Description 1
'Desc2' => 'Requirements: Level 10 + 5x Skill Level', # Description 2
'Desc3' => '', # Description 3
}
  #=========================================================================
  # Actor 8 => Skill 6 -> Ice                                
  #=========================================================================
Actor[8][6] = {
'Skill_id' => 55, # Skill ID in the Database
'Maxlevel' => 10, # Skill Maximum Level
'Multiply' => 30, # Effect Multiplier in %, 100 = 100%
'Level' => 1, # Necessary level to add points on the skill
'Level_Add' => 2, # Level Restriction for every point on the skill
'Tree' => 1, # The tree that this skill is on
'Left' => 4, # Skill to the left, 0 for none
'Right' => 8, # Skill to the right, 0 for none
'Down' => 7, # Skill below, 0 for none
'Up' => 0, # Skill above, 0 for none
'X' => 230, # Icon Position in X
'Y' => 50, # Icon Position in Y
'Image' => 'Ice', # Icon Image, for default icons put ''
'Req_skills' => [], # Needed skills to open this skill, any quantity
'Req_levels' => [], # Same as above, but with the levels of each skill
'Desc1' => 'Ice', # Description 1
'Desc2' => 'Requirements: Level 1 + 2x Skill Level', # Description 2
'Desc3' => '', # Description 3
}
  #=========================================================================
  # Actor 8 => Skill 7 -> Blizzard                                  
  #=========================================================================
Actor[8][7] = {
'Skill_id' => 57, # Skill ID in the Database
'Maxlevel' => 5, # Skill Maximum Level
'Multiply' => 30, # Effect Multiplier in %, 100 = 100%
'Level' => 10, # Necessary level to add points on the skill
'Level_Add' => 5, # Level Restriction for every point on the skill
'Tree' => 1, # The tree that this skill is on
'Left' => 5, # Skill to the left, 0 for none
'Right' => 9, # Skill to the right, 0 for none
'Down' => 0, # Skill below, 0 for none
'Up' => 6, # Skill above, 0 for none
'X' => 230, # Icon Position in X
'Y' => 150, # Icon Position in Y
'Image' => 'Blizzard', # Icon Image, for default icons put ''
'Req_skills' => [55], # Needed skills to open this skill, any quantity
'Req_levels' => [5], # Same as above, but with the levels of each skill
'Desc1' => 'Blizzard', # Description 1
'Desc2' => 'Requirements: Level 10 + 5x Skill Level', # Description 2
'Desc3' => '', # Description 3
}
  #=========================================================================
  # Actor 8 => Skill 8 -> Thunder                                  
  #=========================================================================
Actor[8][8] = {
'Skill_id' => 59, # Skill ID in the Database
'Maxlevel' => 10, # Skill Maximum Level
'Multiply' => 30, # Effect Multiplier in %, 100 = 100%
'Level' => 1, # Necessary level to add points on the skill
'Level_Add' => 2, # Level Restriction for every point on the skill
'Tree' => 1, # The tree that this skill is on
'Left' => 6, # Skill to the left, 0 for none
'Right' => 0, # Skill to the right, 0 for none
'Down' => 9, # Skill below, 0 for none
'Up' => 0, # Skill above, 0 for none
'X' => 330, # Icon Position in X
'Y' => 50, # Icon Position in Y
'Image' => 'thunder', # Icon Image, for default icons put ''
'Req_skills' => [], # Needed skills to open this skill, any quantity
'Req_levels' => [], # Same as above, but with the levels of each skill
'Desc1' => 'Thunder', # Description 1
'Desc2' => 'Requirements: Level 1 + 2x Skill Level', # Description 2
'Desc3' => '', # Description 3
}
  #=========================================================================
  # Actor 8 => Skill 9 -> Spark                                
  #=========================================================================
Actor[8][9] = {
'Skill_id' => 61, # Skill ID in the Database
'Maxlevel' => 5, # Skill Maximum Level
'Multiply' => 30, # Effect Multiplier in %, 100 = 100%
'Level' => 10, # Necessary level to add points on the skill
'Level_Add' => 5, # Level Restriction for every point on the skill
'Tree' => 1, # The tree that this skill is on
'Left' => 7, # Skill to the left, 0 for none
'Right' => 0, # Skill to the right, 0 for none
'Down' => 0, # Skill below, 0 for none
'Up' => 8, # Skill above, 0 for none
'X' => 330, # Icon Position in X
'Y' => 150, # Icon Position in Y
'Image' => 'Spark', # Icon Image, for default icons put ''
'Req_skills' => [59], # Needed skills to open this skill, any quantity
'Req_levels' => [5], # Same as above, but with the levels of each skill
'Desc1' => 'Spark', # Description 1
'Desc2' => 'Requirements: Level 10 + 5x Skill Level', # Description 2
'Desc3' => '', # Description 3
}
  #=========================================================================
  # Actor 8 => Skill 10 -> Cura                                
  #=========================================================================
Actor[8][10] = {
'Skill_id' => 26, # Skill ID in the Database
'Maxlevel' => 10, # Skill Maximum Level
'Multiply' => 20, # Effect Multiplier in %, 100 = 100%
'Level' => 1, # Necessary level to add points on the skill
'Level_Add' => 3, # Level Restriction for every point on the skill
'Tree' => 2, # The tree that this skill is on
'Left' => 0, # Skill to the left, 0 for none
'Right' => 12, # Skill to the right, 0 for none
'Down' => 11, # Skill below, 0 for none
'Up' => 0, # Skill above, 0 for none
'X' => 100, # Icon Position in X
'Y' => 100, # Icon Position in Y
'Image' => 'Cura1', # Icon Image, for default icons put ''
'Req_skills' => [], # Needed skills to open this skill, any quantity
'Req_levels' => [], # Same as above, but with the levels of each skill
'Desc1' => 'Basic Healing', # Description 1
'Desc2' => 'Requirements: Level 1 + 3x Skill Level', # Description 2
'Desc3' => '', # Description 3
}
  #=========================================================================
  # Actor 8 => Skill 11 -> Salvation                                  
  #=========================================================================
Actor[8][11] = {
'Skill_id' => 28, # Skill ID in the Database
'Maxlevel' => 10, # Skill Maximum Level
'Multiply' => 30, # Effect Multiplier in %, 100 = 100%
'Level' => 15, # Necessary level to add points on the skill
'Level_Add' => 5, # Level Restriction for every point on the skill
'Tree' => 2, # The tree that this skill is on
'Left' => 0, # Skill to the left, 0 for none
'Right' => 13, # Skill to the right, 0 for none
'Down' => 0, # Skill below, 0 for none
'Up' => 10, # Skill above, 0 for none
'X' => 100, # Icon Position in X
'Y' => 240, # Icon Position in Y
'Image' => 'Salvation', # Icon Image, for default icons put ''
'Req_skills' => [26], # Needed skills to open this skill, any quantity
'Req_levels' => [8], # Same as above, but with the levels of each skill
'Desc1' => 'Salvation - Advanced Healing', # Description 1
'Desc2' => 'Requirements: Level 15 + 5x Skill Level', # Description 2
'Desc3' => '', # Description 3
}
  #=========================================================================
  # Actor 8 => Skill 12 -> Attack Up                                  
  #=========================================================================
Actor[8][12] = {
'Skill_id' => 41, # Skill ID in the Database
'Maxlevel' => 7, # Skill Maximum Level
'Multiply' => 30, # Effect Multiplier in %, 100 = 100%
'Level' => 20, # Necessary level to add points on the skill
'Level_Add' => 5, # Level Restriction for every point on the skill
'Tree' => 2, # The tree that this skill is on
'Left' => 10, # Skill to the left, 0 for none
'Right' => 0, # Skill to the right, 0 for none
'Down' => 13, # Skill below, 0 for none
'Up' => 0, # Skill above, 0 for none
'X' => 300, # Icon Position in X
'Y' => 100, # Icon Position in Y
'Image' => 'Attack_Up', # Icon Image, for default icons put ''
'Req_skills' => [26, 11], # Needed skills to open this skill, any quantity
'Req_levels' => [10, 3], # Same as above, but with the levels of each skill
'Desc1' => 'Attack Up', # Description 1
'Desc2' => 'Requirements: Level 20 + 5x Skill Level', # Description 2
'Desc3' => '', # Description 3
}
  #=========================================================================
  # Actor 8 => Skill 13 -> Magic UP                                  
  #=========================================================================
Actor[8][13] = {
'Skill_id' => 120, # Skill ID in the Database
'Maxlevel' => 5, # Skill Maximum Level
'Multiply' => 40, # Effect Multiplier in %, 100 = 100%
'Level' => 25, # Necessary level to add points on the skill
'Level_Add' => 7, # Level Restriction for every point on the skill
'Tree' => 2, # The tree that this skill is on
'Left' => 11, # Skill to the left, 0 for none
'Right' => 0, # Skill to the right, 0 for none
'Down' => 0, # Skill below, 0 for none
'Up' => 12, # Skill above, 0 for none
'X' => 300, # Icon Position in X
'Y' => 240, # Icon Position in Y
'Image' => 'MagicUP', # Icon Image, for default icons put ''
'Req_skills' => [12], # Needed skills to open this skill, any quantity
'Req_levels' => [4], # Same as above, but with the levels of each skill
'Desc1' => 'Magic Up', # Description 1
'Desc2' => 'Requirements: Level 25 + 7x Skill Level', # Description 2
'Desc3' => '', # Description 3
}

  #=========================================================================
  # Actor 9 => Skill 1 -> ...                              
  #=========================================================================
  
  

end


#==============================================================================
# ** Scene_Skill
#------------------------------------------------------------------------------
#  Esta classe executa o processamento da tela de habilidades. Por conveniência
# dos processos em comum, as habilidades são tratdas como [Itens].
#==============================================================================

class Scene_Skill < Scene_ItemBase
include Lune_Skill_Tree
  #--------------------------------------------------------------------------
  # * Inicialização do processo
  #--------------------------------------------------------------------------
  def start
    super
    create_actor_window
    create_windows
    create_tree
    create_images
    create_variables
  end
  #--------------------------------------------------------------------------
  # * Criação das Janelas
  #--------------------------------------------------------------------------
  def create_windows
    @info_window = Sk_Tree_Window.new
    @dummy = []
    for n in 0...Actor[@actor.id][0]['Tree_Images'].size
      @dummy[n] = Window_Base.new(0, 0, Graphics.width, Graphics.height - Win_Size)
      @dummy[n].opacity = Opacity
      @dummy[n].opacity = 0 unless n == 0
    end
    @info_skill = Sk_Descri_Window.new(0, Graphics.height - Win_Size, Graphics.width, Win_Size)
    @info_window.refresh(@actor, 0)
    @info_skill.refresh(@actor.id, 1)
    @info_skill.opacity = Opacity
    @confirm = Window_Skill_Confirm.new # inicialização do menu de confirmação
    @confirm.set_handler(:use_skill, method(:determine_item))
    @confirm.set_handler(:use_point, method(:command_use_point))
    @confirm.set_handler(:return_window, method(:command_return))
    @confirm.close
    @confirm.active = false
    @actor_window = Window_MenuActor_Tree.new
    @actor_window.set_handler(:ok,     method(:on_actor_ok))
    @actor_window.set_handler(:cancel, method(:on_actor_cancel))
    @actor_window.z = 201
  end
  #--------------------------------------------------------------------------
  # * Criação de habilidades
  #--------------------------------------------------------------------------
  def create_tree
    @skills_icons = []
    for n in 1...Actor[@actor.id].size
      @skills_icons[n] = Sprite.new
      @skills_icons[n].bitmap = Cache.skill_tree(Actor[@actor.id][n]['Image'])
      @skills_icons[n].x = Actor[@actor.id][n]['X']
      @skills_icons[n].y = Actor[@actor.id][n]['Y']
      @skills_icons[n].z = 199
      @skills_icons[n].opacity = 150 if $game_actors[@actor.id].skill_tree[Actor[@actor.id][n]['Skill_id']] == 0
    end
    @skills_icons.each_index {|n| @skills_icons[n].opacity = 0 if Actor[@actor.id][n]['Tree'] != 1 && n != 0}
  end
  #--------------------------------------------------------------------------
  # * Criação de Imagens
  #--------------------------------------------------------------------------
  def create_images
    @cursor = Sprite.new
    @cursor.bitmap = Cache.skill_tree(Cursor)
    @actor_image = Sprite.new
    @actor_image.bitmap = Cache.skill_tree(Actor_Select)
    @actor_image.z = 200
    @actor_image.opacity = 0
    @background_image = Array.new
    for n in 0...Actor[@actor.id][0]['Tree_Images'].size
      @background_image[n] = Sprite.new
      @background_image[n].bitmap = Cache.skill_tree(Actor[@actor.id][0]['Tree_Images'][n])
    end
    @cursor.z = 300
    @background_image.each_index {|n| @background_image[n].opacity = 0 unless n == 0}
  end
  #--------------------------------------------------------------------------
  # * Criação das Variáveis
  #--------------------------------------------------------------------------
  def create_variables
    @goto_x = 0
    @goto_y = 0
    @tree = 0
    @phase = 1
    @count = 15
    @skill_selected = 0
    Actor[@actor.id].each{|n| @phase = 0 if n['Tree'] == 2}
    move_to_cursor(Actor[@actor.id][0]['Tree_Shift'][@tree][0], Actor[@actor.id][0]['Tree_Shift'][@tree][1])
  end
  #--------------------------------------------------------------------------
  # * Atualização do Processo
  #--------------------------------------------------------------------------
  def update
    super
    return if @actor_window.active
    @actor_image.opacity = 0
    unless @confirm.close?
      if Input.repeat?(:B)
        @confirm.close
        @confirm.active = false
      end
      return
    end
    if @goto_x != @cursor.x || @goto_y != @cursor.y
      cursor_move
      return
    end
    if @count < 15
      update_tree_opacity(@tree)
      return
    end
    case @phase
    when 0
      update_tree
    when 1
      update_skills
    end
  end
  #--------------------------------------------------------------------------
  # * Atualização da árvore
  #--------------------------------------------------------------------------
  def update_tree
    return_scene if Input.repeat?(:B)
    if Input.repeat?(:RIGHT)
      if @tree + 1 == Actor[@actor.id][0]['Tree_Shift'].size
        @tree = 0
      else
        @tree += 1
      end
      @count = 0
      @info_window.contents_opacity = 0
      @info_window.refresh(@actor, @tree)
      move_to_cursor(Actor[@actor.id][0]['Tree_Shift'][@tree][0], Actor[@actor.id][0]['Tree_Shift'][@tree][1])
    elsif Input.repeat?(:LEFT)
      if @tree - 1 < 0
        @tree = Actor[@actor.id][0]['Tree_Shift'].size - 1
      else
        @tree -= 1
      end
      @info_window.contents_opacity = 0
      @info_window.refresh(@actor, @tree)
      move_to_cursor(Actor[@actor.id][0]['Tree_Shift'][@tree][0], Actor[@actor.id][0]['Tree_Shift'][@tree][1])
      @count = 0
    elsif Input.repeat?(:UP)
      if @tree - 1 < 0
        @tree = Actor[@actor.id][0]['Tree_Shift'].size - 1
      else
        @tree -= 1
      end
      @info_window.contents_opacity = 0
      @info_window.refresh(@actor, @tree)
      move_to_cursor(Actor[@actor.id][0]['Tree_Shift'][@tree][0], Actor[@actor.id][0]['Tree_Shift'][@tree][1])
      @count = 0
    elsif Input.repeat?(:DOWN)
      if @tree + 1 == Actor[@actor.id][0]['Tree_Shift'].size
        @tree = 0
      else
        @tree += 1
      end
      @count = 0
      @info_window.contents_opacity = 0
      @info_window.refresh(@actor, @tree)
      move_to_cursor(Actor[@actor.id][0]['Tree_Shift'][@tree][0], Actor[@actor.id][0]['Tree_Shift'][@tree][1])
    elsif Input.repeat?(:C)
      @phase = 1
      n = 0
      n += 1 until Actor[@actor.id][n]['Tree'] == @tree + 1
      @skill_selected = n
      @info_skill.refresh(@actor.id, @skill_selected)
      move_to_cursor(Actor[@actor.id][n]['X'], Actor[@actor.id][n]['Y'])
    end
  end
  #--------------------------------------------------------------------------
  # * Comando de usar um skill point
  #--------------------------------------------------------------------------
  def command_use_point
    if $game_actors[@actor.id].skill_tree[0] == 0 || confirm_skill_add
      Sound.play_buzzer
      @confirm.close
      @confirm.active = false
    else
      @skills_icons[@skill_selected].opacity = 255
      $game_actors[@actor.id].skill_tree[0] -= 1
      $game_actors[@actor.id].skill_mult[Actor[@actor.id][@skill_selected]['Skill_id']] += Actor[@actor.id][@skill_selected]['Multiply']
      $game_actors[@actor.id].skill_tree[Actor[@actor.id][@skill_selected]['Skill_id']] += 1
      $game_actors[@actor.id].learn_skill(Actor[@actor.id][@skill_selected]['Skill_id'])
      @info_window.refresh(@actor, @tree)
      Sound.play_ok
      @confirm.close
      @confirm.active = false
    end
  end
  #--------------------------------------------------------------------------
  # * Comando de retorno
  #--------------------------------------------------------------------------
  def command_return
    @confirm.close
  end
  #--------------------------------------------------------------------------
  # * Atualização de habilidades
  #--------------------------------------------------------------------------
  def update_skills
    if Input.trigger?(:B)
      Sound.play_cancel
      @phase = 1
      Actor[@actor.id].each{|n| @phase = 0 if n['Tree'] == 2}
      return_scene if @phase == 1
      move_to_cursor(Actor[@actor.id][0]['Tree_Shift'][@tree][0], Actor[@actor.id][0]['Tree_Shift'][@tree][1])
    elsif Input.repeat?(:RIGHT)
      unless Actor[@actor.id][@skill_selected]['Right'] == 0
        @skill_selected = Actor[@actor.id][@skill_selected]['Right']
        @info_skill.refresh(@actor.id, @skill_selected)
        move_to_cursor(Actor[@actor.id][@skill_selected]['X'], Actor[@actor.id][@skill_selected]['Y'])
      end
    elsif Input.repeat?(:LEFT)
      unless Actor[@actor.id][@skill_selected]['Left'] == 0
        @skill_selected = Actor[@actor.id][@skill_selected]['Left']
        @info_skill.refresh(@actor.id, @skill_selected)
        move_to_cursor(Actor[@actor.id][@skill_selected]['X'], Actor[@actor.id][@skill_selected]['Y'])
      end
    elsif Input.repeat?(:UP)
      unless Actor[@actor.id][@skill_selected]['Up'] == 0
        @skill_selected = Actor[@actor.id][@skill_selected]['Up']
        @info_skill.refresh(@actor.id, @skill_selected)
        move_to_cursor(Actor[@actor.id][@skill_selected]['X'], Actor[@actor.id][@skill_selected]['Y'])
      end
    elsif Input.repeat?(:DOWN)
      unless Actor[@actor.id][@skill_selected]['Down'] == 0
        @skill_selected = Actor[@actor.id][@skill_selected]['Down']
        @info_skill.refresh(@actor.id, @skill_selected)
        move_to_cursor(Actor[@actor.id][@skill_selected]['X'], Actor[@actor.id][@skill_selected]['Y'])
      end
    elsif Input.repeat?(:C)
      @confirm.open
      @confirm.active = true
    end
  end
  #--------------------------------------------------------------------------
  # * Atualização da opacidade da Skill Tree
  #--------------------------------------------------------------------------
  def update_tree_opacity(tree)
    @count += 1
    @info_window.contents_opacity += 20
    @background_image.each_index {|n| @background_image[n].opacity -= 20 unless n == @tree}
    @background_image.each_index {|n| @background_image[n].opacity += 20 if n == @tree}
    @skills_icons.each_index {|n| @skills_icons[n].opacity -= 10 if Actor[@actor.id][n]['Tree'] != @tree + 1 && n != 0}
    @skills_icons.each_index {|n| @skills_icons[n].opacity += 10 if Actor[@actor.id][n]['Tree'] == @tree + 1 && n != 0}
    @skills_icons.each_index {|n| @skills_icons[n].opacity -= 10 if n != 0 && $game_actors[@actor.id].skill_tree[Actor[@actor.id][n]['Skill_id']] > 0 && Actor[@actor.id][n]['Tree'] != @tree + 1}
    @skills_icons.each_index {|n| @skills_icons[n].opacity += 10 if n != 0 && $game_actors[@actor.id].skill_tree[Actor[@actor.id][n]['Skill_id']] > 0 && Actor[@actor.id][n]['Tree'] == @tree + 1}
  end
  #--------------------------------------------------------------------------
  # * Cálculo da posição do cursor
  #--------------------------------------------------------------------------
  def move_to_cursor(x, y)
    Sound.play_cursor
    @goto_x = x + Cursor_X
    @goto_y = y + Cursor_Y
    @speed_x = (@goto_x - @cursor.x)/ 10
    @speed_y = (@goto_y - @cursor.y)/ 10
  end
  #--------------------------------------------------------------------------
  # * Atualização da posição do cursor
  #--------------------------------------------------------------------------
  def cursor_move
    if (@cursor.x - @goto_x).abs >= 10
      @cursor.x += @speed_x
    elsif (@cursor.x - @goto_x).abs != 0
      @cursor.x -= (@cursor.x - @goto_x)
    end
    if (@cursor.y - @goto_y).abs >= 10
      @cursor.y += @speed_y
    elsif (@cursor.y - @goto_y).abs != 0
      @cursor.y -= (@cursor.y - @goto_y)
    end
  end
  #--------------------------------------------------------------------------
  # * Aquisição das informações do item selecionado
  #--------------------------------------------------------------------------
  def item
    $data_skills[Actor[@actor.id][@skill_selected]['Skill_id']]
  end
  #--------------------------------------------------------------------------
  # * Usando um item
  #--------------------------------------------------------------------------
  def use_item
    super
    @actor_window.open
  end
  #--------------------------------------------------------------------------
  # * Definição do item
  #--------------------------------------------------------------------------
  def determine_item
    if item.for_friend? && $game_actors[@actor.id].skill_tree[Actor[@actor.id][@skill_selected]['Skill_id']] > 0
      show_sub_window(@actor_window)
      @confirm.close
      @confirm.active = false
      @actor_image.opacity = 255
      @actor_image.x = 0
      @actor_image.x += Graphics.width - @actor_window.width if cursor_left?
      @actor_window.select_for_item(item)
    else
      @confirm.close
      @confirm.active = false
      Sound.play_buzzer
    end
  end
  #--------------------------------------------------------------------------
  # * Definição de cursor na coluna da esquerda
  #--------------------------------------------------------------------------
  def cursor_left?
    @cursor.x < Graphics.width/2
  end
  #--------------------------------------------------------------------------
  # * Ativação da janela do item
  #--------------------------------------------------------------------------
  def activate_item_window
  end
  #--------------------------------------------------------------------------
  # * Confirmação se adicionará um ponto
  #--------------------------------------------------------------------------
  def confirm_skill_add
    return true if $game_actors[@actor.id].skill_tree[Actor[@actor.id][@skill_selected]['Skill_id']] == Actor[@actor.id][@skill_selected]['Maxlevel']
    return true if $game_actors[@actor.id].level < Actor[@actor.id][@skill_selected]['Level'] + $game_actors[@actor.id].skill_tree[Actor[@actor.id][@skill_selected]['Skill_id']] * Actor[@actor.id][@skill_selected]['Level_Add']
    return false if Actor[@actor.id][@skill_selected]['Req_skills'].empty?
    for n in 0...Actor[@actor.id][@skill_selected]['Req_skills'].size
      return true if $game_actors[@actor.id].skill_tree[Actor[@actor.id][@skill_selected]['Req_skills'][n]] < Actor[@actor.id][@skill_selected]['Req_levels'][n]
    end
    return false
  end
  #--------------------------------------------------------------------------
  # * Finalização do processo
  #--------------------------------------------------------------------------
  def terminate
    super
    @background_image.each{|n| n.bitmap.dispose; n.dispose}
    @actor_image.bitmap.dispose
    @actor_image.dispose
    @skills_icons.each{|n| n.bitmap.dispose unless n == nil; n.dispose unless n == nil}
    @cursor.bitmap.dispose
    @cursor.dispose
  end
  #--------------------------------------------------------------------------
  # * retorna a cena anterior
  #--------------------------------------------------------------------------
  def return_scene
    Sound.play_cancel
    super
  end
end


#==============================================================================
# ** Sk_Tree_Window
#------------------------------------------------------------------------------
#  Esta janela exibe os pontos das habilidades
#==============================================================================
class Sk_Tree_Window < Window_Base
include Lune_Skill_Tree
  #--------------------------------------------------------------------------
  # * Inicialização
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, Graphics.width, Graphics.height)
    self.z = 200
    self.opacity = 0
  end
  #--------------------------------------------------------------------------
  # * Atualização
  #--------------------------------------------------------------------------
  def refresh(actor, tree)
    contents.clear
    tree += 1
    act = Actor[actor.id]
    contents.font.size = Font_Skills + 8
    contents.font.name = Font_Name unless Font_Name.empty?
    draw_text(Text_X, Text_Y, 300, 40, Text + actor.skill_tree[0].to_s + " / " + actor.skill_tree.sum.to_s, 0)
    contents.font.size = Font_Skills
    for n in 1...Actor[actor.id].size
      if tree == act[n]['Tree']
        draw_icon($data_skills[act[n]['Skill_id']].icon_index, act[n]['X'], act[n]['Y']) if act[n]['Image'].empty?
        draw_text(act[n]['X'] + Corr_X, act[n]['Y'] + Corr_Y, 120, 30, $game_actors[actor.id].skill_tree[act[n]['Skill_id']].to_s + "/" + act[n]['Maxlevel'].to_s, 0)
      end
    end
    reset_font_settings
  end
end

#==============================================================================
# ** Sk_Descri_Window
#------------------------------------------------------------------------------
#  Esta janela exibe as informações das habilidades
#==============================================================================
class Sk_Descri_Window < Window_Base
include Lune_Skill_Tree
  #--------------------------------------------------------------------------
  # * Inicialização
  #--------------------------------------------------------------------------
  def initialize(x, y, width, height)
    super(x, y, width, height)
  end
  #--------------------------------------------------------------------------
  # * Atualização
  #--------------------------------------------------------------------------
  def refresh(actor_id, skill)
    contents.clear
    contents.font.size = Font_Help
    contents.font.name = Font_Name unless Font_Name.empty?
    draw_text(0, 0, self.width, line_height, Actor[actor_id][skill]['Desc1'], 0)
    draw_text(0, line_height, self.width, line_height, Actor[actor_id][skill]['Desc2'], 0)
    draw_text(0, line_height*2, self.width, line_height, Actor[actor_id][skill]['Desc3'], 0)
    reset_font_settings
  end
end

#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
#  Esta classe gerencia os heróis. Ela é utilizada internamente pela classe
# Game_Actors ($game_actors). A instância desta classe é referenciada
# pela classe Game_Party ($game_party).
#==============================================================================

class Game_Actor < Game_Battler
alias :lune_sk_initialize :initialize
alias :lune_sk_level_up :level_up
  #--------------------------------------------------------------------------
  # * Variáveis públicas
  #--------------------------------------------------------------------------
  attr_accessor :skill_tree                  # Nome
  attr_accessor :skill_mult
  #--------------------------------------------------------------------------
  # * Inicialização do objeto
  #     actor_id : ID do herói
  #--------------------------------------------------------------------------
  def initialize(actor_id)
    lune_sk_initialize(actor_id)
    @skill_tree = Array.new($data_skills.size + 1, 0)
    @skill_mult = Array.new($data_skills.size + 1, 0)
  end
  #--------------------------------------------------------------------------
  # * Aumento de nível
  #--------------------------------------------------------------------------
  def level_up
    lune_sk_level_up
    @skill_tree[0] += 1 if Lune_Skill_Tree::Add_Skill_pt
  end
end


#==============================================================================
# ** Window_Skill_Confirm
#------------------------------------------------------------------------------
#  Esta janela exibe a confirmação da janela de skills
#==============================================================================

class Window_Skill_Confirm < Window_Command

  #--------------------------------------------------------------------------
  # * Inicialização do objeto
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0)
    self.z = 9999
    self.x = (Graphics.width / 2) - (window_width / 2)
    self.y = Graphics.height / 2
    self.openness = 0
  end
  #--------------------------------------------------------------------------
  # * Aquisição da largura da janela
  #--------------------------------------------------------------------------
  def window_width
    return 160
  end
  #--------------------------------------------------------------------------
  # * Criação da lista de comandos
  #--------------------------------------------------------------------------
  def make_command_list
    add_main_commands
  end
  #--------------------------------------------------------------------------
  # * Adição dos comandos principais
  #--------------------------------------------------------------------------
  def add_main_commands
    add_command(Lune_Skill_Tree::Bot1,   :use_skill,   true)
    add_command(Lune_Skill_Tree::Bot2,  :use_point,  true)
    add_command(Lune_Skill_Tree::Bot3,  :return_window,  true)
  end
end

#==============================================================================
# ** Cache
#------------------------------------------------------------------------------
#  Este modulo carrega cada gráfico, cria um objeto de Bitmap e retém ele.
# Para acelerar o carregamento e preservar memória, este módulo matém o
# objeto de Bitmap em uma Hash interna, permitindo que retorne objetos
# pré-existentes quando mesmo Bitmap é Requirementsido novamente.
#==============================================================================


module Cache
  #--------------------------------------------------------------------------
  # * Carregamento dos gráficos de animação
  #     filename : nome do arquivo
  #     hue      : informações da alteração de tonalidade
  #--------------------------------------------------------------------------
  def self.skill_tree(filename)
    load_bitmap("Graphics/Skill_Tree/", filename)
  end
end

#==============================================================================
# ** Window_MenuActor_Tree
#------------------------------------------------------------------------------
#  Esta janela é utilizada para selecionar os herois para as habilidades.
#==============================================================================

class Window_MenuActor_Tree < Window_MenuActor
include Lune_Skill_Tree
  #--------------------------------------------------------------------------
  # * Inicialização do objeto
  #--------------------------------------------------------------------------
  def initialize
    super
    self.opacity = Opacity
  end
end

#==============================================================================
# ** Game_Interpreter
#------------------------------------------------------------------------------
#  Um interpretador para executar os comandos de evento. Esta classe é usada
# internamente pelas classes Game_Map, Game_Troop e Game_Event.
#==============================================================================

class Game_Interpreter
  #--------------------------------------------------------------------------
  # * Adicionar pontos para o personagem
  #--------------------------------------------------------------------------
  def add_tree_points(actor_id, points)
    $game_actors[actor_id].skill_tree[0] += points
  end
end


#==============================================================================
# ** Game_Battler
#------------------------------------------------------------------------------
#  Esta classe gerencia os battlers. Controla a adição de sprites e ações
# dos lutadores durante o combate.
# É usada como a superclasse das classes Game_Enemy e Game_Actor.
#==============================================================================

class Game_Battler < Game_BattlerBase
alias :item_rai_lune_effect :item_effect_apply
  #--------------------------------------------------------------------------
  # * Cálculo de dano
  #     user : usuário
  #     item : habilidade/item
  #--------------------------------------------------------------------------
  def make_damage_value(user, item)
    value = item.damage.eval(user, self, $game_variables)
    value *= item_element_rate(user, item)
    value *= pdr if item.physical?
    value *= mdr if item.magical?
    value *= rec if item.damage.recover?
    value = apply_critical(value) if @result.critical
    value = apply_variance(value, item.damage.variance)
    value = apply_guard(value)
    value += (value * $game_actors[user.id].skill_mult[item.id])/100 unless user.enemy?
    @result.make_damage(value.to_i, item)
  end
  #--------------------------------------------------------------------------
  # * Aplicar efeito do uso habilidades/itens
  #     user   : usuário
  #     item   : habilidade/item
  #     effect : efeito
  #--------------------------------------------------------------------------
  def item_effect_apply(user, item, effect)
    @old_value1 = effect.value1
    @old_value2 = effect.value2
    effect.value1 += (effect.value1 * $game_actors[user.id].skill_mult[item.id])/100 unless user.enemy?
    effect.value2 += (effect.value2 * $game_actors[user.id].skill_mult[item.id])/100 unless user.enemy?
    item_rai_lune_effect(user, item, effect)
    effect.value1 = @old_value1 unless user.enemy?
    effect.value2 = @old_value2 unless user.enemy?
  end
end


#==============================================================================
# ** Arrays
#------------------------------------------------------------------------------
# Novo método para somar os valores dentro da array
#==============================================================================
class Array
  def sum
    a = 0
    for n in 0...size
      a += self[n]
    end
    return a
  end
end
Créditos:
Credito 1: Raizen, por hacer el script
Credito 2: Mistyrol, por el diseño
Credito 3: el post original: http://forums.rpgmakerweb.com/index.php?/topic/25423-lune-unlimited-skill-tree/

#2 Re: [RM ACE] Árbol de habilidades de Raizen el Miér Sep 17, 2014 1:12 pm

Reputación del mensaje :100% (1 voto)

SkavenOfDarkness

avatar
Muy buen aporte, cuando tenga tiempo le echaré un vistazo

#3 Re: [RM ACE] Árbol de habilidades de Raizen el Lun Sep 22, 2014 6:42 pm

Cuervoso

avatar
Vaya, se ve bien. Me gusta mucho más que eso de que las habilidades se descubran concorde subes de nivel.

Gracias por el aporte.

Saludos.






Cuervoso! No te pases ¬_¬

#4 Re: [RM ACE] Árbol de habilidades de Raizen el Vie Sep 26, 2014 3:06 pm

Tomate

avatar
¡Excelente Script! Gracias por compartirlo con nosotros porque es algo que seguramente varios buscan, aquí te dejo +1 Reputacón Ópalo Sonriente

Contenido patrocinado


Ver el tema anterior Ver el tema siguiente Volver arriba  Mensaje [Página 1 de 1.]

Permisos de este foro:
No puedes responder a temas en este foro.