- 223
- Posts
- 10
- Years
- Seen Sep 24, 2020
I'm not sure this is even possible, but hopefully it is.
I'm trying to implement an achievement system, so that when you get the achievement the color of the achievement title changes. So you'll have a list of achievements, and the ones that you've got will be red, but the ones you don't have will be black.
I know how to change the color of EVERY entry, which is something like:
So, if that switch is on, which also turns the achievement on, then the color changes to red. But I have no idea how to make it so that ONLY that achievement turns red, and not the entire list.
These are the images, to make it clearer what's going wrong.
Here's the entire script, in case it's necessary. I've been adapting the Pokegear Jukebox script, so some of it is still obviously from there.
I'm trying to implement an achievement system, so that when you get the achievement the color of the achievement title changes. So you'll have a list of achievements, and the ones that you've got will be red, but the ones you don't have will be black.
I know how to change the color of EVERY entry, which is something like:
Spoiler:
@sprites["command_window"] = Window_CommandPokemon.new(@choices,324)
if $game_switches[34]
@sprites["command_window"].baseColor=Color.new(255,0,0)
else @sprites["command_window"].baseColor=Color.new(0,0,0)
end
if $game_switches[34]
@sprites["command_window"].baseColor=Color.new(255,0,0)
else @sprites["command_window"].baseColor=Color.new(0,0,0)
end
So, if that switch is on, which also turns the achievement on, then the color changes to red. But I have no idea how to make it so that ONLY that achievement turns red, and not the entire list.
These are the images, to make it clearer what's going wrong.
Here's the entire script, in case it's necessary. I've been adapting the Pokegear Jukebox script, so some of it is still obviously from there.
Spoiler:
class Scene_Achievements
def initialize(menu_index = 0)
@menu_index = menu_index
end
def main
# Make song command window
fadein = true
# Makes the text window
@sprites={}
@viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
@viewport.z=99999
@sprites["background"] = IconSprite.new(0,0)
@sprites["background"].setBitmap("Graphics/Pictures/achievementsbg")
@sprites["background"].z=255
@choices=[
_INTL("Sweet Outfit"),
_INTL("A Fighting Chance"),
_INTL("World's Best Thief"),
_INTL("Worst Starter Ever"),
_INTL("Working Overtime"),
_INTL("Exit")
]
@sprites["header"]=Window_UnformattedTextPokemon.newWithSize(_INTL(""),
2,-18,128,64,@viewport)
@sprites["header"].baseColor=Color.new(248,248,248)
@sprites["header"].shadowColor=Color.new(0,0,0)
@sprites["header"].windowskin=nil
@sprites["command_window"] = Window_CommandPokemon.new(@choices,324)
if $game_switches[34]
@sprites["command_window"].baseColor=Color.new(255,0,0)
else @sprites["command_window"].baseColor=Color.new(0,0,0)
end
@sprites["command_window"].windowskin=nil
@sprites["command_window"].index = @menu_index
@sprites["command_window"].height = 224
@sprites["command_window"].width = 324
@sprites["command_window"].x = 14
@sprites["command_window"].y = 25
@sprites["command_window"].z = 256
@custom=false
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepares for transition
Graphics.freeze
# Disposes the windows
pbDisposeSpriteHash(@sprites)
@viewport.dispose
end
#-----------------------------------------------------------------------------
# * Frame Update
#-----------------------------------------------------------------------------
def update
# Update windows
pbUpdateSpriteHash(@sprites)
if @custom
updateCustom
else
update_command
end
return
end
#-----------------------------------------------------------------------------
# * Frame Update (when command window is active)
#-----------------------------------------------------------------------------
def updateCustom
if Input.trigger?(Input::B)
@sprites["command_window"].commands=@choices
@sprites["command_window"].index=3
@custom=false
return
end
if Input.trigger?(Input::C)
$PokemonMap.whiteFluteUsed=false if $PokemonMap
$PokemonMap.blackFluteUsed=false if $PokemonMap
if @sprites["command_window"].index==0
$game_system.setDefaultBGM(nil)
else
$game_system.setDefaultBGM(
@sprites["command_window"].commands[@sprites["command_window"].index]
)
end
end
end
def update_command
# If B button was pressed
if Input.trigger?(Input::B)
pbPlayCancelSE()
# Switch to map screen
$scene = Scene_Pokegear.new
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Branch by command window cursor position
case @sprites["command_window"].index
when 0
pbPlayDecisionSE()
if $game_switches[34]
Kernel.pbMessage(_INTL("Joined TEAM ROCKET."))
else Kernel.pbMessage(_INTL("???"))
end
when 1
pbPlayDecisionSE()
if $Trainer.party.length>=6
Kernel.pbMessage(_INTL("Managed to possess a full party of Pokemon."))
else Kernel.pbMessage(_INTL("???"))
end
when 2
pbPlayDecisionSE()
pbBGMPlay("Radio - Oak", 100, 100)
$PokemonMap.whiteFluteUsed=false if $PokemonMap
$PokemonMap.blackFluteUsed=false if $PokemonMap
when 3
pbPlayDecisionSE()
when 4
pbPlayDecisionSE()
$scene = Scene_Pokegear.new
when 5
pbPlayDecisionSE()
end
return
end
end
end
def initialize(menu_index = 0)
@menu_index = menu_index
end
def main
# Make song command window
fadein = true
# Makes the text window
@sprites={}
@viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
@viewport.z=99999
@sprites["background"] = IconSprite.new(0,0)
@sprites["background"].setBitmap("Graphics/Pictures/achievementsbg")
@sprites["background"].z=255
@choices=[
_INTL("Sweet Outfit"),
_INTL("A Fighting Chance"),
_INTL("World's Best Thief"),
_INTL("Worst Starter Ever"),
_INTL("Working Overtime"),
_INTL("Exit")
]
@sprites["header"]=Window_UnformattedTextPokemon.newWithSize(_INTL(""),
2,-18,128,64,@viewport)
@sprites["header"].baseColor=Color.new(248,248,248)
@sprites["header"].shadowColor=Color.new(0,0,0)
@sprites["header"].windowskin=nil
@sprites["command_window"] = Window_CommandPokemon.new(@choices,324)
if $game_switches[34]
@sprites["command_window"].baseColor=Color.new(255,0,0)
else @sprites["command_window"].baseColor=Color.new(0,0,0)
end
@sprites["command_window"].windowskin=nil
@sprites["command_window"].index = @menu_index
@sprites["command_window"].height = 224
@sprites["command_window"].width = 324
@sprites["command_window"].x = 14
@sprites["command_window"].y = 25
@sprites["command_window"].z = 256
@custom=false
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepares for transition
Graphics.freeze
# Disposes the windows
pbDisposeSpriteHash(@sprites)
@viewport.dispose
end
#-----------------------------------------------------------------------------
# * Frame Update
#-----------------------------------------------------------------------------
def update
# Update windows
pbUpdateSpriteHash(@sprites)
if @custom
updateCustom
else
update_command
end
return
end
#-----------------------------------------------------------------------------
# * Frame Update (when command window is active)
#-----------------------------------------------------------------------------
def updateCustom
if Input.trigger?(Input::B)
@sprites["command_window"].commands=@choices
@sprites["command_window"].index=3
@custom=false
return
end
if Input.trigger?(Input::C)
$PokemonMap.whiteFluteUsed=false if $PokemonMap
$PokemonMap.blackFluteUsed=false if $PokemonMap
if @sprites["command_window"].index==0
$game_system.setDefaultBGM(nil)
else
$game_system.setDefaultBGM(
@sprites["command_window"].commands[@sprites["command_window"].index]
)
end
end
end
def update_command
# If B button was pressed
if Input.trigger?(Input::B)
pbPlayCancelSE()
# Switch to map screen
$scene = Scene_Pokegear.new
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Branch by command window cursor position
case @sprites["command_window"].index
when 0
pbPlayDecisionSE()
if $game_switches[34]
Kernel.pbMessage(_INTL("Joined TEAM ROCKET."))
else Kernel.pbMessage(_INTL("???"))
end
when 1
pbPlayDecisionSE()
if $Trainer.party.length>=6
Kernel.pbMessage(_INTL("Managed to possess a full party of Pokemon."))
else Kernel.pbMessage(_INTL("???"))
end
when 2
pbPlayDecisionSE()
pbBGMPlay("Radio - Oak", 100, 100)
$PokemonMap.whiteFluteUsed=false if $PokemonMap
$PokemonMap.blackFluteUsed=false if $PokemonMap
when 3
pbPlayDecisionSE()
when 4
pbPlayDecisionSE()
$scene = Scene_Pokegear.new
when 5
pbPlayDecisionSE()
end
return
end
end
end