REFERENCING ITEMS
Posts
Pages:
1
well it's me again with some problem with rpg maker.
I'm using rpg maker VX and i am getting a bit better with the variables and calling events but i started wondering if there's any way to reference a item in a text window straight from the database, so when i put "You received X20" it'll just pull the item from the database and throw it into the text window.
I'm using rpg maker VX and i am getting a bit better with the variables and calling events but i started wondering if there's any way to reference a item in a text window straight from the database, so when i put "You received X20" it'll just pull the item from the database and throw it into the text window.
Insert this into a new script and use \I
oh neat thanks forum formatting
# ==============================
# Additional Display Items in Window_Message v1.0
# by GreatRedSpirit
# ==============================
# Allow the user to add new keywords which are converted into the names of
# items, skills, classes, and enemies.
# \I[x] : Display the name of an item with id x
# \W[x] : Display the name of a weapon with id x
# \A[x] : Display the name of an armor with id x
# \L[x] : Display the name of a class with id x
# \S[x] : Display the name of a skill with id x
# \E[x] : Display the name of an enemy with id x
# \O[x] : Display the name of a troop with id x
# \T[x] : Display the name of a state with id x
# \M[x] : Display the name of an animation with id x
# \CE[x] : Display the name of a common event with id x
# \R[x] : Display the name of an area with id x
#
# If x is not defined, write the error to the message box (maybe a popup?)
class Window_Message < Window_Selectable
alias convert_special_characters_iori convert_special_characters
def convert_special_characters
# Call the original method to convert variables, colors, ect.
convert_special_characters_iori
# \I[x] : Display the name of an item with id x
@text.gsub!(/\\I\[([0-9]+)\]/i) {
if $data_items[$1.to_i] != nil
$data_items[$1.to_i].name
else
"Invalid item at ID: " + $1
end
}
# \W[x] : Display the name of a weapon with id x
@text.gsub!(/\\W\[([0-9]+)\]/i) {
if $data_weapons[$1.to_i] != nil
$data_weapons[$1.to_i].name
else
"Invalid weapon at ID: " + $1
end
}
# \A[x] : Display the name of an armor with id x
@text.gsub!(/\\A\[([0-9]+)\]/i) {
if $data_armors[$1.to_i] != nil
$data_armors[$1.to_i].name
else
"Invalid armour at ID: " + $1
end
}
# \L[x] : Display the name of a class with id x
@text.gsub!(/\\L\[([0-9]+)\]/i) {
if $data_classes[$1.to_i] != nil
$data_classes[$1.to_i].name
else
"Invalid class at ID: " + $1
end
}
# \S[x] : Display the name of a skill with id x
@text.gsub!(/\\S\[([0-9]+)\]/i) {
if $data_skills[$1.to_i] != nil
$data_skills[$1.to_i].name
else
"Invalid skill at ID: " + $1
end
}
# \E[x] : Display the name of an enemy with id x
@text.gsub!(/\\E\[([0-9]+)\]/i) {
if $data_enemies[$1.to_i] != nil
$data_enemies[$1.to_i].name
else
"Invalid enemy at ID: " + $1
end
}
# \O[x] : Display the name of a troop with id x
@text.gsub!(/\\O\[([0-9]+)\]/i) {
if $data_troops[$1.to_i] != nil
$data_troops[$1.to_i].name
else
"Invalid troop at ID: " + $1
end
}
# \T[x] : Display the name of a state with id x
@text.gsub!(/\\T\[([0-9]+)\]/i) {
if $data_states[$1.to_i] != nil
$data_states[$1.to_i].name
else
"Invalid state at ID: " + $1
end
}
# \M[x] : Display the name of an animation with id x
@text.gsub!(/\\M\[([0-9]+)\]/i) {
if $data_animations[$1.to_i] != nil
$data_animations[$1.to_i].name
else
"Invalid animation at ID: " + $1
end
}
# \CE[x] : Display the name of a common event with id x
@text.gsub!(/\\CE\[([0-9]+)\]/i) {
if $data_common_events[$1.to_i] != nil
$data_common_events[$1.to_i].name
else
"Invalid common event at ID: " + $1
end
}
# \R[x] : Display the name of an area with id x
@text.gsub!(/\\R\[([0-9]+)\]/i) {
if $data_areas[$1.to_i] != nil
$data_areas[$1.to_i].name
else
"Invalid area at ID: " + $1
end
}
end
end
oh neat thanks forum formatting
Wrong forum. Moved to Help.
Pages:
1














