Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Window_Skilldetail Script editing

Like the topic says, I need help editing a script.  I can do minor edits, but this ones a bit over my head. 

Basically, i've got this problem with the script.  The problem is with the elemental and occassionaly the status and ailment text display.  Like in this screenshot.

Unfortunatly, the sheer number of states is a VERY big part of the game (it uses turn-based combat, so i've gotta make it interesting somehow!), and theres -lots- of skills like the above that have multiple properties that will look like that.  Like the equivalent to the generic Esuna skills that remove about 6 ailments or so.

If its at all possible, would anyone be able to tweak the script so that it either so that it can -not- run all the states/properties off in one straight line like that, or some other way to fix this problem?  And if not, is there an updated version of this script somewhere that I can take for a test run?

If not, would it be "safe" to remove that part of the script?  I think its...lines 112-152

#==================================================================
#**Skill Detail
#  Meâ„¢
#  Version 0.9 - Meâ„¢
#  21-12-2005
#==================================================================

class Window_SkillDetail < Window_Base
 
  #-----------------------------------------
  #Begin Creates the window for usage.
  #-----------------------------------------
  def initialize
    super(0, 40, 640, 400)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $fontface = $defaultfonttype = "Arial"
    self.contents.font.size = $fontsize = $defaultfontsize = 20
    self.contents.font.color = normal_color
    # z acts as "layer order."
    self.z += 10
    @skilldetail = []
    # ------------------------------
    # @leadingcharacters is set for the script to delete X amount of
    # characters in each line of the .rxdata
    # In this case, the first 5 characters will be deleted in each line.
    # ------------------------------
    @leadingcharacters = 5
    # Clears and resets the window everytime it is requested by Scene_Item.
    refresh2   
  end
 
  def refresh2
    self.contents.font.name = $fontface = $defaultfonttype
    self.contents.font.size = $fontsize = $defaultfontsize
    self.contents.font.color = normal_color
    self.contents.clear
  end
 
  def refresh
    skill_id = $currenthighlightedskill.id
    # The three huge if-then statements check the current highlighted
    # item and its property, and executes the appropriate script
    # when it is true.
    # <-----------------------------------ITEM---------------------------->
      skill_icon = $data_skills[skill_id].icon_name
      getskill_scope = $data_skills[skill_id].scope
      # The Item Scope descriptions can be edited if needed.
      if getskill_scope == 0
        getskill_scope = "Nobody"
      end
      if getskill_scope == 1
        getskill_scope = "One Enemy"
      end
      if getskill_scope == 2
        getskill_scope = "All Enemies"
      end
      if getskill_scope == 3
        getskill_scope = "One Ally"
      end
      if getskill_scope == 4
        getskill_scope = "All Allies"
      end
      if getskill_scope == 5
        getskill_scope = "One Dead (hp = 0) Ally"
      end
      if getskill_scope == 6
        getskill_scope = "All Dead (hp = 0) Ally"
      end
      if getskill_scope == 7
        getskill_scope = "User of the Skill"
      end
      # </> #
      self.contents.font.color = system_color
      self.contents.draw_text(310 + 50, 44, 100, 24, "Type:", 2)
      self.contents.font.color = normal_color
      self.contents.draw_text(426 + 50, 44, 250, 24, getskill_scope, 0)
     
      getskill_occasion = $data_skills[skill_id].occasion
      if getskill_occasion == 0
        getskill_occasion = "Menu + Battle"
      end
      if getskill_occasion == 1
        getskill_occasion = "Only in Battle"
      end
      if getskill_occasion == 2
        getskill_occasion = "Only in Menu"
      end
      if getskill_occasion == 3
        getskill_occasion = "Not Useable"
      end
      self.contents.font.color = system_color
      self.contents.draw_text(310 + 50, 44 + 32, 100, 24, "Occasion:", 2)
      self.contents.font.color = normal_color
      self.contents.draw_text(426 + 50, 44 + 32, 250, 24, getskill_occasion, 0)
     
      # ---------------------------------------------------
      # Start inserting appropriate variables from database.
      # ---------------------------------------------------
      skill_spc   = $data_skills[skill_id].sp_cost.to_s
      skill_atk   = $data_skills[skill_id].atk_f.to_s
      skill_eva   = $data_skills[skill_id].eva_f.to_s
      skill_pwr   = $data_skills[skill_id].power.to_s
      skill_str   = $data_skills[skill_id].str_f.to_s
      skill_dex   = $data_skills[skill_id].dex_f.to_s
      skill_agi   = $data_skills[skill_id].agi_f.to_s
      skill_int   = $data_skills[skill_id].int_f.to_s
      skill_acc   = $data_skills[skill_id].hit.to_s   
      skill_pdf   = $data_skills[skill_id].pdef_f.to_s
      skill_mdf   = $data_skills[skill_id].mdef_f.to_s
      skill_var   = $data_skills[skill_id].variance.to_s
           
      # Sets Elemental and Status attributes of weapon string along with
      # suffix slashes when there are two or more attributes.
      skill_element = ""
      flag = false
      for i in $data_skills[skill_id].element_set
        if flag
          skill_element += "/"
        end
        skill_element += $data_system.elements
        flag = true
      end
      # Checks whether item_element is blank. If it is, then sets it
      # to "None".
      if skill_element == ""
        skill_element = "None"
      end
      skill_status = ""
      flag = false
      for i in $data_skills[skill_id].plus_state_set
        if flag
          skill_status += "/"
        end
        skill_status += $data_states.name
        flag = true
      end
      if skill_status == ""
        skill_status = "None"
      end
     
      skill_minstatus = ""
      flag = false
      for i in $data_skills[skill_id].minus_state_set
        if flag
          skill_minstatus += "/"
        end
        skill_minstatus += $data_states.name
        flag = true
      end
      if skill_minstatus == ""
        skill_minstatus = "None"
      end
      # ------------------------------
      # Start drawing attribute names.
      # ------------------------------
      # x and y can be changed to easily affect other attributes.
      x = 33
      y = 66
      self.contents.font.color = system_color
      self.contents.font.size = $fontsize - 4
      self.contents.font.color = Color.new(255, 255, 0, 255)
      self.contents.draw_text(x, y, 256, 24, $data_system.words.atk)
      self.contents.draw_text(x, y - 14, 256, 24, $data_system.words.sp + " Costs")
      self.contents.font.color = system_color
      self.contents.draw_text(x, y + 28, 256, 24, $data_system.words.str)
      self.contents.draw_text(x, y + 42, 256, 24, $data_system.words.dex)
      self.contents.draw_text(x, y + 56, 256, 24, $data_system.words.agi)
      self.contents.draw_text(x, y + 70, 256, 24, $data_system.words.int)
      self.contents.font.color = Color.new(255, 255, 255, 128)
      if $data_skills[skill_id].power >= 0
      self.contents.draw_text(x + 170 + 200, y + 56, 256, 24, "Power")
      else if $data_skills[skill_id].power <= 0
      self.contents.draw_text(x + 170 + 200, y + 56, 256, 24, "Heal Pwr")
      end
      end
      self.contents.draw_text(x + 170 + 200, y + 70, 256, 24, "Accuracy")
      self.contents.draw_text(x + 170 + 200, y + 84, 256, 24, "Variance")
      self.contents.font.color = system_color
      self.contents.draw_text(x, y + 84, 256, 24, $data_system.words.pdef)
      self.contents.draw_text(x, y + 98, 256, 24, $data_system.words.mdef)
      self.contents.draw_text(x + 170, y, 256, 24, "Elemental Attack:")
      self.contents.draw_text(x + 170, y + 32, 256, 24, "Status Attack:")
      self.contents.draw_text(x + 170, y + 32 + 32, 256, 24, "Status Removal:")
      # ------------------------------
      # Start drawing attribute values.
      # ------------------------------
      self.contents.font.color = normal_color
      self.contents.draw_text(x + 74, y, 64, 24, skill_atk, 2)
      self.contents.draw_text(x + 74, y - 14, 64, 24, skill_spc, 2)
      self.contents.draw_text(x + 74, y + 28, 64, 24, skill_str, 2)
      self.contents.draw_text(x + 74, y + 42, 64, 24, skill_dex, 2)
      self.contents.draw_text(x + 74, y + 56, 64, 24, skill_agi, 2)
      self.contents.draw_text(x + 74, y + 70, 64, 24, skill_int, 2)
      if $data_skills[skill_id].power >= 0
      self.contents.draw_text(x + 74 + 170 + 200, y + 56, 64, 24, skill_pwr, 2)
      else if $data_skills[skill_id].power <= 0
      skill_pwr = $data_skills[skill_id].power * -1
      self.contents.font.color = Color.new(128, 255, 128, 255)
      self.contents.draw_text(x + 74 + 170 + 200, y + 56, 64, 24, skill_pwr.to_s, 2)
      self.contents.font.color = normal_color
      end
      end
      self.contents.draw_text(x + 74 + 170 + 200, y + 70, 64, 24, skill_acc, 2)
      self.contents.draw_text(x + 74 + 170 + 200, y + 84, 64, 24, skill_var, 2)
      self.contents.draw_text(x + 74, y + 84, 64, 24, skill_pdf, 2)
      self.contents.draw_text(x + 74, y + 98, 64, 24, skill_mdf, 2)
      self.contents.draw_text(x + 170, y + 14, 420, 24, "   " + skill_element, 0)
      self.contents.font.color = Color.new(255, 128, 128, 255)
      self.contents.draw_text(x + 170, y + 14 + 32, 420, 24, "   " + skill_status, 0)
      self.contents.font.color = Color.new(128, 255, 128, 255)
      self.contents.draw_text(x + 170, y + 14 + 64, 420, 24, "   " +       skill_minstatus, 0)
      self.contents.font.color = normal_color
      # Resets font size.
      self.contents.font.size = $fontsize 
    # <-------------------------------------------------------------------->
   
    # Stores skill's icon graphic.
    skill = $currenthighlightedskill
    bitmap = RPG::Cache.icon(skill.icon_name)
    # Draws item's icon.
    self.contents.blt(5, 8, bitmap, Rect.new(0, 0, 24, 24), 255)
    self.contents.font.color = normal_color
    skill_name = $data_skills[skill_id].name
    self.contents.draw_text(33, 8, 256, 24, skill_name)
    self.contents.font.color = normal_color
    # Two lines below calls the two definitions to write the skill's
    # detailed description.
    get_skill_detail(skill_id)
    write_skill_detail(5, 223)
  end
 
  def get_skill_detail(skill_id)
    # descarray stores the line numbers needed to call the right
    # detail description into an array.
    descarray =
    [
    skill_id * 7,
    skill_id * 7 + 1,
    skill_id * 7 + 2,
    skill_id * 7 + 3,
    skill_id * 7 + 4,
    skill_id * 7 + 5,
    skill_id * 7 + 6
    ]
    # The if-then statements below checks the highlighted item and use
    # the right .rxdata.
    if $currenthighlightedskill.is_a?(RPG::Skill)
      f = File.open("Data/Skill_Detail.rxdata")
    end
    # Stores _every_ line of the file into @itemdetail as an array.
    @skilldetail = f.readlines
    # Clears first seven lines for Lines 1-7 (0..6), as it will never be used.
    for i in 0..6
      @skilldetail = ""
    end
    # Crops the first 6 characters in each line.
    for i in 0..6
      cropheadcharacters(descarray)
    end
    # Stores the cropped lines into description array.
    @description = []
    for i in 0..6
      @description = @skilldetail[descarray]
    end
    return
  end
 
  def cropheadcharacters(descarray)
    # Checks to see if any lines are nil. If so, then sets them
    # as blank lines after cropping.
    if @skilldetail[descarray] == nil
      @skilldetail[descarray] = "123456 "
    end
    # Crops the first (@leadingcharacters) characters in each line.
    # Default: 5.
    @skilldetail[descarray].slice!(0..@leadingcharacters)
    return
  end
 
  def write_skill_detail(x, y)
    self.contents.font.color = system_color
    self.contents.draw_text(x, y - 20, 640, 32, "Description:")
    self.contents.font.color = normal_color
    self.contents.font.size = $fontsize - 2
    # Draws the first six lines in normal color.
    for i in 0..5
      self.contents.draw_text(x, y, 640, 32, @description)
      y += 18
    end
    # Draws the seventh line in another color.
    self.contents.font.color = Color.new(255, 255, 0, 255)
    self.contents.draw_text(x, y, 640, 32, @description[6])
  end 
end


Edit: while i'm at it, does anyone know who made this script/the link to it?  I've been trying to give add 'em into the credit/link list, but I can't seem to recall where I got this.
 
Ah, no problem.  Sorry it took me a bit to respond.  Feel free to take as long as you want. I'm in no hurry here. 

Ah, one thing I probably should throw out, just in case, the script gets the skill description (the paragraph or so towards the bottom) from a seperate file in the data folder...I think its called "Skill_detail.rxdata".  Just a heads up there.
 
Ah, no problem.  I'd be horribly surpised if there -wasn't- something going on in your life that was more important, really :P

I do have a question though; would it be a problem trying to organize everything in the script editor if i've got say....dunno. A -lot- of skills?  I set the list to about 900 in the database, and a good number of those are taken up by skills or their "upgraded" version.
 
It probably won't be any difficulties, as long as you organize your skill data in the database. You will be able to use loop patterns and such for defining your skill special data. But I will wait to show you how until I finish the system.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top