Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Skill Editable level

Hi, I would like a script, first to give levels to some skills, changing their damage and sp cost. And also a way to change any time the skill level, choosing between levels under his current level, for instance by pressing left or right button when selecting the skill. (something like on Ragnarok Online)

(it might be hard but thanks to the one who'll find a solution)

Oh yea, I already tried some scripts posted here but they aren't working with mine.

I should post my main skills scripts that I modified :

class Window_Skill < Window_Selectable

def initialize(actor)
super(0, 128, 304, 352)
@actor = actor
@column_max = 1
refresh
self.index = 0
if $game_temp.in_battle
self.y = 64
self.height = 256
self.back_opacity = 160
end
end

def skill
return @data[self.index]
end

def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in 0...@actor.skills.size
skill = $data_skills[@actor.skills]
if skill != nil
@data.push(skill)
end
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
self.contents.font.name = $fontface
for i in 0...@item_max
draw_item(i)
end
end
end

def draw_item(index)
skill = @data[index]
if @actor.skill_can_use?(skill.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4 + index % 1 * 304
y = index * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(skill.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 189, 32, skill.name, 0)
self.contents.draw_text(x + 217, y, 48, 32, skill.sp_cost.to_s, 2)
end

def update_help
@help_window.set_text(self.skill == nil ? "" : self.skill.description)
end
end


class Window_SkillStat < Window_Base
def initialize(actor)
super(0, 64, 304, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
@actor = actor
refresh
end

def refresh
self.contents.clear
draw_actor_name(@actor, 4, 0)
end
end

class Window_SkillStatus < Window_Base
def initialize(actor)
super(0, 64, 640, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
@actor = actor
refresh
end

def refresh
self.contents.clear
draw_actor_name(@actor, 4, 0)
draw_actor_state(@actor, 140, 0)
draw_actor_hp(@actor, 284, 0)
draw_actor_sp(@actor, 460, 0)
end
end
class Window_Target < Window_Selectable

def initialize
super(304, 64, 336, 416)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.z += 10
@item_max = $game_party.actors.size
refresh
end

def refresh
self.contents.clear
for i in 0...$game_party.actors.size
x = 4
y = i * 84
actor = $game_party.actors
draw_actor_name(actor, x, y)
draw_actor_state(actor, x + 144, y)
draw_actor_hp(actor, x, y + 32)
draw_actor_sp(actor, x + 152, y + 32)
end
end

def update_cursor_rect
if self.active == false
self.cursor_rect.empty
end
if self.index >= 0 and self.active
self.cursor_rect.set(0, @index * 84, self.width - 32, 64)
elsif self.index >= -1 and self.active
self.cursor_rect.set(0, 0, self.width - 32, self.height - 32)
end
end
end

class Window_EquipLeft < Window_Base

def initialize(actor)
super(0, 64, 272, 416)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
@actor = actor
refresh
end

def refresh
self.contents.clear
draw_actor_name(@actor, 4, 0)
draw_actor_level(@actor, 4, 32)
draw_actor_parameter(@actor, 4, 64, 0)
draw_actor_parameter(@actor, 4, 96, 1)
draw_actor_parameter(@actor, 4, 128, 2)
draw_actor_parameter(@actor, 4, 160, 3)
draw_actor_parameter(@actor, 4, 192, 4)
draw_actor_parameter(@actor, 4, 224, 5)
draw_actor_parameter(@actor, 4, 256, 6)
draw_actor_parameter(@actor, 4, 288, 7)

if @new_atk != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 64, 40, 32, "->", 1)
self.contents.font.color = normal_color
self.contents.draw_text(200, 64, 36, 32, @new_atk.to_s, 2)
end

if @new_pdef != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 96, 40, 32, "->", 1)
self.contents.font.color = normal_color
self.contents.draw_text(200, 96, 36, 32, @new_pdef.to_s, 2)
end

if @new_mdef != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 128, 40, 32, "->", 1)
self.contents.font.color = normal_color
self.contents.draw_text(200, 128, 36, 32, @new_mdef.to_s, 2)
end

if @new_str != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 160, 40, 32, "->", 1)
self.contents.font.color = normal_color
self.contents.draw_text(200, 160, 36, 32, @new_str.to_s, 2)
end

if @new_dex != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 192, 40, 32, "->", 1)
self.contents.font.color = normal_color
self.contents.draw_text(200, 192, 36, 32, @new_dex.to_s, 2)
end

if @new_agi != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 224, 40, 32, "->", 1)
self.contents.font.color = normal_color
self.contents.draw_text(200, 224, 36, 32, @new_agi.to_s, 2)
end

if @new_int != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 256, 40, 32, "->", 1)
self.contents.font.color = normal_color
self.contents.draw_text(200, 256, 36, 32, @new_int.to_s, 2)
end

if @new_eva != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 288, 40, 32, "->", 1)
self.contents.font.color = normal_color
self.contents.draw_text(200, 288, 36, 32, @new_eva.to_s, 2)
end
end

