FFVIII Triple Triad Card Menu

0 Members and 1 Guest are viewing this topic.

**
Rep:
Level 83
プログラマです
FFVIII Triple Triad Card Menu
Version: 1.0
Author: SeMcDun
Date: 22.08.2011

Version History


  • <Version 1.0> 2011.08.22 - Original Release

Planned Future Versions

  • <Version 2.0> Make the script more user friendly. More customisation.
  • <Version 3.0> Change from just the Card Menu to the complete Triple Triad script with battles etc.

Description


My first script :) The FFVIII Triple Triad Card Menu gives a game creator the option to use a scene which records how many cards the player has obtained during their journey. These cards can be obtained and lost at the game creator's will.

Please note, the script isn't very user friendly at the moment so customising it might be hard for those who don't know basic scripting. I do plan, in Version 2.0 (stated above), to make the script easier to use so even those with minimal knowledge of scripting can do the cool stuff they want with this :) .

Features

  • Neat menu for viewing collected cards
  • The quantity of each card is recorded
  • Different scenes for obtaining and losing cards
  • Different windows for different levels of card
  • Counters tally up total cards and types of card owned

Screenshots



Instructions

I think everything you need is inside the script near the top. If I missed anything out or there's something you don't understand, feel free to post. I'll do my best to reply and edit if needed :)

Script


Code: [Select]
#=begin

#===============================================================================
# FFVIII Triple Triad Card Menu
# v1.0
# By SeMcDun
# Started: 10/08/2011
# Last Update: 22/08/2011
#===============================================================================
# Remake of Final Fantasy VIII's Triple Triad Card Menu.
# Credit would be nice if used.
#
# Ps. This cannot be used in commercial games.
#===============================================================================
# Version History;
#-------------------------------------------------------------------------------
# v1.0
#-- Card Viewer Scene
#-- Obtaining cards
#-- Losing cards
#===============================================================================
# HOW TO USE:
#-------------------------------------------------------------------------------
# Card Viewer Scene
#-- This scene is called using $scene = Scene_Card_Viewer.new
#
# Obtain A New Card
#-- Set Game Variable 0001 to the number of card you wish to obtain.
#-- Call the Obtain Card scene using $scene = Scene_Obtained_Card.new
#
#-- Alternatively, you may use the "Script" event;
#-- Set Game Variable 0001 to the number of card you wish to obtain.
#-- Enter   $game_party.card_list[$game_variables[1]] += y
#   y = quantity of cards you wish to give the player
#
# Losing A Card
#-- Set Game Variable 0001 to the number of card you wish to lose.
#-- Call the Lose Card scene using $scene = Scene_Lose_Card.new
#
#-- Alternatively, you may use the "Script" event;
#-- Set Game Variable 0001 to the number of card you wish to lose.
#-- Enter   $game_party.card_list[$game_variables[1]] -= y
#   y = quantity of cards you wish to remove from the player
#
#   NOTE: Any time you are removing cards from the player, it is probably best
#         to check how many cards they have left incase you reduce the number
#         past 0 into the negatives.
#
# Changing Values
#-- Locate the $Cards[x] = [a, b, c, d, e, f, g, h, i] arrays.
#   x = index of the card
#   a = index (not really sure why I put this in here...)
#   b = Name of the card. This is also the name of the picture displayed.
#   c = Top Value
#   d = Right Value
#   e = Bottom Value
#   f = Left Value
#   g = Card Level
#   h = Attribute (Ice, Fire etc.)
#   i = Location. Where you find the card.
#===============================================================================
# Conditional Branch Options
#-- Using conditional branches opens up new options for the game creator.
#-- Create an event. On page 1 select "Conditional Branch". Select "Script" and
#   input the below;-   
#
# -- If the player has card with index of x

#    $game_party.card_list[x] != 0
#
# -- If the player has y amount of cards with the index of x
#
#   $game_party.card_list[x] == y
#
#===============================================================================
# Card_Details - Arrays with all the details
module Card_Details
  attr_reader :Cards
