-
Skill Rename script
April/7/2010
Summary
You know how you can rename a character during game play by just calling up the naming screen.
Well what I want is a script that allows me to do the same but with the name of a skill.
I want to be able to completely change the name of a skill and or part of the skill name.
Features Desired
- Rename part of a skill or a complete name change to a skill.
Mockups
None.
Games its been in
Did you search?
Yes
Where did you search?
- RMRK Forums
- RPG Revolution forums
- HBGame.org
What did you search for?
- Skill name change
- Rename skill
-
This can be pretty easy. Do you have any special requests for what the naming scene looks like? Also, do you want there to be a menu where the player can rename any skill they choose, or do you want to have to event the command for every skill?
-
Well here is the Thing.
I want to rename a set of skills.
Like In my game the player will get a skill that will have different levels of power, each one stronger than the other.
The set of skills is as follows:
PSI Unity alpha
PSI Unity Beta
PSI Unity Gama
and
PSI Unity Omega
and I want the player to be able to rename the "Unity" part of each one.
Like the player chooses to name this skill set with the word "Game"...
Then the skill set will appear as:
PSI Game alpha
PSI Game Beta
PSI Game Gama
and
PSI Game Omega
I hope this makes sense.
As for the naming screen just the normal naming screen that is used for the actors is good enough.
But if I would like to set a custom face sprite for the skill renaming window if possible.
-
Hi.
I hope modern algebra will not be angry with me but I've written you this Scene. ^^
Here is the script:
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(party_member_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_NameEdit < 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_NameEdit.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("#{num}.new#{br}")
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
Just change the Settings at the begining rename your skills and you can start. :)
I'm not sure if this is the best method to change temporary the skillname but it works so if you wish you can use it.
Deity
-
Hey I put the script in and changed the settings like you said but I keep getting an error screen saying:
Script 'Scene_Name' line 15: ArgumentError occurred.
wrong number of arguments(2 for 1)
-
Sry a stupid mistake of my side.
Here is the correction:
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(party_member_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(@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("#{num}.new#{br}")
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
Deity
-
Okay the first error screen is gone but now I keep getting this error when ever I call the script...
NameError occurred while running script.
undefined local variable or method 'party_member_index' for
#<Game_Interpreter:0x14ffed8>
-
My first request and I blaming myself. :D
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
-
OH....
OKay then! I'll try that ASAP!
Edit:
Okay so I put in the script and in the Skill Settings I add 3 lines:
95 => "<Unity>",
130 => "<Unity>",
170 => "<Unity>",
The number being the number of the skill in the list of skills and the the word "Unity" the part of the name of the skill I want to change.
Okay so after that I set up an event with the call script tag like this:
$scene = Scene_SkillReName.new(95, 130, 170)
And then I get an error telling me that there was a wrong number of arguments (3 for 1) or something like that...
So then I switch the call script command to this:
$scene = Scene_SkillReName.new(95)
And I get this error message:
Script 'Skill rename' line 71: NoMethodError occurred.
undefined method '[]' for nil:NilClass
-
I've made an demo for you.
http://www.file-upload.net/index.php?to=links&id=2429753&img=0&cod=m9cbvj&hash=d67ad3ecd279c3a62533b81adad008ce
95 => "<Unity>",
130 => "<Unity>",
170 => "<Unity>",
You don't have to set each skillid. ^^
Just a "name" for a "skillset" which includes alls Skills with the keyword. just give the skillset an id which doesnt connect it with a skill. :)
btw. what means "ASAP"? ^^
Deity
-
As soon as possible I believe.
-
Wow thanks Diety!
The demo was helpful and the script works perfectly now! Thanks alot man!
Edit:
Just one little thing I noticed, the script works fine it's just when I first open up the Skill Rename window it won't show me the original name of the skill (Of the part of the skill that I want to rename) before I input something...
It just shows the face sprite and a blank name window...
Also I was wondering...,
After someone renames the skill is it possible to show the new name of the skill in a text window?
-
I'm glad that it finaly works. :)
It just shows the face sprite and a blank name window...
Ehm that's not normal and shouldn't happen. ^^ I'll look at the script again.
Also I was wondering...,
After someone renames the skill is it possible to show the new name of the skill in a text window?
If you already use a TextMessageSystem like the one from modern alggebra for sure it will write the new name. :)
If not I would write you a small command to show the skillname. :)
Deity
-
Okay I got the skill name in the message window thing down.
But I found another little error in the script.
Whenever I rename the skill once and go back to rename it again it will show me the name I put before and then only let me add letter to it instead of erasing the old name and writing a new one...
For example:
I choose the name "Game" so I put it into the name window.
But later ON I decide to change it to "Rift"
So when I open the window again it will show me the name "Game" and won't let me erase it and only lets me add to the name "Game".
So if one tries to change the name a second time and doesn't realize what's going on they will see something like this.
"GameRift" when it should only be "Rift".
-
I'm sry ut I wasn't able to reproduct the error.
Do you use the Script from the demo or the last one i postet?
Try to use the one from the demo there some more "features".
The Problem with the name can be solved very easy.
Just open the script go to line 64:
@name = $game_system.skillsets[skillset][0][1]
and replace $game_system.skillsets[skillset][0][1] with any word which should be drawn instead of the skillname which was choosen by the player.
You've only to mention that the word have to be written like this: "Word" so use "".
Deity
-
OMG dumn old me!
I should have used the one from the demo from the beggining!
Thanks a Million dude it works perfectly! with no errors.
Just one last thing that was over looked though...
When I rename the skill and use the skill I renamed in battle it still shows it as the Default name in the Battle Message window.
For example:
I renamed the move "PSI Unity a" to "PSI Game a".
But when I use the move "PSI Game a" it still appears as "PSI Unity a" in the message window during battle.
Any thoughts on how to fix this?
-
hi.
Sorry I never thought about this. My failure. ^^
Here is a better version which replace the keyword in the Description and the Battlemessages. I hope you like it. :)
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 => "<Unity>",
2 => "<Crank>",
}
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 = "Slime" # 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,SKILL_SETTINGS[i]])
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 = $game_system.skillsets[skillset][0][1]
@max_char = MAX_LETTERS
name_array = @name.split(//)[0...@max_char] # Fit within max length
@name = ""
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($game_system.skillsets[skillset][o][1],name)
$data_skills[i].description = $data_skills[i].description.gsub($game_system.skillsets[skillset][o][1],name)
$data_skills[i].message2 = $data_skills[i].message2.gsub($game_system.skillsets[skillset][o][1],name)
$data_skills[i].message1 = $data_skills[i].message1.gsub($game_system.skillsets[skillset][o][1],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?
for i in o[1]
key = o[0]
id = i[0]
name = i[1]
$data_skills[id].name = $data_skills[id].name.gsub(SKILL_SETTINGS[key],name)
$data_skills[id].description = $data_skills[id].description.gsub(SKILL_SETTINGS[key],name)
$data_skills[id].message1 = $data_skills[id].message1.gsub(SKILL_SETTINGS[key],name)
$data_skills[id].message2 = $data_skills[id].message2.gsub(SKILL_SETTINGS[key],name)
end
end
end
end
end
Deity
-
OH MOST EXCELLENT!!
*Guitar sounds!*
The script is perfect and goes great with my EarthBound game!
I'll make sure u get a BIG "thank you" in the credits dude!
Thanks again!
-
No problem. :)
I forgotten to notice that the name of the skills is only after load a file or after a "rename" changes. So in a Test Battle you wan't have the wanted Name.
Deity
-
Don't worry about that!
I never really use test battle anyways. Thanks again!