having an issue using a certain script, was curious if anyone could help with it. It's the skill tree script I made use of in my first game, but for some reason it doesn't want to work for me for my third game.
Here's the actual script that runs it:
################################################################################
# * Core * #
# Basic? - Skill Tree - of Awesome v1.22 #
# 19 Feb 2011 #
################################################################################
# Author: Leongon #
# Contact: carlos_gon47@hotmail.com (or PM leongon on the board below) #
# Licence: Free for commercial and non-commercial proyects, just credit. #
# Share: Exclusive for www.rpgrevolution.com #
# If you want to share it outside give a link only, please. #
################################################################################
# This is my very first big non-so-basic script, and I'm very proud of how it #
# got done, almost exactly what I wanted to accomplish when I start writing it #
# about a week ago. #
# ---------------------------------------------------------------------------- #
# As the name says, this script introduces the very popular function from most #
# MMORPGs: Skill Trees, or talent trees if you prefer, for your heroes. #
# #
# Instructions on the Setup script. In that one you need to work, this not. #
################################################################################
class Game_Actor < Game_Battler
include ST_setup
alias skill_tree_initialize initialize
def initialize(actor_id)
skill_tree_initialize(actor_id)
@last_tree_id = 0
@tree_skills = []
@tree_points = [0,0,0]
end
alias skill_tree_setup setup
def setup(actor_id)
skill_tree_setup(actor_id)
if ST_first_skill_point <= @level and ST_level_up_point
@base_st_points = (@level - ST_first_skill_point) +1
else
@base_st_points = 0
end
@st_points = @base_st_points
end
def tree_points
treepts = @tree_points[@last_tree_id]
return treepts
end
def st_points
return @st_points
end
def reset_skill_trees
while !@tree_skills.empty?
for skill in @tree_skills
forget_tree_skill(skill)
end
end
@st_points = @base_st_points
@tree_points = [0,0,0]
end
def learn_tree_skill(skill_id)
@tree_skills.push(skill_id)
learn_skill(skill_id)
@st_points -= 1
@tree_points[@last_tree_id] += 1
end
def forget_tree_skill(skill_id)
@tree_skills.delete(skill_id)
forget_skill(skill_id)
end
alias skill_tree_level_up level_up
def level_up
skill_tree_level_up
if ST_first_skill_point <= @level and ST_level_up_point
@st_points += 1
@base_st_points += 1
end
end
alias skill_tree_level_down level_down
def level_down
skill_tree_level_down
unless ST_first_skill_point < @level or ST_level_up_point == false
@st_points -= 1
@base_st_points -= 1
end
end
def tree_skills
return @tree_skills
end
def last_tree_id(t_id)
@last_tree_id = t_id
end
def get_last_tree_id
return @last_tree_id
end
def reward_st_points(amount)
@st_points += amount
@base_st_points += amount
end
end
class Window_SkillTree_Main < Window_Selectable
include ST_setup
def initialize(actor, tree)
case $game_variables[ST_windows_var]
when 2,3
super(338, 68, 206, 348)
when 4,5
super(0, 0, 206, 348)
when 6,7
super(338, 0, 206, 348)
else
super(0, 68, 206, 348)
end
@spacing = 0
@actor = actor
@column_max = 7
@class_tree_assign = ST_class_assign[@actor.class_id]
@tree_name = @class_tree_assign[tree]
for data in ST_tree_build[@tree_name]
if data != nil and ST_object.include?(data)
object = ST_object[data]
unless object[0] == "arrow_object"
self.index = ST_tree_build[@tree_name].index(data)
break
end
end
end
$sk_lvl = 0
$sk_max_lvl = 0
if ST_imageback != false
self.back_opacity = 0
end
refresh
end
def st_enabled?(index)
req_lvl_data = @treedata_reqlvl[index]
req_lvl_data += object_lvl(index) if ST_scale_mode
if @actor.level >= req_lvl_data and
@treedata_child_allow.include?(@treedata_reqskillobj_a[index]) and
@treedata_child_allow.include?(@treedata_reqskillobj_b[index]) and
@treedata_reqtreepts[index] <= @actor.tree_points
return true
else
return false
end
end
def at_enabled?(index)
if @treedata_child_allow.include?(@treedata_reqskillobj_a[index])
return true
else
return false
end
end
def object_lvl(index)
skill_allids = @treedata_alllvlids[index]
for k in skill_allids
if @actor.tree_skills.include?(k)
lvl = skill_allids.index(k)
return lvl +1
end
end
return 0
end
def object_max_lvl(index)
return @treedata_maxlvl[index]
end
def object_dad_req(indx)
required_object = []
if get_skill_next_level(indx) == "maxed"
required_object = [0,0,0,0,0,0]
return required_object
end
obj_name_a = @treedata_reqskillobj_a[indx]
obj_name_b = @treedata_reqskillobj_b[indx]
if obj_name_a == nil
required_object.push(obj_name_a)
required_object.push(obj_name_a)
required_object.push(obj_name_b)
required_object.push(obj_name_b)
else
obj_data_a = ST_object[obj_name_a]
obj_id_a = obj_data_a[6]
name_a = $data_skills[obj_id_a].name
required_object.push(name_a)
obj_lvl_req_a = obj_data_a[5]
required_object.push(obj_lvl_req_a)
if obj_name_b == nil
required_object.push(obj_name_b)
required_object.push(obj_name_b)
else
obj_data_b = ST_object[obj_name_b]
obj_id_b = obj_data_b[6]
name_b = $data_skills[obj_id_b].name
required_object.push(name_b)
obj_lvl_req_b = obj_data_b[5]
required_object.push(obj_lvl_req_b)
end
end
obj_actor_req_lvl = @treedata_reqlvl[indx]
obj_actor_req_lvl += object_lvl(indx) if ST_scale_mode
obj_actor_reqtreepts = @treedata_reqtreepts[indx]
required_object.push(obj_actor_req_lvl)
required_object.push(obj_actor_reqtreepts)
return required_object
end
def get_skill_actual_level(data_index)
skill_allids = @treedata_alllvlids[data_index]
for k in skill_allids
if @actor.tree_skills.include?(k)
return k
end
end
return "not learned"
end
def get_skill_next_level(data_index)
skill_allids = @treedata_alllvlids[data_index]
for k in skill_allids
if @actor.tree_skills.include?(k)
sk_index = skill_allids.index(k)
sk_index += 1
if skill_allids[sk_index] == nil
return "maxed"
end
return skill_allids[sk_index]
end
end
return skill_allids[0]
end
def get_skill_child_req(object_name, data_index)
actual_lvl = nil
alllvlids_data = []
alllvlids_data = @treedata_alllvlids[data_index]
for k in alllvlids_data
if @actor.tree_skills.include?(k)
actual_lvl = alllvlids_data.index(k)
actual_lvl += 1
end
end
actual_lvl = 0 if actual_lvl == nil
skill_object_name = ST_object[object_name]
return true if actual_lvl >= skill_object_name[5]
return false
end
def build_tree_indexed_data
@treedata_arrowindex = []
@treedata_reqlvl = []
@treedata_reqtreepts = []
@treedata_reqskillobj_a = []
@treedata_reqskillobj_b = []
@treedata_maxlvl = []
@treedata_child_allow = []
@treedata_alllvlids = []
countt = 0
tree_build = ST_tree_build[@tree_name]
for l in tree_build
object_data = []
object_data = ST_object[l]
if l == nil
@treedata_arrowindex.push(nil)
@treedata_reqlvl.push(nil)
@treedata_reqtreepts.push(nil)
@treedata_reqskillobj_a.push(nil)
@treedata_reqskillobj_b.push(nil)
@treedata_maxlvl.push(nil)
@treedata_child_allow.push(nil)
@treedata_alllvlids.push(nil)
elsif object_data[0] == "arrow_object"
arrow_index = object_data[1]
@treedata_arrowindex.push(ST_arrow.index(arrow_index))
@treedata_reqlvl.push(nil)
@treedata_reqtreepts.push(nil)
@treedata_reqskillobj_a.push(object_data[2])
@treedata_reqskillobj_b.push(nil)
@treedata_maxlvl.push(nil)
@treedata_child_allow.push(nil)
@treedata_alllvlids.push(nil)
else
@treedata_arrowindex.push(nil)
@treedata_reqlvl.push(object_data[0])
@treedata_reqtreepts.push(object_data[1])
@treedata_reqskillobj_a.push(object_data[2])
@treedata_reqskillobj_b.push(object_data[3])
@treedata_maxlvl.push(object_data[4])
index_lvls_plus = 0
index_lvls_plus = object_data[4]
index_lvls_plus += 6
all_lvl_ids = []
for k in 6...index_lvls_plus
all_lvl_ids.push(object_data[k])
end
@treedata_alllvlids.push(all_lvl_ids)
@treedata_child_allow.push(l) if get_skill_child_req(l, countt)
end
countt += 1
end
end
def refresh
@data = []
build_tree_indexed_data
count = 0
tree_build = ST_tree_build[@tree_name]
for j in tree_build
if j == nil
data_skill = nil
elsif @treedata_arrowindex[count] != nil
data_skill = "arrow"
elsif get_skill_next_level(count) == "maxed"
data_skill = $data_skills[get_skill_actual_level(count)]
else
data_skill = $data_skills[get_skill_next_level(count)]
end
@data.push(data_skill)
count += 1
end
@item_max = @data.size
create_contents
for i in 0...@item_max
draw_item(i)
end
end
def draw_item(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
object = @data[index]
if object != nil and object != "arrow"
rect.width -= 4
enabled = st_enabled?(index)
icon = object.icon_index
draw_icon(icon, rect.x, rect.y, enabled)
if ST_show_obj_lvl
save_size_font = self.contents.font.size
self.contents.font.size = 12
self.contents.draw_text(rect.x+12, rect.y+13, 12, 12, object_lvl(index), 2)
self.contents.font.size = save_size_font
end
elsif object != nil
rect.width -= 4
enabled = at_enabled?(index)
arrow = @treedata_arrowindex[index]
draw_arrow(arrow, rect.x, rect.y, enabled)
end
end
def draw_icon(icon_index, x, y, enabled = true)
bitmap = Cache.system("Iconset")
rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
self.contents.blt(x, y, bitmap, rect, enabled ? 255 : ST_skill_disabled)
end
def draw_arrow(index, x, y, enabled = true)
bitmap = Cache.load_bitmap("Graphics/System/", "SkillTree", ST_arrow_hue)
rect = Rect.new(index % 10 * 24, index / 10 * 24, 24, 24)
self.contents.blt(x, y, bitmap, rect, enabled ? 255 : ST_arrow_disabled)
end
def skill
return @data[self.index]
end
def update_help
if skill == nil or skill == "arrow"
text_a = ""
elsif get_skill_actual_level(@index) == "not learned"
text_a = ST_voc_unl
else
actual = $data_skills[get_skill_actual_level(@index)]
text_a = ST_voc_now + actual.description
cost_a = actual.mp_cost
end
if skill == nil or skill == "arrow"
text_b = ""
elsif $sk_lvl == $sk_max_lvl
text_b = ST_voc_max
else
text_b = ST_voc_nex + skill.description
cost_b = skill.mp_cost
end
@help_window.set_text(text_a, text_b, cost_a, cost_b)
end
def cursor_down(wrap = false)
if (@index < @item_max - @column_max) or (wrap and @column_max == 1)
@index = (@index + (@column_max*3)) % @item_max unless
@data[(@index + (@column_max*3)) % @item_max] == nil or
@data[(@index + (@column_max*3)) % @item_max] == "arrow"
$sk_tree_data_refresh = true
end
end
def cursor_up(wrap = false)
if (@index >= @column_max) or (wrap and @column_max == 1)
@index = (@index - (@column_max*3) + @item_max) % @item_max unless
@data[(@index - (@column_max*3) + @item_max) % @item_max] == nil or
@data[(@index - (@column_max*3) + @item_max) % @item_max] == "arrow"
$sk_tree_data_refresh = true
end
end
def cursor_right(wrap = false)
actual_index = @index +1
for i in actual_index...@item_max
unless @data[i] == nil or @data[i] == "arrow"
@index = (i)
$sk_tree_data_refresh = true
break
end
end
end
def cursor_left(wrap = false)
actual_index = @index -1
for i in 0..actual_index
unless @data[actual_index-i] == nil or @data[actual_index-i] == "arrow"
@index = (actual_index-i)
$sk_tree_data_refresh = true
break
end
end
end
end
class Window_SkillTree_Data < Window_Base
include ST_setup
def initialize(actor, tree)
case $game_variables[ST_windows_var]
when 1
super(206, 68, 338, 292)
when 2
super(0, 124, 338, 292)
when 3
super(0, 68, 338, 292)
when 4
super(206, 56, 338, 292)
when 5
super(206, 0, 338, 292)
when 6
super(0, 56, 338, 292)
when 7
super(0, 0, 338, 292)
else
super(206, 124, 338, 292)
end
@actor = actor
@tree = tree
refresh
end
def refresh
self.contents.clear
draw_actor_face(@actor, 0, 0)
draw_actor_name(@actor, 120, 0)
draw_actor_level(@actor, 248, 0)
draw_actor_class(@actor, 120, 24)
self.contents.draw_text(0, 130, 304, WLH, $sk_lvl.to_s + "/" +
$sk_max_lvl.to_s)
self.contents.font.color = text_color(ST_skillname_color)
self.contents.draw_text(0, 106, 304, WLH, $sk_name)
self.contents.font.color = system_color
self.contents.draw_text(120, 72, 184, WLH, ST_voc_cur)
self.contents.font.color = normal_color
self.contents.font.color = text_color(ST_zero_sp_color) if
@actor.st_points < 1
self.contents.draw_text(120, 72, 184, WLH, @actor.st_points, 2)
self.contents.font.color = normal_color
if $sk_req_data[0] == 0 and $sk_req_data[1] == 0 and $sk_req_data[2] == 0 and
$sk_req_data[3] == 0 and $sk_req_data[4] == 0 and $sk_req_data[5] == 0
self.contents.draw_text(0, 153, 304, WLH, ST_voc_max, 1)
else
self.contents.draw_text(0, 153, 304, WLH, ST_voc_req, 1)
end
self.contents.font.size = 18
plus = 177
unless $sk_req_data[4] == 0
self.contents.draw_text(0, plus, 304, WLH, ST_voc_lvl + $sk_req_data[4].to_s)
plus += 20
end
unless $sk_req_data[5] == 0
display_name = ST_class_assign[@actor.class_id]
$sk_req_data[5] == 1 ? points = ST_voc_one : points = ST_voc_many
self.contents.draw_text(0, plus, 304, WLH, $sk_req_data[5].to_s + points +
display_name[@tree + 3])
plus += 20
end
unless $sk_req_data[0] == nil or $sk_req_data[1] == nil or $sk_req_data[1] == 0
$sk_req_data[1] == 1 ? points = ST_voc_one : points = ST_voc_many
self.contents.draw_text(0, plus, 304, WLH, $sk_req_data[1].to_s +
points + $sk_req_data[0].to_s)
plus += 20
end
unless $sk_req_data[2] == nil or $sk_req_data[3] == nil or $sk_req_data[1] == 0
$sk_req_data[3] == 1 ? points = ST_voc_one : points = ST_voc_many
self.contents.draw_text(0, plus, 304, WLH, $sk_req_data[3].to_s +
points + $sk_req_data[2].to_s)
end
self.contents.font.size = 20
end
end
class Window_SkillTree_Help < Window_Base
def initialize
case $game_variables[ST_setup::ST_windows_var]
when 4,5,6,7
super(0, 348, 544, 68)
else
super(0, 0, 544, 68)
end
end
def set_text(text_a, text_b, cost_a = nil, cost_b = nil)
self.contents.clear
self.contents.font.size = 16
self.contents.font.color = normal_color
self.contents.draw_text(0, 0, self.width - 86, 16, text_a)
self.contents.draw_text(0, 18, self.width - 86, 16, text_b)
self.contents.draw_text(0, 0, self.width - 32, 16, "(" + cost_a.to_s + " " +
Vocab::mp + ")", 2) unless cost_a == nil
self.contents.draw_text(0, 18, self.width - 32, 16, "(" + cost_b.to_s + " " +
Vocab::mp + ")", 2) unless cost_b == nil
end
end
class Window_Tree_Selection < Window_Selectable
def initialize(actor, tree)
case $game_variables[ST_setup::ST_windows_var]
when 1
super(206, 360, 338, 56)
when 2
super(0, 68, 338, 56)
when 3
super(0, 360, 338, 56)
when 4
super(206, 0, 338, 56)
when 5
super(206, 292, 338, 56)
when 6
super(0, 0, 338, 56)
when 7
super(0, 292, 338, 56)
else
super(206, 68, 338, 56)
end
@actor = actor
@column_max = 3
self.index = tree
refresh
end
def refresh
@data = []
display_name = ST_setup::ST_class_assign[@actor.class_id]
for name in 0..2
@data.push(display_name[name + 3])
end
create_contents
for i in 0..2
draw_item(i)
end
end
def draw_item(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
tree = @data[index]
if tree != nil
if @index == index and ST_setup::ST_tree_selection == 2
self.contents.font.color = text_color(ST_setup::ST_treeselection_color)
else
self.contents.font.color = normal_color
end
self.contents.draw_text(rect, tree, 1)
end
end
def cursor_down(wrap = false)
end
def cursor_up(wrap = false)
end
def cursor_right(wrap = false)
end
def cursor_left(wrap = false)
end
def update_cursor
return if ST_setup::ST_tree_selection == 2
if @index < 0 # If the cursor position is less than 0
self.cursor_rect.empty # Empty cursor
else # If the cursor position is 0 or more
row = @index / @column_max # Get current row
if row < top_row # If before the currently displayed
self.top_row = row # Scroll up
end
if row > bottom_row # If after the currently displayed
self.bottom_row = row # Scroll down
end
rect = item_rect(@index) # Get rectangle of selected item
rect.y -= self.oy # Match rectangle to scroll position
self.cursor_rect = rect # Refresh cursor rectangle
end
end
end
class Scene_NoSkillTree < Scene_Base
def initialize(actor_index, return_to_map = false)
@actor_index = actor_index
@return_to_map = return_to_map
end
def update_notree_warn
if Input.trigger?(Input::B)
Sound.play_cancel
if @return_to_map
$scene = Scene_Map.new
else
$scene = Scene_Menu.new(ST_setup::ST_menu_pos)
end
elsif Input.trigger?(Input::C)
Sound.play_decision
if @return_to_map
$scene = Scene_Map.new
else
$scene = Scene_Menu.new(ST_setup::ST_menu_pos)
end
end
end
def start
unless ST_setup::ST_notalents_popup
Sound.play_cancel
if @return_to_map
$scene = Scene_Map.new
else
$scene = Scene_Menu.new(ST_setup::ST_menu_pos)
end
terminate
return
end
super
create_menu_background
@actor = $game_party.members[@actor_index]
@notree_window = Window_Command.new(200, [ST_setup::ST_voc_noSTpop], 1)
@notree_window.viewport = @viewport
@notree_window.x = Graphics.width / 2 - @notree_window.width / 2
@notree_window.y = Graphics.height / 2 - 20
@notree_window_head = Window_Base.new(0, @notree_window.y - @notree_window.height,
Graphics.width, @notree_window.height)
@notree_window_head.create_contents
if ST_setup::ST_notalents_popAN
@notree_window_head.contents.draw_text(0, 0, @notree_window_head.contents.width,
@notree_window_head.contents.height, ST_setup::ST_voc_noSTpop_pre + @actor.name +
ST_setup::ST_voc_noSTpop_pos, 1)
else
@notree_window_head.contents.draw_text(0, 0, @notree_window_head.contents.width,
@notree_window_head.contents.height, ST_setup::ST_voc_noSTpop_pre +
ST_setup::ST_voc_noSTpop_pos, 1)
end
update_notree_warn
end
def update
super
update_menu_background
@notree_window.update if ST_setup::ST_notalents_popup
update_notree_warn
end
def terminate
super
if ST_setup::ST_notalents_popup
@notree_window.dispose
@notree_window_head.dispose
end
end
end
class Scene_SkillTree < Scene_Base
def initialize(actor_index, return_to_map = false)
@actor_index = actor_index
@return_to_map = return_to_map
$sk_name = ""
$sk_req_data = []
$sk_tree_data_refresh = false
end
def start
@actor = $game_party.members[@actor_index]
unless ST_setup::ST_class_assign.include?(@actor.class_id)
$scene = Scene_NoSkillTree.new(@actor_index, @return_to_map)
terminate
return
end
super
create_menu_background
@tree_index = @actor.get_last_tree_id
@viewport = Viewport.new(0, 0, 544, 416)
if ST_setup::ST_imageback != false
tree_name = ST_setup::ST_class_assign[@actor.class_id]
@back_img = Sprite.new
@back_img.bitmap = Bitmap.new("Graphics/System/" + tree_name[@tree_index])
@back_img.opacity = ST_setup::ST_imageback
@back_img.viewport = @viewport
end
@help_window = Window_SkillTree_Help.new
@help_window.viewport = @viewport
@skilltree_window = Window_SkillTree_Main.new(@actor, @tree_index)
@skilltree_window.viewport = @viewport
@skilltree_window.help_window = @help_window
@skilltree_window_data = Window_SkillTree_Data.new(@actor, @tree_index)
@skilltree_window_data.viewport = @viewport
@skilltree_window_tree = Window_Tree_Selection.new(@actor, @tree_index)
@skilltree_window_tree.viewport = @viewport
if ST_setup::ST_imageback != false
@back_img.x = @skilltree_window.x
@back_img.y = @skilltree_window.y
end
if ST_setup::ST_confirm_popup
@confirm_window = Window_Command.new(200, [ST_setup::ST_voc_ok,
ST_setup::ST_voc_cancel], 2)
@confirm_window.viewport = @viewport
@confirm_window.x = Graphics.width / 2 - @confirm_window.width / 2
@confirm_window.y = Graphics.height / 2 - 20
@confirm_window.active = false
@confirm_window.visible = false
@confirm_window_head = Window_Base.new(@confirm_window.x,
@confirm_window.y - @confirm_window.height, @confirm_window.width, @confirm_window.height)
@confirm_window_head.create_contents
@confirm_window_head.contents.draw_text(0, 0, @confirm_window_head.contents.width,
@confirm_window_head.contents.height, ST_setup::ST_voc_q, 1)
@confirm_window_head.visible = false
end
actualize_data_window
end
def terminate
super
if ST_setup::ST_class_assign.include?(@actor.class_id)
dispose_menu_background
@help_window.dispose
@skilltree_window.dispose
@skilltree_window_data.dispose
@skilltree_window_tree.dispose
@back_img.dispose if ST_setup::ST_imageback != false
@confirm_window.dispose if ST_setup::ST_confirm_popup
@confirm_window_head.dispose if ST_setup::ST_confirm_popup
end
end
def next_tree
class_tree_assign = ST_setup::ST_class_assign[@actor.class_id]
for i in 1...3
@tree_index += i
@tree_index %= 3
tree_name = class_tree_assign[@tree_index]
break if tree_name != nil
end
@actor.last_tree_id(@tree_index)
$scene = Scene_SkillTree.new(@actor_index, @return_to_map)
end
def prev_tree
class_tree_assign = ST_setup::ST_class_assign[@actor.class_id]
for i in 1...3
@tree_index -= i
@tree_index %= 3
tree_name = class_tree_assign[@tree_index]
break if tree_name != nil
end
@actor.last_tree_id(@tree_index)
$scene = Scene_SkillTree.new(@actor_index, @return_to_map)
end
def update
return unless ST_setup::ST_class_assign.include?(@actor.class_id)
super
update_menu_background
if @skilltree_window.active
@skilltree_window.update
@skilltree_window_tree.update unless ST_setup::ST_tree_selection == 1
@back_img.update if ST_setup::ST_imageback != false
update_skilltree_selection
elsif @confirm_window.active
@confirm_window.update
update_confirm_selection
end
if $sk_tree_data_refresh != false
actualize_data_window
$sk_tree_data_refresh = false
end
end
def update_skilltree_selection
if Input.trigger?(Input::B)
Sound.play_cancel
if @return_to_map
$scene = Scene_Map.new
else
$scene = Scene_Menu.new(ST_setup::ST_menu_pos)
end
elsif Input.trigger?(Input::R)
Sound.play_cursor
next_tree
elsif Input.trigger?(Input::L)
Sound.play_cursor
prev_tree
elsif Input.trigger?(Input::C)
actual_st_index = @skilltree_window.index
if @skill != nil
@actor.last_skill_id = @skill
end
if @skilltree_window.st_enabled?(actual_st_index) and
@actor.st_points > 0 and
@skilltree_window.get_skill_next_level(actual_st_index) != "maxed" and
ST_setup::ST_confirm_popup == false
Sound.play_decision
do_skill_up
elsif @skilltree_window.st_enabled?(actual_st_index) and
@actor.st_points > 0 and
@skilltree_window.get_skill_next_level(actual_st_index) != "maxed" and
ST_setup::ST_confirm_popup
Sound.play_decision
start_confirm_selection
else
Sound.play_buzzer
end
end
end
def actualize_data_window
actual_st_index = @skilltree_window.index
sk_id = @skilltree_window.skill
$sk_name = sk_id.name
$sk_lvl = @skilltree_window.object_lvl(actual_st_index)
$sk_max_lvl = @skilltree_window.object_max_lvl(actual_st_index)
$sk_req_data = @skilltree_window.object_dad_req(actual_st_index)
@skilltree_window_data.refresh
@skilltree_window_tree.refresh
end
def start_confirm_selection
@skilltree_window.active = false
@skilltree_window_tree.active = false
@confirm_window.visible = true
@confirm_window.active = true
@confirm_window_head.visible = true
end
def end_confirm_selection
@skilltree_window.active = true
@skilltree_window_tree.active = true
@confirm_window.visible = false
@confirm_window.active = false
@confirm_window_head.visible = false
@confirm_window.index = 0
end
def update_confirm_selection
if Input.trigger?(Input::B)
Sound.play_cancel
end_confirm_selection
elsif Input.trigger?(Input::C)
if @confirm_window.index == 0
if @skill != nil
@actor.last_skill_id = @skill
end
Sound.play_decision
do_skill_up
else
Sound.play_cancel
end
end_confirm_selection
end
end
def do_skill_up
@skill = @skilltree_window.skill
actual_st_index = @skilltree_window.index
actual_skill = @skilltree_window.get_skill_actual_level(actual_st_index)
@actor.forget_tree_skill(actual_skill) unless actual_skill == "not learned"
@actor.learn_tree_skill(@skill.id)
@skilltree_window.refresh
actualize_data_window
end
end
module ST_command
def self.show(way, dude, to_map = false)
case way
when 0
$scene = Scene_SkillTree.new(dude, to_map)
when 1
for actor in $game_party.members
if actor.name == dude
$scene = Scene_SkillTree.new(actor.index, to_map)
end
end
when 2
if $game_party.members.include?($game_actors[dude])
$scene = Scene_SkillTree.new($game_actors[dude].index, to_map)
end
end
end
def self.reward(way, dude, amount = 1)
case way
when 0
$game_party.members[dude].reward_st_points(amount)
when 1
for actor in $game_party.members
if actor.name == dude
actor.reward_st_points(amount)
end
end
when 2
if $game_party.members.include?($game_actors[dude])
$game_actors[dude].reward_st_points(amount)
end
end
end
def self.reward_party(amount = 1)
for member in $game_party.members
member.reward_st_points(amount)
end
end
def self.reset(way, dude)
case way
when 0
$game_party.members[dude].reset_skill_trees
when 1
for actor in $game_party.members
if actor.name == dude
actor.reset_skill_trees
end
end
when 2
if $game_party.members.include?($game_actors[dude])
$game_actors[dude].reset_skill_trees
end
end
end
def self.reset_party
for member in $game_party.members
member.reset_skill_trees
end
end
end
when the error occurs, it says it happens at line 307:
data_skill = $data_skills[get_skill_next_level(count)]
that script runs from the information input into this script here:
module ST_setup
################################################################################
# * Setup * #
# Basic? - Skill Tree - of Awesome v1.22 #
# 19 Feb 2011 #
################################################################################
# Author: Leongon #
# Contact: carlos_gon47@hotmail.com (or PM leongon on the board below) #
# Licence: Free for commercial and non-commercial proyects, just credit. #
# Share: Exclusive for www.rpgrevolution.com #
# If you want to share it outside give a link only, please. #
################################################################################
# This is my very first big non-so-basic script, and I'm very proud of how it #
# got done, almost exactly what I wanted to accomplish when I start writing it #
# about a week ago. #
# ---------------------------------------------------------------------------- #
# As the name says, this script introduces the very popular function from most #
# MMORPGs: Skill Trees, or talent trees if you prefer, for your heroes. #
# #
# You need to work only in this one, the Core manages the info you give here #
# and builds the system. #
################################################################################
# Instructions # #
################ #
# #
# This works pretty much like Tankentai's action sequences building. You'll #
# need to create objects that you must organize at the end in the final trees. #
# I put descriptions and syntax in each sections to help you on understanding #
# how to build your trees. So read each carefully. #
# #
# Actually I made it to be able to work like Diablo II and World of Warcraft #
# talent systems. Combine both systems if you want. Play with the object's #
# requirements to make it work as you like. #
# #
# If you don't understand this, play the Tutorial, is almost a game more than #
# a demo, and it will carry you around some of this script posibilities, and #
# teach you how to use them. #
# #
# If you still need guidance, find bugs or have ideas, reply on the thread. #
# I will answer everything that is not already explained here, the thread or #
# in the tutorial, if I'm still around. (One never knows what the life have #
# for fate) #
# #
################################################################################
################################################################################
# Command List # Commands for use on script call events #
################ #
# Commands: #
# #
# ST_command::show(mode, actor, exit) - Opens directly an actor's tree. #
# #
# ST_command::reward(mode, actor, quantity) - Give extra points to an actor. #
# ST_command::reward_party(quantity) - Give extra points to party. #
# #
# ST_command::reset(mode, actor) - Reset an actor's skill trees. #
# ST_command::reset_party - Reset entire party skill trees. #
# #
# ---------------------------------------------------------------------------- #
# Values: #
# #
# mode 0 - Target actor by party position. #
# 1 - Target actor by actor name. #
# 2 - Target actor by actor ID. #
# #
# actor Actor position, name or ID, depending on mode. #
# #
# exit true - Exits to Map uppon leaving the Skill Tree scene. #
# Ommit for exiting to menu. #
# #
# quantity Amount of skill points to reward. #
# Ommit to reward one point. #
# #
################################################################################
#------------------------------------------------------------------------------#
# * General Settings * #
# #
# --------- System ---------- # ---------------------------------------------- #
ST_menu_pos = 2 # Menu index to land when exiting Skill Trees. #
ST_scale_mode = true # (true-false) Skills that require actor level #
# will scale with each point spended, requiring #
# one more actor level each time. #
ST_level_up_point = true # (true-false) Gain a skill point on level up. #
ST_first_skill_point = 10 # Actor lvl where start gaining skill points at. #
ST_confirm_popup = true # (true-false) Require confirm for spend point. #
ST_notalents_popup = true # (true-false) Show warning pop-up for actors #
# without skill trees available. #
ST_notalents_popAN = true # (true-false) Include actor's name in warning #
# string for actors without skill trees. #
# -------- Language --------- # ---------------------------------------------- #
ST_menu = "Talents" # Menu selection command. Will be used on menu #
# access to the skill trees. #
ST_voc_max = "Maxed" # Skill maxed. #
ST_voc_unl = "Not Learned" # Skill still not learned. #
ST_voc_now = "Now: " # Actual skill level description. #
ST_voc_nex = "Next: " # Next skill level description. #
ST_voc_cur = "Skill Points:"# Currency count. #
ST_voc_req = "Require:" # Title for requirements. #
ST_voc_lvl = "Hero level " # Hero level required. #
ST_voc_one = " point in " # One point required. #
ST_voc_many = " points in " # More than one point required. #
ST_voc_q = "Are you sure?" # Confirm box question. #
ST_voc_ok = "Ok" # Confirm selection. #
ST_voc_cancel = "Cancel" # Revoke selection. #
ST_voc_noSTpop_pre = "" # Text before actor's name for no-tree warning. #
ST_voc_noSTpop_pos = " doesn't seem to be able to improve talents." # Text #
# after actor's name for no-tree warning. #
ST_voc_noSTpop = "Continue" # Command for actors without skill trees #
# -------- Graphics --------- # ---------------------------------------------- #
ST_zero_sp_color = 10 # (0-31) Color for zero skill points. #
ST_skillname_color = 14 # (0-31) Color for selected skill's name. #
ST_arrow_disabled = 118 # (0-255) Alpha for disabled arrow objects. #
ST_skill_disabled = 138 # (0-255) Alpha for disabled skill objects. #
ST_show_obj_lvl = true # (true-false) Show object level over the icons. #
ST_arrow_hue = 155 # (0-360) This is the color variance of the #
# arrow's graphics. #
ST_imageback = 240 # (0-255) Alpha. Replaces the main tree window #
# background with an image. To disable this mode #
# use false. Images must be at 206x348 size, in #
# Graphics/System/ folder, matching the tree #
# names in Tree Building section. (Ex: ARMS.png) #
ST_windows_var = 6 # (ID) Game-variable ID that controls windows #
# distribution on the screen. Change the value #
# of that variable from 0 to 7, try them all. #
ST_tree_selection = 0 # (0-2) Tree selection windows work option. #
# 0: Animated cursor. 1: Steady cursor. #
# 2: Colour name, no cursor. #
ST_treeselection_color = 10 # Color for tree selection option 2. #
#-----------------------------#------------------------------------------------#
ST_arrow = [ # Don't touch.
#------------------------------------------------------------------------------#
# * Arrow Graphics List * #
# #
# You don't need to touch this section unless you change the arrow's order in #
# the SkillTree.png file. #
#------------------------------------------------------------------------------#
# "GraphicName", #
"A_l_st", # To left line, start. #
"A_r_st", # To right line, start. #
"A_ver_st", # Vertical line, start. #
"A_ver", # Vertical line. #
"A_hor", # Horizontal line. #
"A_ver_end", # Vertical line, end. #
"A_l_end", # To left line, end. #
"A_r_end", # To right line, end. #
"A_ver_w_diag_r", # Vertical line with right diagonal branch. #
"A_ver_w_diag_l", # Vertical line with left diagonal branch. #
"A_diag_r_st", # Diagonal to right line, start. #
"A_diag_r_abo_cor", # Diagonal to right upper chunk. #
"A_diag_r_bel_cor", # Diagonal to right lower chunk. #
"A_diag_r", # Diagonal to right line. #
"A_diag_r_end", # Diagonal to right line, end. #
"A_diag_l_st", # Diagonal to left line, start. #
"A_diag_l_abo_cor", # Diagonal to left upper chunk. #
"A_diag_l_bel_cor", # Diagonal to left lower chunk. #
"A_diag_l", # Diagonal to left line. #
"A_diag_l_end", # Diagonal to left line, end. #
] # Don't touch. #
#------------------------------------------------------------------------------#
ST_object = { # Don't touch.
#------------------------------------------------------------------------------#
# * Creating Arrow Objects * #
# #
# Here you build arrow objects for each tree. Each arrow fragment must be #
# created as a unique arrow object, that way they can have requirements to be #
# enabled. #
#------------------------------------------------------------------------------#
# #
# "ArrowObject" - Is the unique name for that arrow object. #
# "arrow_object" - Identifier, use always "arrow_object". #
# "arrow" - Is the graphic name from Arrow Graphics List section. #
# "dadskill" - Father Skill Object name. The skill object that conditions #
# this arrow object. #
#------------------------------------------------------------------------------#
# "ArrowObject" => ["arrow_object", "arrow", "dadskill"],
"MF_1_1" => ["arrow_object", "A_ver_st", "MF_1"],
"MF_1_2" => ["arrow_object", "A_ver_end", "MF_1"],
"MF_2_1" => ["arrow_object", "A_diag_l_st", "MF_2"],
"MF_2_2" => ["arrow_object", "A_diag_l_end", "MF_2"],
"MF_2_3" => ["arrow_object", "A_diag_l_abo_cor", "MF_2"],
"MF_2_4" => ["arrow_object", "A_diag_l_bel_cor", "MF_2"],
"MF_4_1" => ["arrow_object", "A_ver_st", "MF_4"],
"MF_4_2" => ["arrow_object", "A_ver_end", "MF_4"],
"WA_1_1" => ["arrow_object", "A_ver_st", "WA_1"],
"WA_1_2" => ["arrow_object", "A_ver_end", "WA_1"],
# #
#------------------------------------------------------------------------------#
#------------------------------------------------------------------------------#
# * Creating Skill Objects * #
# #
# Here you build skill objects for each tree. They contain the info regarding #
# their levels and requirements to be enabled, and for enabling other skill #
# objects. #
#------------------------------------------------------------------------------#
# #
# "SkillObject" - Is the unique name for that skill object. #
# reqlvl - Is the actor needed level for this object to be enabled. #
# treepts - Are the required points spended in the tree for this object #
# to be enabled. #
# "dad" - "mom" - Parents skill Object name. Skill objects that conditions #
# this skill object. Use nil for no dependance. #
# maxlvl - Is the maximum skill points spendable on this skill object. #
# childreqlvl - Is the necessary ammount of points in this skill object to #
# allow spending points in skills linked to this one. #
# idlvl... - Are the Skill IDs for each level of that skill. #
# -----------------------------------------------------------------------------#
# "SkillObject" => [reqlvl, treepts, "dad", "mom", maxlvl, childreqlvl, idlvl1, idlvl2,...],
"MF_1" => [15, 5, "MF_2", "MF_3", 5, 5, 1, 2, 3, 4, 5],
"MF_2" => [1, 0, nil, nil, 3, 0, 6, 7, 8],
"MF_3" => [3, 3, "MF_1", nil, 5, 0, 9, 10, 11, 12, 13],
"MF_4" => [6, 5, nil, nil, 5, 0, 14, 15, 16, 17, 18],
"MF_5" => [10, 7, nil, nil, 0, 0, 19, 20, 21, 22, 23],
"MF_6" => [15, 6, "MF_5", nil, 5, 5, 24, 25, 26, 27, 28],
"MF_7" => [20, 12, nil, nil, 5, 5, 29, 30, 31, 32, 33],
"MF_8" => [25, 9, nil, nil, 5, 5, 34, 35, 36, 37, 38],
"MF_9" => [30, 10, nil, nil, 5, 5, 39, 40, 41, 42, 43],
"MF_0" => [40, 10, "MF_9", nil, 1, 0, 82],
"WA_1" => [10, 0, nil, nil, 3, 3, 44, 45, 46],
"WA_2" => [15, 3, nil, nil, 5, 0, 47, 48, 49, 50, 51],
"WA_3" => [20, 8, nil, nil, 5, 0, 52, 53, 54, 55, 56],
"WA_4" => [25, 13, nil, nil, 5, 0, 57, 58, 59, 60, 61],
"WA_5" => [30, 18, "WA_3", "WA_4", 5, 5, 62, 63, 64, 65, 66],
"WA_6" => [35, 21, "WA_5", nil, 3, 3, 67, 68, 69],
"WA_7" => [40, 26, "WA_6", nil, 5, 5, 70, 71, 72, 73, 74],
"WA_8" => [45, 31, "WA_6", "WA_7", 5, 3, 75, 76, 77, 78, 79],
"WA_9" => [50, 32, "WA_8", nil, 1, 0, 80],
"WA_0" => [60, 33, nil, nil, 1, 5, 81],
"SE_1" => [10, 0, nil, nil, 3, 0, 84, 85, 86],
} # Don't touch. #
#------------------------------------------------------------------------------#
ST_tree_build = { # Don't touch.
#------------------------------------------------------------------------------#
# * Tree Building * #
# #
# Here you build each skill tree using the previous set'd skill and arrow #
# objects. #
# #
# There are 7 slots per row, being 1, 4 and 7 for skill objects, while 2,3,5 #
# and 6 are for arrow objects. Rows have no max limit, you have the first one #
# for skills, next two are for arrows and so. #
#------------------------------------------------------------------------------#
# #
# "TREE_NAME" - Is the tree unique name. #
# "obj..." - Skill or Arrow Object name from the previous sections. #
# For empty slot use nil. #
# -----------------------------------------------------------------------------#
# "TREE_NAME" => [obj 1,obj 2,obj 3,obj 4,obj 5,obj 6,obj 7],
"Self Enhancement" => ["MF_1",nil,nil,nil,nil,nil,nil,
nil,"MF_2",nil,nil,nil,nil,nil,
nil,nil,"MF_3",nil,nil,nil,nil,
nil,nil,nil,"MF_4",nil,nil,nil,
nil,nil,"MF_5",nil,nil,nil,nil,
nil,nil,nil,"MF_6",nil,nil,nil,
nil,nil,nil,nil,nil,"MF_7",nil,
nil,nil,nil,nil,"MF_8",nil,nil,
nil,nil,nil,"MF_9",nil,nil,nil,
nil,nil,"MF_0",nil,nil,nil,nil],
"Melee Enhancement" => ["WA_1",nil,nil,nil,nil,nil,"WA_2",
nil,nil,nil,"WA_3",nil,nil,nil,
nil,nil,nil,nil,nil,nil,nil,
"WA_4",nil,nil,nil,nil,nil,nil,
nil,nil,nil,"WA_5",nil,nil,nil,
nil,nil,nil,nil,nil,nil,"WA_6",
"WA_7",nil,nil,nil,"WA_8",nil,nil,
nil,nil,"WA_9",nil,nil,nil,nil,
nil,nil,nil,nil,nil,"WA_0",nil],
"Spell Enhancement" => [nil,nil,nil,"SE_1",nil,nil,nil],
} # Don't touch. #
#------------------------------------------------------------------------------#
ST_class_assign = { # Don't touch.
#------------------------------------------------------------------------------#
# * Asigning Skill Trees to Classes * #
# #
# Here you set the available trees for each class. Max of 3 trees per class. #
# If less, use nil. #
#------------------------------------------------------------------------------#
# #
# ClassID - Is the class id, d'oh. #
# "TREE..." - Are the tree's unique names from Tree Building section, #
# this class have available. #
# "Display..." - Are the displayed name for that skill tree. Ex: Having #
# "Protection" tree for Warriors and Paladins in WoW. #
#------------------------------------------------------------------------------#
# ClassID => ["TREE_1", "TREE_2", "TREE_3", "Display 1", "Display 2", "Display 3"],
1 => ["Self Enhancement", "Melee Enhancement", "Spell Enhancement", "Self Enhancement", "Melee Enhancement", "Spell Enhancement"],
2 => ["Self Enhancement", "Melee Enhancement", nil, "Self Enhancement", "Melee Enhancement", nil],
3 => ["Self Enhancement", nil, "Spell Enhancement", "Self Enhancement", nil, "Spell Enhancement"],
} # Don't touch. #
#------------------------------------------------------------------------------#
#------------------------------------------------------------------------------#
end # of Skill Tree's setup script. #
#------------------------------------------------------------------------------#
I've double-checked everything with what I have setup in my first game and everything in the FIRST script is identical between the two, which leads me to believe the issue is being caused in this one somewhere, somehow with the way I set things up. I've looked things over for several hours and can't seem to figure out the problem. Can anyone with any scripting knowledge please have a look and see if you can find either a work-around, a fix/solution, or modify it so it works?