# @cards = [[ ID, NAME, UP, RIGHT, DOWN, LEFT, LEVEL, ATTRIBUTE, LOCATION],[],[]]
  $Cards = [[]]
  # LEVEL IS MEASURED ONE LESS THAN ACTUAL LEVEL
  # Level One Monster Cards
  $Cards[0] = [0,"Geezard",1,4,1,5,0,"N/A","Geezard"]
  $Cards[1] = [1,"Funguar",5,1,1,3,0,"N/A","Funguar"]
  $Cards[2] = [2,"Bite Bug",1,3,3,5,0,"N/A","Bite Bug"]
  $Cards[3] = [3,"Red Bat",6,1,1,2,0,"N/A","Red Bat"]
  $Cards[4] = [4,"Blobra",2,3,1,5,0,"N/A","Blobra"]
  $Cards[5] = [5,"Gayla",2,1,4,4,0,"Lightning","Gayla"]
  $Cards[6] = [6,"Gesper",1,5,4,1,0,"N/A","Gesper"]
  $Cards[7] = [7,"Fastitocalon-F",3,5,2,1,0,"Earth","Fastitocalon-F"]
  $Cards[8] = [8,"Blood Soul",2,1,6,1,0,"N/A","Blood Soul"]
  $Cards[9] = [9,"Caterchipillar",4,2,4,3,0,"N/A","Caterchipillar"]
  $Cards[10] = [10,"Cockatrice",2,1,2,6,0,"Lightning","Cockatrice"]
 
  # Level Two Monster Cards
  $Cards[11] = [11,"Grat",7,1,3,1,1,"N/A","Grat"]
  $Cards[12] = [12,"Buel",6,2,2,3,1,"N/A","Buel"]
  $Cards[13] = [13,"Mesmerize",5,3,3,4,1,"N/A","Mesmerize"]
  $Cards[14] = [14,"Glacial Eye",6,1,4,3,1,"Ice","Glacial Eye"]
  $Cards[15] = [15,"Belhelmel",3,4,5,3,1,"N/A","Belhelmel"]
  $Cards[16] = [16,"Thrustaevis",5,3,2,5,1,"Wind","Thrustaevis"]
  $Cards[17] = [17,"Anacondaur",5,1,3,5,1,"Poison","Anacondaur"]
  $Cards[18] = [18,"Creeps",5,2,5,2,1,"Lightning","Creeps"]
  $Cards[19] = [19,"Grendel",4,4,5,2,1,"Lightning","Grendel"]
  $Cards[20] = [20,"Jellyeye",3,2,1,7,1,"N/A","Jellyeye"]
  $Cards[21] = [21,"Grand Mantis",5,2,5,3,1,"N/A","Grand Mantis"]
 
  # Level Three Monster Cards
  $Cards[22] = [22,"Forbidden",6,6,3,2,2,"N/A","Forbidden"]
  $Cards[23] = [23,"Armadodo",6,3,1,6,2,"Earth","Armadodo"]
  $Cards[24] = [24,"Tri-Face",3,5,5,5,2,"Poison","Tri-Face"]
  $Cards[25] = [25,"Fastitocalon",7,5,1,3,2,"Earth","Fastitocalon"]
  $Cards[26] = [26,"Snow Lion",7,1,5,3,2,"Ice","Snow Lion"]
  $Cards[27] = [27,"Ochu",5,6,3,3,2,"N/A","Ochu"]
  $Cards[28] = [28,"SAM08G",5,6,2,4,2,"Fire","SAM08G"]
  $Cards[29] = [29,"Death Claw",4,4,7,2,2,"Fire","Death Claw"]
  $Cards[30] = [30,"Cactuar",6,2,6,3,2,"N/A","Cactuar"]
  $Cards[31] = [31,"Tonberry",3,6,4,4,2,"N/A","Tonberry"]
  $Cards[32] = [32,"Abyss Worm",7,2,3,5,2,"Earth","Abyss Worm"]
 
  # Level Four Monster Cards
  $Cards[33] = [33,"Turtapod",2,3,6,7,3,"N/A","Turtapod"]
  $Cards[34] = [34,"Vysage",6,5,4,5,3,"N/A","Vysage, Lefty, Righty"]
  $Cards[35] = [35,"T-Rexaur",4,2,6,7,3,"N/A","T-Rexaur"]
  $Cards[36] = [36,"Bomb",2,7,6,3,3,"Fire","Bomb"]
  $Cards[37] = [37,"Blitz",1,6,4,7,3,"Lightning","Blitz"]
  $Cards[38] = [38,"Wendigo",7,3,1,6,3,"N/A","Wendigo"]
  $Cards[39] = [39,"Torama",7,4,4,4,3,"N/A","Torama"]
  $Cards[40] = [40,"Imp",3,7,3,6,3,"N/A","Imp"]
  $Cards[41] = [41,"Blue Dragon",6,2,7,3,3,"Poison","Blue Dragon"]
  $Cards[42] = [42,"Adamantoise",4,5,5,6,3,"Earth","Adamantoise"]
  $Cards[43] = [43,"Hexadragon",7,5,4,3,3,"Fire","Hexadragon"]
 
  # Level Five Monster Cards
  $Cards[44] = [44,"Iron Giant",6,5,6,5,4,"N/A","Iron Giant"]
  $Cards[45] = [45,"Behemoth",3,6,5,7,4,"N/A","Behemoth"]
  $Cards[46] = [46,"Chimera",7,6,5,3,4,"Water","Chimera"]
  $Cards[47] = [47,"Pupu",3,"A",2,1,4,"N/A","Pupu"]
  $Cards[48] = [48,"Elastoid",6,2,6,7,4,"N/A","Elastoid"]
  $Cards[49] = [49,"GIM47N",5,5,7,4,4,"N/A","GIM47N"]
  $Cards[50] = [50,"Malboro",7,7,4,2,4,"Poison","Malboro"]
  $Cards[51] = [51,"Ruby Dragon",7,2,7,4,4,"Fire","Ruby Dragon"]
  $Cards[52] = [52,"Elnoyle",5,3,2,6,4,"N/A","Elnoyle"]
  $Cards[53] = [53,"Tonberry King",4,6,7,4,4,"N/A","Fatitocalon, Malboro"]
  $Cards[54] = [54,"Wedge, Biggs",6,6,2,7,4,"N/A","Snow Lion, Fungaur"]
 
  # Level Six Boss Cards
  $Cards[55] = [55,"Fujin, Raijin",2,8,8,4,5,"N/A","Iron Giant, Jelleye"]
  $Cards[56] = [56,"Elvoret",7,8,3,4,5,"Wind","Ochu, Bite Bug"]
  $Cards[57] = [57,"X-ATM092",4,8,7,3,5,"N/A","SAM08G, Red Bat"]
  $Cards[58] = [58,"Granaldo",7,2,8,5,5,"N/A","Death Claw, Blobra"]
  $Cards[59] = [59,"Gerogero",1,8,6,3,5,"Poison","Cactaur, Gayla"]
  $Cards[60] = [60,"Iguion",8,2,8,2,5,"N/A","Tonberry, Gesper"]
  $Cards[61] = [61,"Abadon",6,8,4,5,5,"N/A","Abyss Worm, Blood Soul"]
  $Cards[62] = [62,"Trauma",4,8,5,6,5,"N/A","Turtapod, Caterchipillar"]
  $Cards[63] = [63,"Oilboyle",1,8,4,8,5,"N/A","GIM47N, Cockatrice"]
  $Cards[64] = [64,"Shumi Tribe",6,5,8,4,5,"N/A","TRexaur, Grat"]
  $Cards[65] = [65,"Krysta",7,5,8,1,5,"N/A","Bomb, Buel"]
 
  # Level Seven Boss Cards
  $Cards[66] = [66,"Propagator",8,4,4,8,6,"N/A","Blitz, Mesmerize"]
  $Cards[67] = [67,"Jumbo Cactuar",8,8,4,4,6,"N/A","Wendigo, Glacial Eye"]
  $Cards[68] = [68,"Tri-Point",8,5,2,8,6,"Lightning","Torama, Belhelmel"]
  $Cards[69] = [69,"Gargantua",5,6,6,8,6,"N/A","Imp, Thrustaevis"]
  $Cards[70] = [70,"Mobile Type 8",8,6,7,3,6,"N/A","Blue Dragon, Anacondaur"]
  $Cards[71] = [71,"Sphinxara",8,3,5,8,6,"N/A","Adamantoise, Creeps"]
  $Cards[72] = [72,"Tiamat",8,8,5,4,6,"N/A","Hexadragon, Grendel"]
  $Cards[73] = [73,"BGH251F2",5,7,8,5,6,"N/A","Behemoth, Grand Mantis"]
  $Cards[74] = [74,"Red Giant",6,8,4,7,6,"N/A","Chimera, Forbidden"]
  $Cards[75] = [75,"Catoblepas",1,8,7,7,6,"N/A","Elnoyle, Armadodo"]
  $Cards[76] = [76,"Ultima Weapon",7,7,2,8,6,"N/A","Elastiod, Tri-Face"]
 
  # Level Eight GF Cards
  $Cards[77] = [77,"Chubby Chocobo",4,4,8,9,7,"N/A","Squall"]
  $Cards[78] = [78,"Angelo",9,6,7,3,7,"N/A","Squall"]
  $Cards[79] = [79,"Gilgamesh",3,7,9,6,7,"N/A","Squall"]
  $Cards[80] = [80,"Minimog",9,3,9,2,7,"N/A","Squall"]
  $Cards[81] = [81,"Chicobo",9,4,8,4,7,"N/A","Squall"]
  $Cards[82] = [82,"Quezacotl",2,9,9,4,7,"Lightning","Squall"]
  $Cards[83] = [83,"Shiva",6,7,5,9,7,"Ice","Squall"]
  $Cards[84] = [84,"Ifrit",9,6,2,8,7,"Fire","Squall"]
  $Cards[85] = [85,"Siren",8,9,6,2,7,"N/A","Squall"]
  $Cards[86] = [86,"Sacred",5,1,9,9,7,"Earth","Squall"]
  $Cards[87] = [87,"Minotaur",9,5,2,9,7,"Earth","Squall"]
 
  # Level Nine GF Cards
  $Cards[88] = [88,"Carbuncle",8,4,"A",4,8,"N/A","Squall"]
  $Cards[89] = [89,"Diablos",5,"A",8,3,8,"N/A","Squall"]
  $Cards[90] = [90,"Leviathan",7,"A",1,7,8,"Water","Squall"]
  $Cards[91] = [91,"Odin",8,"A",3,5,8,"N/A","Squall"]
  $Cards[92] = [92,"Pandemona","A",1,7,7,8,"Wind","Squall"]
  $Cards[93] = [93,"Cerberus",7,4,6,"A",8,"N/A","Squall"]
  $Cards[94] = [94,"Alexander",9,"A",4,2,8,"Holy","Squall"]
  $Cards[95] = [95,"Phoenix",7,2,7,"A",8,"Fire","Squall"]
  $Cards[96] = [96,"Bahamut","A",8,2,6,8,"N/A","Squall"]
  $Cards[97] = [97,"Doomtrain",3,1,"A","A",8,"Poison","Squall"]
  $Cards[98] = [98,"Eden",4,4,9,"A",8,"N/A","Squall"]
 
  # Level Ten Player Cards
  $Cards[99] = [99,"Ward","A",7,2,8,9,"N/A","Squall"]
  $Cards[100] = [100,"Kiros",6,7,6,"A",9,"N/A","Squall"]
  $Cards[101] = [101,"Laguna",5,"A",3,9,9,"N/A","Squall"]
  $Cards[102] = [102,"Selphie","A",8,6,4,9,"N/A","Squall"]
  $Cards[103] = [103,"Quistis",9,6,"A",2,9,"N/A","Squall"]
  $Cards[104] = [104,"Irvine",2,6,9,"A",9,"N/A","Squall"]
  $Cards[105] = [105,"Zell",8,5,"A",6,9,"N/A","Squall"]
  $Cards[106] = [106,"Rinoa",4,"A",2,"A",9,"N/A","Squall"]
  $Cards[107] = [107,"Edea","A","A",3,3,9,"N/A","Squall"]
  $Cards[108] = [108,"Seifer",6,9,"A",4,9,"N/A","Squall"]
  $Cards[109] = [109,"Squall","A",4,6,9,9,"N/A","Squall"]
 
