Prohibiting same character name

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV

Finn

Master of Nothing
Veteran
Joined
Aug 5, 2014
Messages
38
Reaction score
0
First Language
English
Primarily Uses
Hello again, there is a slight problem I have regarding the script, it doesn't recognize the casing of letters. I put "PETER" and saved, but I entered again "Peter"

it is accepted.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
easy peasy :) Just convert everything to lower case when saving and when comparing. It does not change the name of the actor while it's doing it.

module DataManager class << self alias shaz_unique_names_load_normal_database load_normal_database alias shaz_unique_names_save_game_without_rescue save_game_without_rescue end def self.load_normal_database shaz_unique_names_load_normal_database begin $data_names = load_data("PC_Names.rvdata2") rescue $data_names = [] end end def self.save_game_without_rescue(index) save_name return shaz_unique_names_save_game_without_rescue(index) end def self.save_name $data_names.push($game_actors[1].name.downcase) File.open("PC_Names.rvdata2", "wb") do |file| Marshal.dump($data_names, file) end endendclass Game_Interpreter def actor_name_used? $data_names.include?($game_actors[1].name.downcase) endendThe names already saved are in the case you entered them, so you might want to clobber the file and start over.
 
Last edited by a moderator:

Finn

Master of Nothing
Veteran
Joined
Aug 5, 2014
Messages
38
Reaction score
0
First Language
English
Primarily Uses
Thank you sir, it works like a charm again :D
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c

Forum statistics

Threads
105,857
Messages
1,017,018
Members
137,563
Latest member
MinyakaAeon
Top