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.

[Resolved] Different $game_variables based on which actor

I'm having some trouble figuring this out, and I know it's a fairly simple solution, I just can't get it.
[rgss]  def draw_actor_parameter(actor, x, y, type)
    case type
    when 0
      parameter_name = Vocab::atk
      parameter_value = actor.atk
    when 1
      parameter_name = Vocab::def
      parameter_value = actor.def
    when 2
      parameter_name = Vocab::spi
      parameter_value = actor.spi
    when 3
      parameter_name = Vocab::agi
      parameter_value = actor.agi
    when 4
      parameter_name = "SP"
      if actor == 1 then
        parameter_value = $game_variables[3]
      elsif actor == 4 then
        parameter_value = $game_variables[4]
      elsif actor == 3 then
        parameter_value = $game_variables[5]
      elsif actor == 2 then
        parameter_value = $game_variables[9]
      end
    end
    self.contents.font.color = system_color
    self.contents.draw_text(x, y, 120, WLH, parameter_name)
    self.contents.font.color = normal_color
    self.contents.draw_text(x + 120, y, 36, WLH, parameter_value, 2)
  end
[/rgss]
More specifically,
[rgss] 
    when 4
      parameter_name = "SP"
      if actor == 1 then
        parameter_value = $game_variables[3]
      elsif actor == 4 then
        parameter_value = $game_variables[4]
      elsif actor == 3 then
        parameter_value = $game_variables[5]
      elsif actor == 2 then
        parameter_value = $game_variables[9]
      end
[/rgss]
Currently, it displays nothing, not 0, just a space. How can I make it so it will show the different variable based on which actor it is used for?
(I'm adding SP to the Status menu)

Thanks in advance

Edit: Figured it out. Did it by confirming actor.name. Case closed.
 

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