end #Module Card_Details
#===============================================================================
# Alias Game_Party and add in variables and shit
class Game_Party < Game_Unit
  attr_accessor :card_list
  attr_accessor :list_index
  attr_accessor :list_max
  attr_accessor :unique_list
  attr_accessor :type_total
  attr_accessor :level_index
  attr_accessor :level_list
  attr_accessor :has_cards
  attr_accessor :virtual_index
  attr_reader :card_max
  attr_accessor :allow_input
 
  alias init_gm_party_triple_triad initialize unless $@
  def initialize(*args)
    init_gm_party_triple_triad(*args)
    # This is the array of all the cards owned by the player
    @card_list = []
    @list_index = 0
    @list_max = 0
    @level_index = 0
    # Level list holds the number of cards in each level
    # For eg.
    # @level_list = [4,1,5,6,1,0,0,0,1,0]
    # This would mean they have 4 Lv1, 1 Lv2, 6 Lv4 and so on...
    @level_list = []
    # Maximum number of cards.
    @card_max = 109
    for i in 0..@card_max
      @card_list[i] = 0
    end
    # An array of the number of unique cards the player has.
    @unique_list = 0
    # Boolean to say if a player HAS cards
    @has_cards = false
   
    # VIRTUAL INDEX
    # Virtual index holds the index of the card * the level window
    # (Note. level windows are one less, like an array)
    # Lv 1 window - 0. Lv2 window - 1  etc etc
    # eg...
    # (Level 1 window * 11) + list_index (which is 5?)
    # This would be, 0 + 5     the viewed card would be Gayla
    # Another eg...
    # (Level 4 window * 11) + list_index (which is 2)
    # this would be 33 + 2... the card viewed is..
    @virtual_index = 0
   
    # Used in Card Mod
    @allow_input = false

    $card_quantity = 0
    $monster_quantity = 0
    $boss_quantity = 0
    $gf_quantity = 0
    $player_quantity = 0
  end
   
