- Joined
- Mar 15, 2012
- Messages
- 33
- Reaction score
- 11
- First Language
- English
I'm attempting to write an unidentified items script, and this includes potentially changing the displayed names of unidentified items (and also other stuff like description, price, icon index, for example, eventually).
However, I'm having problems working out how to change the displayed name of an item, conditionally or at all. At first I thought I'd be able to override Game_Item.prototype.name with a function that under the right conditions returns a different name, but that doesn't seem to work.
What I have for conditionally replacing the name currently looks like this (without a check for whether it's identified, because right now I really just want this to work; without being able to conditionally change the displayed name, the rest is kind of pointless), and is probably stupid in at least one way:
Game_Item.prototype.name = function() {
if (this.meta.unidentified_name){
return this.meta.unidentified_name;
}
else {
return this.name;
}
};
With this, in-game dialogues, like the inventory or item select windows, still display the proper name of an item even when unidentified_name has been supplied in the item's note, and '$dataItems[1].meta.unidentified_name' returns the supplied alternate name for the item (because I'm lazy and test with potion).
Is this even the right place to be looking? Or am I on the right track, but doing something wrong?
However, I'm having problems working out how to change the displayed name of an item, conditionally or at all. At first I thought I'd be able to override Game_Item.prototype.name with a function that under the right conditions returns a different name, but that doesn't seem to work.
What I have for conditionally replacing the name currently looks like this (without a check for whether it's identified, because right now I really just want this to work; without being able to conditionally change the displayed name, the rest is kind of pointless), and is probably stupid in at least one way:
Game_Item.prototype.name = function() {
if (this.meta.unidentified_name){
return this.meta.unidentified_name;
}
else {
return this.name;
}
};
With this, in-game dialogues, like the inventory or item select windows, still display the proper name of an item even when unidentified_name has been supplied in the item's note, and '$dataItems[1].meta.unidentified_name' returns the supplied alternate name for the item (because I'm lazy and test with potion).
Is this even the right place to be looking? Or am I on the right track, but doing something wrong?
Last edited by a moderator:
