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.

Draw System Help

I am recreating the Draw System from FFVIII, and I figure that the best way to tell the scripts which magic is able to be drawn from an enemy is through the enemy's name itself, (i.e., a "Bite Bug" with "Holy" and "Water" magic would look something like "Bite Bug [Holy, Water]").

However, I have no idea how to do this. I had noticed something similar in the Dynamic Enemies script, drawing from the enemy's name, but it has since been updated. Any help on how to do this would be greatly appreciated.
 
Make a hash in Game_Temp or something instead, using the enemy ids or names. For example:
Code:
class Game_Temp
  attr_accessor :draw_hash
  alias old_init initialize
  def initialize
    old_init
    @draw_hash = {
      enemy_id => [skill1, skill2, skill3, skill4], enemy_id => [skill1, skill2],
      enemy_id => [] # etc...
    }
  end
end
 
and this would allow me to manually link magic w/ enemy_id?

the above example would be... (if "Bite Bug" is enemy_id = 3)

enemy_id(3) => [Holy, Water]

right?

and I would attr_accessor :draw_hash in Scene_Draw, right?

so that

draw_hash[enemy_id(3)] produces [Holy, Water], right?
 
I apologize for my incompetence, but how would I display [Holy, Water] as part of a selection menu? something akin to how Items are displayed? (that means, using that method as a template of sorts?)

(does this make this a Script Request now lol?)
 
sorry for the double post, but would this be correct?
Code:
class Game_Temp
  attr_accessor :draw_array
  def initialize
    @draw_array = {
      1 => [skill1, skill2, skill3, skill4], 
      2 => [skill1, skill2],
      3 => [skill1, skill2, skill3]
     #n => [skilln] 	
    }
  end
end



class Window_Draw < Window_Selectable

attr_accessor :draw_array
  def initialize
    super(0, 64, 640, 416)
    @column_max = 1
    refresh
    self.index = 0

    if $game_temp.in_battle
      self.y = 64
      self.height = 256
      self.back_opacity = 160
    end
  end

  def magic
    return @draw_array[Enemy_Arrow.enemy.id]
  end

  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @magic = []

    for i in 1...magic.size
        @magic.push(magic[i])

    @item_max = @magic.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      self.contents.font.name = $fontface
      self.contents.font.size = $fontsize
      for i in 0...@item_max
        draw_magic(i)
      end
    end
  end
  def draw_magic(index)
    magic = @magic[index]
    x = 4 + index % 2 * (288 + 32)
    y = index / 2 * 32
    rect = Rect.new(x, y, self.width / @column_max - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    self.contents.draw_text(x + 28, y, 212, 32, magic, 0)
  end
end
 

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