end
#===============================================================================
# Window_Obtain_Card. This shows when a card is obtained.
class Window_Obtain_Card < Window_Base
  def initialize
    super(220,116,125,152)
    create_contents
    create_card_image
    refresh
  end
 
  def refresh

  end

  def create_card_image
    @card_image = Sprite.new
    @card_image.x = (self.x + 16)
    @card_image.y = (self.y + 16)
    card_index = $Cards[$game_variables[1]]
    filename = card_index[1]
    bitmap = Cache.picture(filename)
    @card_image.bitmap = bitmap
    @card_image.z -= 1
  end
 
  def terminate

  end
 
end
#===============================================================================
class Window_Lose_Card < Window_Base
  def initialize
    super(220,116,125,152)
    create_contents
    create_card_image
    refresh
  end
 
  def refresh
   
  end
 
  def create_card_image
    @card_image = Sprite.new
    @card_image.x = (self.x + 16)
    @card_image.y = (self.y + 16)
    card_index = $Cards[$game_variables[1]]
    filename = card_index[1]
    bitmap = Cache.picture(filename)
    @card_image.bitmap = bitmap
    @card_image.z -= 1
  end
 
  def terminate
   
  end
end #Window_Lose_Card
#===============================================================================
# Window_Lose_Title - Name of the card lost and also how many are left
class Window_Lose_Title < Window_Base
  def initialize
    super(0,0,544,24+32)
    create_contents
    refresh
  end
 
  def refresh
    card_index = $Cards[$game_variables[1]]
    self.contents.draw_text(0,0,544,WLH, "Lost: #{card_index[1]}",1)
  end
 
  def terminate
   
  end
 
end
#===============================================================================
# Window_Obtain_Title - Name of the card obtained and also NEW if it's new
class Window_Obtain_Title < Window_Base
  def initialize
    super(0,0,544,24+32)
    create_contents
    refresh
  end
 
  def refresh
    card_index = $Cards[$game_variables[1]]
    self.contents.draw_text(0,0,544,WLH, "Obtained: #{card_index[1]}",1)
  end
 
  def terminate
   
  end
 
