Go Back   The PokéCommunity Forums > Creative Discussions > Game Development > Pokémon Essentials
Reload this Page [Question] Changing color of individual menu items

Notices
For all updates, view the main page.

Pokémon Essentials All questions and discussion about Pokémon Essentials, the Pokémon game kit for RPG Maker XP, go in here. Also contains links to the latest downloads and the Essentials Wiki.



Reply
 
Thread Tools
  #1    
Old January 2nd, 2014 (06:53 PM).
SaltRoad's Avatar
SaltRoad SaltRoad is offline
 
Join Date: Jan 2014
Nature: Hasty
Posts: 79
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:

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


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.
Spoiler:
Click image for larger version

Name:	before switch.png
Views:	17
Size:	30.6 KB
ID:	70554
Click image for larger version

Name:	after switch.png
Views:	16
Size:	36.0 KB
ID:	70555


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
Reply With Quote
  #2    
Old January 5th, 2014 (12:43 AM).
SaltRoad's Avatar
SaltRoad SaltRoad is offline
 
Join Date: Jan 2014
Nature: Hasty
Posts: 79
So uh... impossible then?
__________________
Reply With Quote
  #3    
Old January 5th, 2014 (04:57 AM).
FL's Avatar
FL FL is offline
Pokémon Island Creator
 
Join Date: Sep 2010
Gender: Male
Posts: 1,409
I guess that this isn't possible with Window_CommandPokemon. I suggest you to draw the text with pbDrawTextPositions and manually code a cursor.
__________________
Reply With Quote
  #4    
Old January 5th, 2014 (05:14 AM).
Maruno's Avatar
Maruno Maruno is online now
Lead Dev of Pokémon Essentials
Moderator
 
Join Date: Jan 2008
Location: England
Posts: 4,072
It would be possible if you changed how Window_CommandPokemon worked. I couldn't tell you what to do, though.
__________________
Reply With Quote
  #5    
Old January 5th, 2014 (05:30 AM).
FL's Avatar
FL FL is offline
Pokémon Island Creator
 
Join Date: Sep 2010
Gender: Male
Posts: 1,409
Quote originally posted by Maruno:
It would be possible if you changed how Window_CommandPokemon worked. I couldn't tell you what to do, though.
You can set a new flag in Window_CommandPokemon initialize arguments (or just a method call to "activates" this feature) and, when this flag is on, you can change the pbDrawShadowText call at drawItem with other logic to define the colors. I suggest you to extends Window_CommandPokemon class rather than do this. I think that my other solution is better.
__________________
Reply With Quote
  #6    
Old January 5th, 2014 (03:04 PM).
SaltRoad's Avatar
SaltRoad SaltRoad is offline
 
Join Date: Jan 2014
Nature: Hasty
Posts: 79
Thanks for the advice! I have a direction to go in now.
Reply With Quote
Reply
Quick Reply

Sponsored Links
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are UTC -8. The time now is 09:35 AM.