My first request and I blaming myself.
Ok now with a bit better description:
1. Place this Script into your Game:
module Deity
module Skillrename
# To call the Skillrename WIndow you should wirte this into the "Call..."
# command or from the Menu whatever:
# $scene = Scene_SkillReName.new(skillset_index)
# If you wish you can change the Settings ingmae with the "Call..." command
# just write:
# Deity::Skillrename::Constant you wish to change.
# For example:
# Deity::Skillrename::MAX_LETTER = 12
# But after you load the game the Settings changing to there standart values.
# Settings #
# Just add as many Skillsets as you wish. And the keyword which should be
# replaced with the chosen word.
# Now just name the Skills in your Database and place the keyword into
# the name. The script will do the rest.
# For emaple you call "Double Attack" to "Double <bash>" Attack" and the
# player choose the name "Fire". The new would be:
# "Double Fire Attack".
# You can rename the skills as often as you wish.
SKILL_SETTINGS = {
#Skillset number Keyword of Skillset
1 => "<bash>",
2 => "<break>",
}
LAST_SCENE_RETURN = "Scene_Map" # last scene in which the scene was called
PARAMETER = "()" # Parameter for the last scene
MAX_LETTERS = 8 # Max letters for the Skillnames
PICTURE_NAME = "" # Name of the picture which should shown inteat of the
# Face. The picture has to be in the "Graphics/Picture"
# file.
end
end
include Deity::Skillrename
class Scene_Title
alias command_new_game_skillsets_fill command_new_game unless $@
def command_new_game
command_new_game_skillsets_fill
$game_system.fill_skillsets
end
end
class Game_System
attr_reader :skillsets
def fill_skillsets
@skillsets = {}
for i in SKILL_SETTINGS.keys
@skillsets[i] = []
for id in 1...$data_skills.size
if $data_skills[id].name.include?(SKILL_SETTINGS[i])
@skillsets[i].push([id,""])
end
end
end
end
end
class Window_SkillNameEdit < Window_Base
attr_reader :name # name
attr_reader :index # cursor position
attr_reader :max_char # maximum number of characters
def initialize(skillset)
super(88, 20, 368, 128)
@name = ""
@max_char = MAX_LETTERS
name_array = @name.split(//)[0...@max_char] # Fit within max length
@name = $game_system.skillsets[skillset][0][1]
for i in 0...name_array.size
@name += name_array[i]
end
@default_name = @name
@index = name_array.size
self.active = false
refresh
update_cursor
end
def restore_default
@name = @default_name
@index = @name.split(//).size
refresh
update_cursor
end
def add(character)
if @index < @max_char and character != ""
@name += character
@index += 1
refresh
update_cursor
end
end
def back
if @index > 0
name_array = @name.split(//) # Delete one character
@name = ""
for i in 0...name_array.size-1
@name += name_array[i]
end
@index -= 1
refresh
update_cursor
end
end
def item_rect(index)
rect = Rect.new(0, 0, 0, 0)
rect.x = 220 - (@max_char + 1) * 12 + index * 24
rect.y = 36
rect.width = 24
rect.height = WLH
return rect
end
def refresh
self.contents.clear
if PICTURE_NAME != ""
bitmap = Cache.picture(PICTURE_NAME)
rect = Rect.new(0,0,bitmap.width,bitmap.height)
self.contents.blt(0,0,bitmap,rect)
end
name_array = @name.split(//)
for i in 0...@max_char
c = name_array[i]
c = '_' if c == nil
self.contents.draw_text(item_rect(i), c, 1)
end
end
def update_cursor
self.cursor_rect = item_rect(@index)
end
def update
super
update_cursor
end
end
class Scene_SkillReName < Scene_Base
def initialize(skillset)
@skill_set = skillset
end
def start
super
create_menu_background
@edit_window = Window_SkillNameEdit.new(@skill_set)
@input_window = Window_NameInput.new
end
def terminate
super
dispose_menu_background
@edit_window.dispose
@input_window.dispose
end
def return_scene
$scene = eval("#{LAST_SCENE_RETURN}.new#{PARAMETER}")
end
def update
super
update_menu_background
@edit_window.update
@input_window.update
if Input.repeat?(Input::B)
if @edit_window.index > 0 # Not at the left edge
Sound.play_cancel
@edit_window.back
end
elsif Input.trigger?(Input::C)
if @input_window.is_decision # If cursor is positioned on [OK]
if @edit_window.name == "" # If name is empty
@edit_window.restore_default # Return to default name
if @edit_window.name == ""
Sound.play_buzzer
else
Sound.play_decision
end
else
Sound.play_decision
rename_skillset(@skill_set,@edit_window.name) # Change actor name
return_scene
end
elsif @input_window.character != "" # If text characters are not empty
if @edit_window.index == @edit_window.max_char # at the right edge
Sound.play_buzzer
else
Sound.play_decision
@edit_window.add(@input_window.character) # Add text character
end
end
end
end
def rename_skillset(skillset,name)
for o in 0...$game_system.skillsets[skillset].size
i = $game_system.skillsets[skillset][o][0]
$data_skills[i].name = $data_skills[i].name.gsub(SKILL_SETTINGS[skillset],name)
$game_system.skillsets[skillset][o][1] = name
end
end
end
class Scene_File
alias do_load_skillrename do_load unless $@
def do_load
do_load_skillrename
for o in $game_system.skillsets
if !o[1].empty?
key = o[0]
id = o[1][0][0]
name = o[1][0][1]
$data_skills[id].name = $data_skills[id].name.gsub(SKILL_SETTINGS[key],name)
end
end
end
end
2. Setup the Settings. The most important part is this:
SKILL_SETTINGS = {
#Skillset number Keyword of Skillset
1 => "<bash>",
2 => "<break>",
}
The number is the skillsetindex and the text behind is the keyword which will be replaced in the skillnames.
You can add as many as you wish.
3. Rename the Skills. Just add the keyword at the right place into the skillname.
4. Now you can oppen the Scene. Just use "Script ..." and paste this line:
$scene = Scene_SkillReName.new(
skillset_index)
You have to replace the
skillset_index with the skillsetindex you wish to rename. This is why the last error happens. ^^
It could look like this:
$scene = Scene_SkillReName.new(1)
This Scene would rename all skill wich include "<bash>" in their name.
I hope this time it works.
Deity