end
#===============================================================================
# Window_Cards_Left displays a message saying how many of that type of card
# are left
class Window_Cards_Left < Window_Base
  def initialize
    super(236,250,93,WLH+32)
    create_contents
    refresh
  end
 
  def refresh
    card_index = $game_party.card_list[$game_variables[1]]
    self.contents.draw_text(0,0,width-32,WLH, "#{card_index} left",1)
  end
 
  def terminate
 
  end
 
end
#===============================================================================
# Window_New_Card displays a message saying the obtained card is new to the
# collection.
class Window_New_Card < Window_Base
  def initialize
    super(236,250,93,WLH+32)
    create_contents
    refresh
  end
 
  def refresh
    self.contents.draw_text(0,0,width-32,WLH, "[NEW]",1)
  end
 
  def terminate
 
  end
 
end
#===============================================================================
# Scene_Obtained_Card is used when obtaining a card outside of a duel
class Scene_Obtained_Card < Scene_Base
  def start
    Sound.play_recovery
    is_new
    $game_party.card_list[$game_variables[1]] += 1
    create_windows
  end #start
 
 
  def create_windows
    @Obtain_Card = Window_Obtain_Card.new
    @Obtain_Title = Window_Obtain_Title.new
    @Obtain_Card.visible = false
  end #create_windows
 
  def is_new
    if $game_party.card_list[$game_variables[1]] <= 0
      # the card is new
      @new_card = Window_New_Card.new
    else
      # if there is already that index, the card is already owned
    end #if
  end #is_new
   
  def update
    @Obtain_Card.update
    @Obtain_Title.update
    update_input
  end #update
 
  def update_input
    if Input.trigger?(Input::C)
      Sound.play_cancel
      $scene = Scene_Map.new
      return
    end #Input C
    if Input.trigger?(Input::B)
      Sound.play_cancel
      $scene = Scene_Map.new
      return
    end #Input B
  end #update_input
 
  def terminate
    @Obtain_Card.dispose
    @Obtain_Title.dispose
    if @new_card != nil
      @new_card.dispose
    end
  end #terminate

end
#===============================================================================
# Scene_Lose_Card is used when losing a card outside of a duel
class Scene_Lose_Card < Scene_Base
  def start
    Sound.play_enemy_collapse
    $game_party.card_list[$game_variables[1]] -= 1
    create_windows
  end #start
 
  def create_windows
    @Lose_Card = Window_Lose_Card.new
    @Lose_Title = Window_Lose_Title.new
    @Lose_Left = Window_Cards_Left.new
    @Lose_Card.visible = false
  end #create_windows
   
  def update
    @Lose_Card.update
    @Lose_Title.update
    update_input
  end #update
 
  def update_input
    if Input.trigger?(Input::C)
      Sound.play_cancel
      $scene = Scene_Map.new
      return
    end #Input C
    if Input.trigger?(Input::B)
      Sound.play_cancel
      $scene = Scene_Map.new
      return
    end #Input B
  end #update_input
 
  def terminate
    @Lose_Card.dispose
    @Lose_Title.dispose
    @Lose_Left.dispose
  end #terminate

