Jump to content

How do I recolor more than one unit in FEXP?


LordPudding
 Share

Recommended Posts

I'm completely new in working with FEXP, and while I've been doing fine in the most part, I have run into a problem that I haven't figured out the solution to yet. I haven't managed to create multiple recolored actor units. I managed to edit the first one, just by editing the original script that recolored a 'Soldier' unit, but then I didn't know what to do for the next one.  I tried copying the whole script and pasting a copy of it below the original, and then editing its properties, but that removed the modified colors of the original unit I edited.

Spoiler

module Recolor_List
  def self.has_key?(key, name = nil)
    if name.nil?
      return self.get_color(key, nil, 0, true).length != 0
    else
      result = self.get_color(key, name, 0)
      return result.nil? ? false : result.length != 0
    end
  end
  
  def self.get_color(key, name, color, key_test = false)
    name = SPRITE_RENAME_LIST[name] if SPRITE_RENAME_LIST.has_key?(name)
    key_found = true
    case key
    when 23 # Dracoknight
      case name
      when 'Ryan'
        case color
        when 0; return [160, 0, 0] # Secondary Dragon
        when 1; return [150, 0, 0] # More Dragon?
        when 2; return [196, 5, 24] # Dragon
        when 3; return [200, 50, 50] # DRAGON
        when 4; return [121, 0, 0]
        when 5; return [121, 121, 121] # Armor
        end
      else
        unless COUNTRY_COLORS[name].nil?
          case color
          when 0; return COUNTRY_COLORS[name][:main1]
          when 1; return COUNTRY_COLORS[name][:main3]
          when 2; return COUNTRY_COLORS[name][:main4]
          when 3; return COUNTRY_COLORS[name][:scnd1]
          when 4; return COUNTRY_COLORS[name][:scnd2]
          when 5; return COUNTRY_COLORS[name][:scnd3]
          end
        end
      end
    else
      key_found = false
    end
    return [0,0,0] if key_test and key_found
    return []
  end
end

module Recolor_List
  def self.has_key?(key, name = nil)
    if name.nil?
      return self.get_color(key, nil, 0, true).length != 0
    else
      result = self.get_color(key, name, 0)
      return result.nil? ? false : result.length != 0
    end
  end
  
  def self.get_color(key, name, color, key_test = false)
    name = SPRITE_RENAME_LIST[name] if SPRITE_RENAME_LIST.has_key?(name)
    key_found = true
    case key
    when 19 # Archer
      case name
      when 'Max'
        case color
        when 0; return [183, 160, 48] # Cloak
        when 1; return [183, 126, 34]
        when 2; return [255, 175, 48]
        when 3; return [255, 175, 48] # Shirt
        when 4; return [146, 42, 221]
        when 5; return [185, 98, 229]
        when 6; return [120, 120, 120] # Pants
        when 7; return [255, 200, 0]
        when 8; return [255, 255, 0] # Hair
        when 9; return [200, 200, 30]
        end
      else
        unless COUNTRY_COLORS[name].nil?
          case color
          when 0; return COUNTRY_COLORS[name][:main1]
          when 1; return COUNTRY_COLORS[name][:main3]
          when 2; return COUNTRY_COLORS[name][:main4]
          when 3; return COUNTRY_COLORS[name][:scnd1]
          when 4; return COUNTRY_COLORS[name][:scnd2]
          when 5; return COUNTRY_COLORS[name][:scnd3]
          end
        end
      end
    else
      key_found = false
    end
    return [0,0,0] if key_test and key_found
    return []
  end
end

(Spoiler for the script.)

I've tried also only copying specific parts, but that gives me a syntax error. What should I have been doing?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...