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.

KyoNewParty XP

KyoNewParty XP
version 1.0.1
by Kyonides-Arkanthos

alias Kyonides, Shadowball

Features

Just a simple menu where you can select any hero from your actors database. You cannot make a party bigger or larger than 4.

(See Constant MAXSIZE found in line 27 to edit this size limit at will)

Instructions

See script comments.

[rgss]<span style="color:#000080; font-style:italic;">=begin
<span style="color:#000080; font-style:italic;">  *  KyoNewParty XP
<span style="color:#000080; font-style:italic;">  by Kyonides-Arkanthos alias Kyonides, Shadowball
<span style="color:#000080; font-style:italic;">  version 1.0.1 - 03.17.2010
<span style="color:#000080; font-style:italic;"> 
<span style="color:#000080; font-style:italic;">  Plug & Play Script
<span style="color:#000080; font-style:italic;"> 
<span style="color:#000080; font-style:italic;">  *** INSTRUCTIONS ***
<span style="color:#000080; font-style:italic;"> 
<span style="color:#000080; font-style:italic;">  You can begin a new journey with your party right after you press ENTER or
<span style="color:#000080; font-style:italic;">  INTRO IF you have at least a single member.
<span style="color:#000080; font-style:italic;"> 
<span style="color:#000080; font-style:italic;">  Remember you cannot have more than the party members maximum size.
<span style="color:#000080; font-style:italic;">  (See Constant MAXSIZE in KyoParty module - line 30)
<span style="color:#000080; font-style:italic;"> 
<span style="color:#000080; font-style:italic;">  The instance variable @hidden (an Array) stores all the actors or heroes you
<span style="color:#000080; font-style:italic;">  don't want the player to choose at the beginning of the game for any reason.
<span style="color:#000080; font-style:italic;"> 
<span style="color:#000080; font-style:italic;">  *** KEYS ***
<span style="color:#000080; font-style:italic;"> 
<span style="color:#000080; font-style:italic;">  ESCAPE or Q - Exits party scene
<span style="color:#000080; font-style:italic;"> 
<span style="color:#000080; font-style:italic;">  SHIFT - Chooses a Hero
<span style="color:#000080; font-style:italic;"> 
<span style="color:#000080; font-style:italic;">  ENTER or INTRO - Finishes Hero selection, a new game begins
<span style="color:#000080; font-style:italic;">=end
module KyoParty
  Files = File.exist?('Game.rxproj') ? RPG::Cache : Cache
  MAXSIZE = 4
  @members = []
  @hidden  = [2,4]
  @all_actors = load_data('Data/Actors.rxdata').compact
  @actors = []
  @all_actors.each {|actor| @actors << actor if !@hidden.include? actor.id}
 
  def self.members; @members end
 
  def self.hidden_members; @hidden end
 
  def self.actors; @actors end
end
 
module Coordinates
  def x=(value); @x, self.viewport.rect.x = value, value end
 
  def y=(value); @y, self.viewport.rect.y = value, value end
 
  def x_y(value1, value2)
    @x, self.viewport.rect.x = value1, value1
    @y, self.viewport.rect.y = value2, value2
  end
end
 
class Window_Base
  def x_y(value1, value2); self.x, self.y = value1, value2 end
end
 
class Array
  def now; return if @pos.nil?; return self[@pos] end
 
  def now=(value); @pos = value end
 
  def index_now; return !@pos.nil? ? @pos : 0 ; end
 
  def next
    @pos = (@pos.nil? or @pos == self.size-1) ? 0 : @pos+1
    return self[@pos]
  end
  alias :succ :next
 
  def reset_pos!; @pos  = nil if !@pos.nil?; end
 
  def next=(value); return self[@pos] = value; end
 
  def prev
    @pos = (@pos.nil? or @pos == 0) ? self.size-1 : @pos-1
    return self[@pos]
  end
  alias :previous :prev
 
  def prev=(value); return self[@pos] = value; end
end
 
class Game_Party
  def setup_starting_members
    @actors = []
    for i in KyoParty.members
      @actors.push($game_actors)
    end
  end