end
#===============================================================================
# Scene_Card_Viewer shows the player a list of cards they own.
# This is the scene that is called by the menu
class Scene_Card_Viewer < Scene_Base
  def start
    $game_party.list_index = 0
    $game_party.level_index = 0
    $game_party.virtual_index = 0
    @card_counter = 0
    check_for_cards
    create_windows
  end
 
  def check_for_cards
    for i in 0...$game_party.card_max
      if $game_party.card_list[i] != 0
        #they have cards
        @card_counter += 1
      else
        #no cards :(
      end
    end
    if @card_counter != 0
      $game_party.has_cards = true
    else
      $game_party.has_cards = false
    end
     
  end #check_for_cards
 
  def create_windows
    $game_party.list_index = 0

    viewer_info_port = Viewport.new(0, 0, 544, 416)
    viewer_image_port = Viewport.new(0, 0, 544, 416)

    @Viewer_Title = Window_Viewer_Title.new
    @Viewer_Name = Window_Viewer_Name.new
    @Viewer_Card_List = Window_Card_List.new
    @Viewer_Bottom = Window_Viewer_Bottom.new
    @Viewer_Info = Window_Card_Info.new
    @Viewer_Stats = Window_Card_Stats.new
    @Viewer_Card_List.active = true
    @Viewer_Card_List.index = 0
    @Viewer_Card_Image = Window_Created_Card.new
    @Viewer_Card_Image.viewport = viewer_image_port
    @Viewer_Info.z = -100
    @Viewer_Card_Image.z = 50
  end
 
  def update
    @Viewer_Title.refresh
    @Viewer_Bottom.refresh
    @Viewer_Info.refresh
    @Viewer_Card_Image.create_card_image
    update_input
  end
 
  def update_input
    if Input.trigger?(Input::C)
      @Viewer_Title.update
      return
    end
    if Input.trigger?(Input::B)
      Sound.play_cancel
      return_scene
      return
    end
   
    if Input.repeat?(Input::UP)
      Sound.play_cursor
      if $game_party.list_index != 0
        # IF the index is NOT hitting 0 (the top)
        $game_party.list_index -= 1
        @Viewer_Card_List.index = $game_party.list_index
      else
        # The index is 0
        $game_party.list_index = 10
        @Viewer_Card_List.index = $game_party.list_index
      end #if $game_party.list_index != 0
      @Viewer_Title.refresh
      @Viewer_Card_Image.create_card_image
      $game_party.virtual_index = ((11*$game_party.level_index) + $game_party.list_index)
      @Viewer_Title.refresh
      @Viewer_Card_Image.create_card_image
      @Viewer_Card_List.refresh
     
    end
    if Input.repeat?(Input::DOWN)
      Sound.play_cursor
      if $game_party.list_index != 10
        # If the index is NOT hitting the bottom of the list
        $game_party.list_index += 1
        @Viewer_Card_List.index = $game_party.list_index
      else
        # The index IS hitting the bottom of the list
        $game_party.list_index = 0
        @Viewer_Card_List.index = $game_party.list_index
      end
      @Viewer_Title.refresh
      @Viewer_Card_Image.create_card_image
      $game_party.virtual_index = ((11*$game_party.level_index) + $game_party.list_index)
      @Viewer_Title.refresh
      @Viewer_Card_Image.create_card_image
      @Viewer_Card_List.refresh
    end
    if Input.repeat?(Input::RIGHT)
      Sound.play_cursor
      @Viewer_Card_List.contents.clear
      if $game_party.level_index != 9
        $game_party.level_index += 1
      else
        $game_party.level_index = 0
      end
      $game_party.virtual_index = ((11*$game_party.level_index) + $game_party.list_index)
      @Viewer_Title.refresh
      @Viewer_Card_Image.create_card_image
      @Viewer_Card_List.refresh
    end
    if Input.repeat?(Input::LEFT)
      Sound.play_cursor
      @Viewer_Card_List.contents.clear
      if $game_party.level_index != 0
        $game_party.level_index -= 1
      else
        $game_party.level_index = 9
      end
      $game_party.virtual_index = ((11*$game_party.level_index) + $game_party.list_index)
      @Viewer_Title.refresh
      @Viewer_Card_Image.create_card_image
      @Viewer_Card_List.refresh
    end

  end
 
  def terminate
    super
    $game_party.list_index = 0
    $game_party.level_index = 0
    $game_party.virtual_index = 0
    @Viewer_Title.dispose
    @Viewer_Name.dispose
    @Viewer_Card_List.dispose
    @Viewer_Bottom.dispose
    @Viewer_Info.dispose
    @Viewer_Stats.dispose
    @Viewer_Card_Image.dispose
    if $viewer_card != nil
      $viewer_card.dispose
    end
  end
 
  def return_scene
    $scene = Scene_Map.new
  end
 
end
#===============================================================================
# Window_Viewer_Title displays where to obtain the card.
class Window_Viewer_Title < Window_Base
  def initialize
    super(0, (WLH+32)+(416-((WLH+32)*2)), 544, WLH+32)
    create_contents
    refresh
  end

  def refresh
    if $game_party.has_cards != false
      # Get the index of the Card List
      @card_index = $game_party.virtual_index
      @card_number = $game_party.card_list[@card_index]
      # Now grab the array using that index
      @card_details = $Cards[@card_index]
     
      if @card_number == 0
        #Clear the contents
        self.contents.clear
      else
        # Now we have the array, search field 1 for it's name
        self.contents.clear
        self.contents.draw_text(0,0,544-32,WLH, "#{@card_details[8]}",2)
        if @card_details[6] <= 6
          self.contents.draw_text(0,0,544-32,WLH, "MONSTER",0)
        else
          self.contents.draw_text(0,0,544-32,WLH, "AREA",0)
        end
      end
    else
      self.contents.clear
    end
  end
 
end #Window_Viewer_Title
#===============================================================================
class Window_Card_Info < Window_Base
  def initialize
    super(544/2, WLH+32, 544/2, (416-((WLH+32)*2))/2)
    self.z += 1
    create_contents
    refresh
  end
 
  def refresh
    self.contents.clear
    @card_index = $game_party.card_list[$game_party.virtual_index]
    @card_spotter = $Cards[$game_party.virtual_index]
    if @card_index == 0
      # Don't own any of those cards... be empty
    else
      self.contents.draw_text(8,0,200,WLH*7,"Elemental",0)
      self.contents.draw_text(8,0,200,WLH*9,"#{@card_spotter[7]}",0)
     
      # Draw the top number
      self.contents.draw_text(0,0,130,WLH,"#{@card_spotter[2]}",1)
      # Draw the right number
      self.contents.draw_text(85,WLH*1,110,WLH,"#{@card_spotter[3]}",0)
      # Draw the bottom number
      self.contents.draw_text(0,WLH*2,130,WLH,"#{@card_spotter[4]}",1)
      # Draw the left number
      self.contents.draw_text(35,WLH*1,110,WLH,"#{@card_spotter[5]}",0)
    end
  end
 
  def terminate

  end
 
