Color coding the Elements and States?

Started by AresWarrior, March 25, 2010, 06:50:58 pm

Previous topic - Next topic

AresWarrior

 okay so in my game, I display the elements of the characters on the status screen. I was just wondering if there was a script that can let me color code each element to a different color. like:

Fire
Water

etc. etc. I think it has something to do with this:

case blahblahblah
when 1 then return self.contents.font.color = Color.new(255, 0, 0, 255)
when 2 then return self.contents.font.color = Color.new(0, 0, 255, 255)
end

I don't know what the exact script is but If anyone can help, then thanks.  ;)

EDIT: Oh yeah, and for States too. Like this:

Poison
Paralyzed

Jackolas

March 25, 2010, 07:11:26 pm #1 Last Edit: March 25, 2010, 07:16:11 pm by Jackolas
this is a simple edit..
can do it for you

but personal I think it would look nicer if you use icons instead of words
looks cleaner and more organised

AresWarrior

please tell me how to do it with icons  :uhm:

Jackolas

March 26, 2010, 10:24:02 am #3 Last Edit: March 26, 2010, 10:27:36 am by Jackolas
Spoiler: ShowHide

ICON_SIZE = 32

class Window_Base < Window
 def draw_actor_state(actor, x, y, width = 120)
   # make state icon array
   icons = []
   w = 0
   
   for i in actor.states
     if $data_states[i].rating >= 1
       w += 32
       if (w > width)
         break
       else
         indez = $data_states[i].name #extra
         #icons.push(RPG::Cache.icon($data_states[i].name))
         icons.push(RPG::Cache.icon("Status/#{indez}")) #extra
       end
     end
   end
   
   rect = Rect.new(0, 0, ICON_SIZE, ICON_SIZE)
   for icon in icons
     self.contents.blt(x, y, icon, rect)
     x += ICON_SIZE
   end
 end
end


and than add the icons to "Graphics\Icons\Status\"
remember to add an icon for every state or it will bug
and make sure you name the icons the same as the state

AresWarrior

thanks. and do you know how to change the text color for each element/state? i may or may not use icons depending on how it looks in the game.

AresWarrior

March 26, 2010, 03:56:09 pm #5 Last Edit: March 26, 2010, 05:37:36 pm by AresWarrior
nevermind! i think i figured it out! well thanks for the icons script. i think i'll use that for the states, and the different text colors for the elements.

This is the script I figured out:
class Window_Base < Window
  #--------------------------------------------------------------------------
  # * Draw State
  #     actor : actor
  #     x     : draw spot x-coordinate
  #     y     : draw spot y-coordinate
  #     width : draw spot width
  #--------------------------------------------------------------------------
  def draw_actor_state(actor, x, y, width = 140)
    text = make_battler_state_text(actor, width, true)
    for i in actor.states
        if $data_states[i].id == 4
          self.contents.font.color = Color.new(0,0,255,255)
        elsif $data_states[i].id == 3
          self.contents.font.color = Color.new(255,0,0,255)
        end
    end
    self.contents.draw_text(x, y, width, 32, text, 1)
  end
 
end


^^ "$data_states.id == (insert state id here). then the color can be changed to whatever.  :D

EDIT: just figured out how to do this with Blizzard's Bestiary script when it displays the elements.

  def draw_elements(enemy, x, index)
    elements = []
    (1...$data_system.elements.size).each {|id|
        if !$DUMMY_ELEMENTS.include?(id) &&
            index == $data_enemies[@enemies[@index_enemy].id].element_ranks[id]
          elements.push($data_system.elements[id])
        end}
    elements = ['Normal'] if elements.size == 0
        if elements == ['Darkness']
          self.contents.font.color = Color.new(255,0,0,255)
        elsif elements == ['Wind']
          self.contents.font.color = Color.new(0,0,255,255)
        else
          self.contents.font.color = normal_color
        end
    elements.each_index {|i|
        self.contents.font.size = 18
        self.contents.draw_text(x, 0 + i * 32, 200, 32, elements[i])}
  end

^^ Where it says if elements == ['Darkness'], darkness is replaced by any element. and the color is changed where it says Color.new.

Jackolas

Quote^^ "$data_states.id == (insert state id here). then the color can be changed to whatever.  :D


you tried that out if you have multiple states?
it will all make them the same color

AresWarrior

March 27, 2010, 05:04:00 pm #7 Last Edit: March 28, 2010, 11:44:03 am by AresWarrior
hmm i never thought a character would have multiple states.  :O.o:

im not sure how to make it different colors for each state