[Resolved]Custom Magic Menu Help

Started by ZombieBear, March 05, 2012, 01:54:12 am

Previous topic - Next topic

ZombieBear

March 05, 2012, 01:54:12 am Last Edit: March 17, 2012, 12:31:08 am by ZombieBear
Hello,

I am trying to make a magic menu similar to classic Final Fantasy games (where it branches for White Magic, Black Magic, etc). I have the command window set up to summon the appropriate skill window based on actor id, but this won't work if I add a character with both types of magic, as you can see in the picture below. Any ideas on how to limit the skills that are pushed into the skill window? I tried modifying the Blizz skill separation script as well as the Individual Battle Commands script included with the Enu sideview battle system to do this, but that turned out... badly.

(I am using RMXP and the Enu sideview battle system version 2.1.)

Spoiler: ShowHide
 
Yeah, that fire skill really shouldn't be there...



Any help would be appreciated, thanks!

Zexion

If i'm right then you are just setting one character's skills to learn only white skills, and another to learn black. So when you show the skills of course, it only shows the skills they know which are black or white. You have to find some way to filter them probably using an element in the database. If there element is white, then it shows in the white menu, and same for black. I don't know how to script, so I wouldn't really know how to do it.

on another note google up: charlie feed ctb battle system for rmxp. It's a final fantasy style battle system with black 'arts' and white arts.

Blizzard

You have the Skill Separation System in Tons for that. It will do most of the work for you. You only might have to adjust/edit some code in your CBS to make everything work together.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

ZombieBear

I managed to get Skills Separation working, but I'm having trouble getting the results to filter to the different command window options. The skills do filter properly in the skills window though, like so:

Spoiler: ShowHide


Is there a way to filter them, maybe with a switch statement? I have my menu set up with a switch statement in Scene_Skill (obviously), and it's set up to disable the command window options by actor id. It's not really the best solution so I'd prefer to do it with the dummy elements instead, if I can ever figure out how to filter them *sigh*.

Maybe it would be easier to have each case bring up a different skill screen that will only show the appropriate skills?. Perhaps similar to this:

'White' = [1, 2, 3, 4, 5, 6]
and then... something. I'll figure it out.

Anyway, thanks for the help so far. Battles aren't really too important right now, but it would be nice to have it done and over with. I still have to focus on cutscenes and some more maps so I actually have a chunk of game. :P

Blizzard

You will need to customize Window_Skill for that. Best you comment out the one in the SSS script so the default one is used. Though, you will need add some additional code for that.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

ZombieBear

I finally figured it out, yay! I used the method from the Individual Battle Commands script by Atoa. Still don't know how to do this using elements, but someday I'll be a bit better at code and I'll figure it out :P

Anyway, here's how the script turned out:

Spoiler: ShowHide

#Skill ID's of "White magic" spells
Skill_Type = [1, 2, 3, 4, 5, 6, 43, 54, 55, 56]

#==============================================================================
# ** Window_Skill
#------------------------------------------------------------------------------
#  This window displays usable skills on the skill and battle screens.
#==============================================================================

class Window_Skill < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     actor : actor
  #--------------------------------------------------------------------------
  def initialize(actor, skill_command_type = [])
    super(0, 224, 640, 256)
    @actor = actor
    @skill_command_type = skill_command_type
    @column_max = 2
    refresh
    self.index = 0
    # If in battle, move window to center of screen
    # and make it semi-transparent
    if $game_temp.in_battle
      self.y = 64
      self.height = 256
      self.back_opacity = 255
    end
  end
  #--------------------------------------------------------------------------
  # * Acquiring Skill
  #--------------------------------------------------------------------------
  def skill
    return @data[self.index]
#    return $data_skills[id]
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    for i in 0...@actor.skills.size
      skill = $data_skills[@actor.skills[i]]
      if skill != nil and skill_in_command?(skill)
         @data << skill
      end
     end
    # If item count is not 0, make a bit map and draw all items
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      for i in 0...@item_max
       draw_item(i)
      end
    end
  end
  #-------------------------------------------------------------------------
  def skill_in_command?(skill)
    if Skill_Type != nil and
       Skill_Type.include?(skill.id)
      return true
    end
    return false
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #--------------------------------------------------------------------------
  def draw_item(index)
    skill = @data[index]
#    skill = $data_skills[id]
    if @actor.skill_can_use?(skill.id)
      self.contents.font.color = normal_color
    else
      self.contents.font.color = disabled_color
    end
    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))
    bitmap = RPG::Cache.icon(skill.icon_name)
    opacity = self.contents.font.color == normal_color ? 255 : 128
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
    self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
    self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
  end
  #--------------------------------------------------------------------------
  # * Help Text Update
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_text(self.skill == nil ? "" : self.skill.description)
  end
end
 


Pretty simple actually... can't believe it took me so long to figure out!  I still have some work to do on the switch statements and making the other skill windows so everything meshes, but that's not too bad. Thanks for pointing me in the right direction; everyone here has been very helpful.