end #Window_Card_Info
#===============================================================================
class Window_Created_Card < Window_Base
  attr_accessor :viewer_card
  def initialize
    super(544/2, WLH+32,93,120)
    create_contents
    self.visible = false
    create_card_image
    refresh
  end
 
  def create_card_image
    if $viewer_card != nil
      $viewer_card.dispose
    end
    # Otherwise - draw the card image ;)
    $viewer_card = Sprite.new
    $viewer_card.x = (434)
    $viewer_card.y = (self.y+ 15)
    # Use the index of the menu to check what the card ID is from card_list
    card_index = $game_party.card_list[$game_party.virtual_index]
    if card_index < 1
      filename = "Back"
    else
      card_spotter = $Cards[$game_party.virtual_index]
      filename = card_spotter[1]
    end
    # Filename is now the index inside the array... the name of the card
    bitmap = Cache.picture(filename)
    $viewer_card.bitmap = bitmap
  end
 
  def refresh

  end
 
end #Window_Created_Card
#===============================================================================
class Window_Card_Stats < Window_Base
  def initialize
    super(544/2, (WLH+32)+(416-((WLH+32)*2))/2, 544/2, (416-((WLH+32)*2))/2)
    create_contents
    refresh
  end
 
  def refresh
    self.contents.clear
    $card_quantity = 0
    $monster_quantity = 0
    $boss_quantity = 0
    $gf_quantity = 0
    $player_quantity = 0
    #Fill the Stat window with - Total Number of cards. Number of unique cards
    # Find the length of @card_list. This is the number of cards the player has
    for card_counter in 0..$game_party.card_max
      if $game_party.card_list[card_counter] != nil
        $card_quantity += $game_party.card_list[card_counter]
      end
    end
 
    for monster_counter in 0..54
        $monster_quantity += $game_party.card_list[monster_counter]
    end
   
    for boss_counter in 55..76
        $boss_quantity += $game_party.card_list[boss_counter]
    end
   
    for gf_counter in 77..98
        $gf_quantity += $game_party.card_list[gf_counter]
    end
   
    for player_counter in 99..109
        $player_quantity += $game_party.card_list[player_counter]
    end
   
    # Now print a stat like.. "Total Cards Owned: X"
    self.contents.draw_text(32,(WLH*0),100,WLH, "MONSTER",0)
    self.contents.draw_text(32,(WLH*1),100,WLH, "BOSS",0)
    self.contents.draw_text(32,(WLH*2),100,WLH, "GF",0)
    self.contents.draw_text(32,(WLH*3),100,WLH, "PLAYER",0)
    self.contents.draw_text(32,(WLH*4),100,WLH, "TOTAL",0)
   
    self.contents.draw_text(0,(WLH*0),(544/2)-32,WLH, "#{$monster_quantity}",2)
    self.contents.draw_text(0,(WLH*1),(544/2)-32,WLH, "#{$boss_quantity}",2)
    self.contents.draw_text(0,(WLH*2),(544/2)-32,WLH, "#{$gf_quantity}",2)
    self.contents.draw_text(0,(WLH*3),(544/2)-32,WLH, "#{$player_quantity}",2)
    self.contents.draw_text(0,(WLH*4),(544/2)-32,WLH, "#{$card_quantity}",2)
  end
end
#===============================================================================
class Window_Viewer_Name < Window_Base
  def initialize
    super(544-160,0,160,WLH+32)
    create_contents
    refresh
  end
 
  def refresh

    self.contents.draw_text(0,0,width-32,WLH,"Cards",1)
  end
 
end
#===============================================================================
class Window_Card_List < Window_Selectable
  def initialize
    super(0, WLH+32, 544/2, 416-((WLH+32)*2))
    @column_max = 1
    create_contents
    refresh
  end
 
  def refresh
    @item_max = 10
    self.contents.clear
    @name_level_start = 0
    @name_level_popper = 0
    # Find the level being displayed and make a variable which is that level
    case $game_party.level_index
      when 0
        @name_level_start = 0
        @name_level_popper = 10
      when 1
        @name_level_start = 11
        @name_level_popper = 21
      when 2
        @name_level_start = 22
        @name_level_popper = 32
      when 3
        @name_level_start = 33
        @name_level_popper = 43
      when 4
        @name_level_start = 44
        @name_level_popper = 54
      when 5
        @name_level_start = 55
        @name_level_popper = 65
      when 6
        @name_level_start = 66
        @name_level_popper = 76
      when 7
        @name_level_start = 77
        @name_level_popper = 87
      when 8
        @name_level_start = 88
        @name_level_popper = 98
      when 9
        @name_level_start =99
        @name_level_popper = 109
    end
        itwo = 0
    #Begin popping out card names
    #This loop is for the correct index

    for i in @name_level_start..@name_level_popper
      # This loop is for the name spacing
      @card_index = $game_party.card_list[i]
      if @card_index == 0
        #No card, display no name.
        self.contents.draw_text(8,(WLH*(i%11)),544,WLH, "",0)
      else
        @card_number = $Cards[i]
        # Now grab the array using that index
        @card_details = @card_number[1]
        rect = item_rect($game_party.list_index)
        self.contents.draw_text(rect,"")
        draw_icon(145, 0, WLH*(i%11))
        self.contents.draw_text(32,(WLH*(i%11)),(544/2)-32,WLH,"#{@card_details}",0)
        self.contents.draw_text(0,(WLH*(i%11)),(544/2)-32,WLH, "#{@card_index}",2)
      end #if there are no cards...
    end #loop for name spacing
  end # refresh
 