end
 
class Sprite_KyoNewHero < Sprite
  include Coordinates
  def initialize(index)
    super(Viewport.new(16,220,612,300))
    viewport.z = 200
    actor = KyoParty.actors[index]
    self.bitmap = Bitmap.new(28, 48)
    bitmap = KyoParty::Files.character actor.character_name, actor.character_hue
    self.bitmap.blt(0, 0, bitmap, Rect.new(0,0,28,48))
    self.ox, self.oy = 0, 0
  end
end
 
class Sprite_KyoHexagon < Sprite
  include Coordinates
  attr_accessor :pos_x, :pos_y
  def initialize
    super(Viewport.new(16,56,612,400))
    viewport.z = 100
    self.bitmap = Bitmap.new(56, 56)
    self.bitmap.blt(0, 0, KyoParty::Files.picture('bar'), Rect.new(0,0,56,56))
    self.ox, self.oy = 0, 0
    @pos_x, @pos_y = [], []
  end
 
  def update
    x_y(@pos_x.prev, @pos_y.prev) if Input.trigger?(Input::LEFT)
    if Input.trigger?(Input::RIGHT) or @pos_x.now.nil?
      x_y(@pos_x.next, @pos_y.next)
    end
  end
end
 
class Window_Base
  def show_actor_name(actor, x, y)
    self.contents.font.color = system_color
    self.contents.draw_text(x, y, 160, 24, 'Nombre:')
    self.contents.font.color = normal_color
    self.contents.draw_text(x+80, y, 160, 24, actor.name)
  end
 
  def show_actor_class(actor, x, y)
    self.contents.font.color = system_color
    self.contents.draw_text(x, y, 216, 24, 'Clase:')
    self.contents.font.color = normal_color
    self.contents.draw_text(x+80, y, 216, 24, actor.class_name)
  end
end
 
class Window_KyoHelp < Window_Base
  def initialize
    super(0, 0, 640, 56)
    self.contents = Bitmap.new(width - 32, height - 32)
  end
 
  def set_text(text, align = 0)
    if text != @text or align != @align
      self.contents.clear
      self.contents.font.color = normal_color
      self.contents.draw_text(4, 0, self.width - 40, 24, text, align)
      @text = text
      @align = align
      @actor = nil
    end
    self.visible = true
  end
end
 
class Window_KyoCharacterInfo < Window_Base
  attr_accessor :index
  def initialize(x, y, index=0)
    super(x, y, 256, 128)
    self.contents = Bitmap.new(224, 96)
    self.windowskin = KyoParty::Files.windowskin 'WS Black'
    @index, self.visible = [], true
    KyoParty.actors.each{|actor| @index.push Game_Actor.new(actor.id)}
    @actor = @index.next
    refresh
  end
 
  def refresh
    if Input.trigger?(Input::RIGHT)# or Input.press?(Input::RIGHT)
      @actor = @index.next
    elsif Input.trigger?(Input::LEFT)# or Input.press?(Input::LEFT)
      @actor = @index.prev
    end
    if @index.index_now != @index_now
      self.contents.clear
      show_actor_name(@actor, 0, 0)
      show_actor_class(@actor, 0, 24)
      draw_actor_hp(@actor, 0, 48)
      draw_actor_sp(@actor, 0, 72)
      @index_now = @index.index_now
    end
  end
 
  def index; @index.index_now end
end
 
class Window_KyoPartyMembers < Window_Base
  def initialize(x, y)
    super(x, y, 192, 128)
    self.contents = Bitmap.new(160, 96)
    self.contents.font.color = Color.new(40,180,120,255)
    self.contents.draw_text(0, 0, 160, 24, 'Total: '+KyoParty.members.size.to_s)
    self.windowskin = KyoParty::Files.windowskin 'WS Black'
    @actors = []
  end
 
  def refresh_names_list(actor)
    @actors << actor
    if @actors.size > 0 and @actors.size != @size
      self.contents.clear
      @size, y = @actors.size, [0, 24, 48, 72]
      @actors.each do |actor|
        self.contents.draw_text(0, y.next, 160, 24, actor.name)
      end
    end
  end