def set_new_parameters(new_atk, new_pdef, new_mdef, new_str,new_dex,new_agi, new_int, new_eva)
if @new_atk != new_atk or @new_pdef != new_pdef or @new_mdef != new_mdef or
@new_str != new_str or @new_dex != new_dex or @new_agi != new_agi or
@new_int != new_int or @new_eva != new_eva
@new_atk = new_atk
@new_pdef = new_pdef
@new_mdef = new_mdef
@new_str = new_str
@new_dex = new_dex
@new_agi = new_agi
@new_int = new_int
@new_eva = new_eva
refresh
end
end
end
class Window_EquipRight < Window_Selectable
def initialize(actor)
super(272, 64, 368, 192)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
@actor = actor
refresh
self.index = 0
end

def item
return @data[self.index]
end

def refresh
self.contents.clear
@data = []
@data.push($data_weapons[@actor.weapon_id])
@data.push($data_armors[@actor.armor1_id])
@data.push($data_armors[@actor.armor2_id])
@data.push($data_armors[@actor.armor3_id])
@data.push($data_armors[@actor.armor4_id])
@item_max = @data.size
self.contents.font.color = system_color
self.contents.draw_text(4, 32 * 0, 92, 32, $data_system.words.weapon)
self.contents.draw_text(4, 32 * 1, 92, 32, $data_system.words.armor1)
self.contents.draw_text(4, 32 * 2, 92, 32, $data_system.words.armor2)
self.contents.draw_text(4, 32 * 3, 92, 32, $data_system.words.armor3)
self.contents.draw_text(5, 32 * 4, 92, 32, $data_system.words.armor4)
draw_item_name(@data[0], 92, 32 * 0)
draw_item_name(@data[1], 92, 32 * 1)
draw_item_name(@data[2], 92, 32 * 2)
draw_item_name(@data[3], 92, 32 * 3)
draw_item_name(@data[4], 92, 32 * 4)
end

def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
class Scene_Skill
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
end

def main
@actor = $game_party.actors[@actor_index]
@status_window = Window_SkillStat.new(@actor)
@help_window = Window_Help.new
@skill_window = Window_Skill.new(@actor)
@skill_window.help_window = @help_window
@target_window = Window_Target.new
@target_window.active = false
@target_window_visible = true
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end

Graphics.freeze
@status_window.dispose
@help_window.dispose
@skill_window.dispose
@target_window.dispose
end

def update
@status_window.update
@help_window.update
@skill_window.update
@target_window.update
if @skill_window.active
update_skill
return
end
if @target_window.active
update_target
return
end
end

def update_skill
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new(1)
return
end
if Input.trigger?(Input::C)
@skill = @skill_window.skill
if @skill == nil or not @actor.skill_can_use?(@skill.id)
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
if @skill.scope >= 3
@skill_window.active = false
@target_window.active = true
if @skill.scope == 4 || @skill.scope == 6
@target_window.visible = true
elsif @skill.scope == 7
@target_window.index = @actor_index - 10
else
@target_window.index = 0
end
else
if @skill.common_event_id > 0
$game_temp.common_event_id = @skill.common_event_id
$game_system.se_play(@skill.menu_se)
@actor.sp -= @skill.sp_cost
@skill_window.refresh
@target_window.refresh
$scene = Scene_Map.new
return
end
end
return
end
if Input.trigger?(Input::R)
$game_system.se_play($data_system.cursor_se)
@actor_index += 1
@actor_index %= $game_party.actors.size
$scene = Scene_Skill.new(@actor_index)
return
end
if Input.trigger?(Input::L)
$game_system.se_play($data_system.cursor_se)
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
$scene = Scene_Skill.new(@actor_index)
return
end
end

def update_target
# If B button was pressed

if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Erase target window
@skill_window.active = true
@target_window.active = false
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# If unable to use because SP ran out
unless @actor.skill_can_use?(@skill.id)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# If target is all
if @target_window.index == -1
# Apply skill use effects to entire party
used = false
for i in $game_party.actors
used |= i.skill_effect(@actor, @skill)
end
end
# If target is user
if @target_window.index <= -2
# Apply skill use effects to target actor
target = $game_party.actors[@target_window.index + 10]
used = target.skill_effect(@actor, @skill)
end
# If single target
if @target_window.index >= 0
# Apply skill use effects to target actor
target = $game_party.actors[@target_window.index]
used = target.skill_effect(@actor, @skill)
end
# If skill was used
if used
# If item(s) are used
if @actor.is_a?(Game_Actor)
items = @actor.medium(@skill.id)
if items
for item in items
id = @actor.item_name(item[0])
num = item[1] == nil ? 1 : item[1]
# Check if consumable
if $data_items[id].consumable
$game_party.gain_item(id, -num)
end
end
end
end
# Play skill use SE
$game_system.se_play(@skill.menu_se)
# Use up SP
@actor.sp -= @skill.sp_cost
# Remake each window content
@status_window.refresh
@skill_window.refresh
@target_window.refresh
# If entire party is dead
if $game_party.all_dead?
# Switch to game over screen
$scene = Scene_Gameover.new
return
end
# If command event ID is valid
if @skill.common_event_id > 0
# Command event call reservation
$game_temp.common_event_id = @skill.common_event_id
# Switch to map screen
$scene = Scene_Map.new
return
end
end
# If skill wasn't used
unless used
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
end
return
end
end
end
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top