end #Window_Card_List
#===============================================================================
class Window_Viewer_Bottom < Window_Base
  def initialize
    super(0,0,544-160,WLH+32)
    create_contents
    refresh
  end
 
  def refresh
    @card_number = $game_party.card_list[$game_party.virtual_index]
    # Now grab the array using that index
    @card_details = $Cards[$game_party.virtual_index]
     
    if @card_number != 0
      # Now we have the array, search field 1 for it's name
      self.contents.clear
      case @card_details[6]
      when 0
        self.contents.draw_text(0,0,544-32,WLH, "Level 1 Monster Card",0)
      when 1
        self.contents.draw_text(0,0,544-32,WLH, "Level 2 Monster Card",0)
      when 2
        self.contents.draw_text(0,0,544-32,WLH, "Level 3 Monster Card",0)
      when 3
        self.contents.draw_text(0,0,544-32,WLH, "Level 4 Monster Card",0)
      when 4
        self.contents.draw_text(0,0,544-32,WLH, "Level 5 Monster Card",0)
      when 5
        self.contents.draw_text(0,0,544-32,WLH, "Level 6 Boss Card",0)
      when 6
        self.contents.draw_text(0,0,544-32,WLH, "Level 7 Boss Card",0)
      when 7
        self.contents.draw_text(0,0,544-32,WLH, "Level 8 GF Card",0)
      when 8
        self.contents.draw_text(0,0,544-32,WLH, "Level 9 GF Card",0)
      when 9
        self.contents.draw_text(0,0,544-32,WLH, "Level 10 Player Card",0)
      end # case @card_details[level]
    else
      self.contents.clear
    end #if
  end #refresh
 
end #Window_Viewer_Bottom
#===============================================================================

#=end

Credit


  • SeMcDun

Thanks

  • Massive thanks to GubiD. Without his online tutorials I probably wouldn't have gotten round to learning RGSS2. If you are looking to get into scripting I'd recommend checking out his youtube channel.
  • FFVIII for giving me the idea to make this.

Support


Feel free to post any bugs you find in this thread. I will reply when I can and will hopefully be able to help.

Known Compatibility Issues

I don't THINK there will be any compatibility issues with other scripts, but as I'm new to scripting please report any problems you have with conflicting scripts as this would help improve my future scripts.

Demo


See Attached files for the demo. It's just a quick map showing off how to call some of the scenes and stuff.

Author's Notes


I hope people find unique ways of using this script, something that brings that extra sparkle to their game.
Enjoy :)
Restrictions

For use in non-commercial games only.
« Last Edit: September 09, 2011, 10:30:00 AM by SeMcDun »

***
Rep:
Level 69
RESIDENT ADONKADONK
Wow. This is actually pretty cool.

I'm back.

**
Rep:
Level 83
I was working exactly on the same thing :)
I have finished but it's in french . And yes , complete : deckbuilder , game duel , boosters .
I'm quite curious to see how you will make this ... and i can help if you have some problems .
Good luck , it was , well not really difficult , but very long .
An advice : don't try to make EXACTLY the same as FFVIII (i see that the cards are exactly the same) .

A picture from my project .
Spoiler for:

You can use my scripts freely . but not for commercial use .
:ccbync:
Don't encrypt your game !!!
Want to give me credit ? Easy ,add me in your game :

**
Rep: +0/-0Level 72
RMRK Junior
Woooo, nice menu, man! I was eventing a card game for my project and wasn't entirely sure how to go about getting a menu going, but I think this one will work nicely! Good job. :3
« Last Edit: August 24, 2011, 08:22:10 PM by emmych »

**
Rep:
Level 83
プログラマです
:D woo glad some people like it.

@ Dricc : This is purely a way for me to get better at scripting. By copying another system in place it helps me get my goals straight for what I was trying to do.

I'm a big fan of card games so I'd like to come up with an original game sometime. I guess replicating Triple Triad will make this easier in the future :)

****
Rep:
Level 83
3...2...1...
Pic link is broken.

**
Rep:
Level 83
プログラマです
Pic should be fixed now :)  (I dunno how to get a big picture on, so the link picture will do for now hehe)

***
Rep:
Level 74
I'm baaack!
This is a neat script. I'm currently working on my first script. I'm making a script that adds 5 extra equip slots. It's been difficult since I know next to nothing about RGSS2 so I copy most of it from default scripts. It's still custom enough.

**
Rep: +0/-0Level 71
Dark Matter
I was working exactly on the same thing :)
I have finished but it's in french . And yes , complete : deckbuilder , game duel , boosters .
I'm quite curious to see how you will make this ... and i can help if you have some problems .
Good luck , it was , well not really difficult , but very long .
An advice : don't try to make EXACTLY the same as FFVIII (i see that the cards are exactly the same) .

A picture from my project .
Spoiler for:


hey do you have a demo of your card game i could possibly look at?
very intressed and credit will be given :D

**
Rep: +0/-0Level 78
RMRK Junior
can't wait until the game script comes out!!!