end
 
class Scene_Title
  def command_new_game; $scene = Scene_KyoNewParty.new end
end
 
class Scene_Base
  def main
    start
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      break if $scene != self
    end
    Graphics.freeze
    terminate
  end
 
  def start; end
 
  def terminate; end
 
  def update; end
end
 
class Scene_KyoNewParty < Scene_Base
  def start
    $data_system.party_members = []
    @back_sprite = Sprite.new
    @back_sprite.bitmap = KyoParty::Files.picture('LilianaVess')
    @back_sprite.y = 48
    @cursor_sprite = Sprite_KyoHexagon.new
    @help_window = Window_KyoHelp.new
    @help_window.windowskin = KyoParty::Files.windowskin('WS Black')
    @help_window.set_text('Por favor, escoja un Heroe', 1)
    @actor_window = Window_KyoCharacterInfo.new(0,352)
    @members_window = Window_KyoPartyMembers.new(256,352)
    @actors = []
    x = [16, 60, 104, 148, 192, 236, 280, 324, 368, 412, 456, 500, 544, 588]
    y = [156, 104, 52, 0, -52]
    KyoParty.actors.each do |a|
      @actors << Sprite_KyoNewHero.new(KyoParty.actors.index(a))
      @actors.next.x = x.next
      @actors.now.y = (KyoParty.actors.index(a)%14==0) ? 140+y.next : 140+y.now
      @actors.now.opacity = 140 if @actor_window.index != @actors.index_now
      @cursor_sprite.pos_x << x.now-12
      @cursor_sprite.pos_y << 136+y.now
    end
    @cursor_sprite.update
  end
 
  def terminate
    @back_sprite.dispose
    @cursor_sprite.dispose
    @help_window.dispose
    @actor_window.dispose
    @members_window.dispose
    @actors.each {|sprite| sprite.dispose}
    @actors.clear
  end
 
  def update
    @actor_window.refresh
    @cursor_sprite.update
    if @actor_window.index != @index_now
      @index_now = @actor_window.index
      @actors.each do |sprite|
        sprite.opacity = same_index?(sprite) ? 255 : 140
      end
    end
    $scene = Scene_Title.new if Input.trigger? Input::B
    if Input.trigger? Input::SHIFT
      actor = Game_Actor.new(KyoParty.actors[@actor_window.index].id)
      @members_window.refresh_names_list(actor)
      if KyoParty.members.size < KyoParty::MAXSIZE
        KyoParty.members << KyoParty.actors[@actor_window.index].id
      end
    elsif Input.trigger? Input::C
      switch_to_map if KyoParty.members.size > 0
    end
  end
 
  def same_index?(sprite); @actors.index(sprite) == @actor_window.index end
 
  def switch_to_map
    $game_system.se_play($data_system.decision_se)
    Audio.bgm_stop
    Graphics.frame_count = 0
    $game_temp          = Game_Temp.new
    $game_system        = Game_System.new
    $game_switches      = Game_Switches.new
    $game_variables     = Game_Variables.new
    $game_self_switches = Game_SelfSwitches.new
    $game_screen        = Game_Screen.new
    $game_actors        = Game_Actors.new
    $game_party         = Game_Party.new
    $game_troop         = Game_Troop.new
    $game_map           = Game_Map.new
    $game_player        = Game_Player.new
    $game_party.setup_starting_members
    $game_map.setup($data_system.start_map_id)
    $game_player.moveto($data_system.start_x, $data_system.start_y)
    $game_player.refresh
    $game_map.autoplay
    $game_map.update
    $scene = Scene_Map.new
  end
end
[/rgss]


DEMO

Author Notes

Free to use in any kind of game, just include me in your credits as Kyonides-Arkanthos.
 
This script is actually looking quite useful, and reminds me a great deal of the beginning of Dragon Warrior III/Dragon Quest III, where you can create and use different party members.

I do have a nitpick with this script, but since I already posted the same nitpick in another one of your script threads, I'm sure you'll see it. Hopefully, you'll see how it would apply to this script as well.
 

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