XP 스크립트



(스크린샷은 파라犬씨의 사이드뷰 스크립트와 톱니바퀴성의 게이지 스크립트가 적용된 것)

  턴제 사이드뷰 전투에 걸맞게 변경된 전투상태창입니다.  원 데모에서는 스킬시전시 스킬명이 도움말창 대신 별도의 작은 창에 나타나도록 되어 있습니다.


#from RPG Advocate's Demo

class Window_BattleEffect < Window_Base
  #------------------------------
  attr_accessor :effect
  #--------------------------------------------------------------------------
  # Initialize the Object.
  #--------------------------------------------------------------------------
  def initialize
    super(190, 10, 260, 52)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.back_opacity = 255
    #self.contents.font.name = "Arial"
    #self.contents.font.size = 24
    self.z = 1500
    @effect = ""
    refresh
  end
  #--------------------------------------------------------------------------
  # Refresh.
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.draw_text(4, -8, self.width - 40, 36, @effect, 1)
  end
  #--------------------------------------------------------------------------
  # Frame Update.
  #--------------------------------------------------------------------------
  def update
    super
    end
  end
 

#==============================================================================
# ■ Window_BattleStatus
#------------------------------------------------------------------------------
#  バトル画面でパーティメンバーのステータスを表示するウィンドウです。
#==============================================================================

class Window_BattleStatus < Window_Base
  #-------------------------------------
  attr_accessor :highlight_index
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    super(200, 320, 440, 160)
    self.contents = Bitmap.new(width - 32, height - 32)   
    @level_up_flags = [false, false, false, false]
    @highlight_index = -1
    refresh
  end
  #--------------------------------------------------------------------------
  # ● 解放
  #--------------------------------------------------------------------------
  def dispose
    super
  end
  #--------------------------------------------------------------------------
  # ● レベルアップフラグの設定
  #    actor_index : アクターインデックス
  #--------------------------------------------------------------------------
  def level_up(actor_index)
    @level_up_flags[actor_index] = true
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    @item_max = $game_party.actors.size
    for i in 0...$game_party.actors.size
      if i == @highlight_index
        hi = true
      else
        hi = false
      end
      actor = $game_party.actors[i]
      actor_y = i * 32
      draw_actor_name(actor, 4, actor_y, hi)
      draw_actor_hp(actor, 100, actor_y, 144)
      draw_actor_sp(actor, 256, actor_y, 144)
    end
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  def update
    super
    # メインフェーズのときは不透明度をやや下げる
    if $game_temp.battle_main_phase
      self.contents_opacity = 255
    end
  end
end


class Window_MonsterName < Window_Base
  #------------------------------
  attr_accessor :type
  attr_accessor :id
  #--------------------------------------------------------------------------
  # Initialize the Object.
  #--------------------------------------------------------------------------
  def initialize
    super(0, 320, 200, 160)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.back_opacity = 255   
    self.z = 849   
    refresh
  end
  #--------------------------------------------------------------------------
  # Refresh.
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    display_y = 0
    monsters = 0
    for i in $game_troop.enemies
      if i.exist?
        monsters += 1
      end
    end
  if monsters <= 4
    self.contents.font.size = 24
    for i in $game_troop.enemies
      if i.exist?
        name = i.name
        self.contents.draw_text(4, display_y, 200, 32, name)
        display_y += 32
      end     
    end
  end
  if monsters == 5
    self.contents.font.size = 20
    for i in $game_troop.enemies
      if i.exist?
        name = i.name
        self.contents.draw_text(4, display_y, 200, 28, name)
        display_y += 24
      end     
    end
  end
    if monsters == 6
    self.contents.font.size = 16
    for i in $game_troop.enemies
      if i.exist?
        name = i.name
        self.contents.draw_text(4, display_y, 200, 28, name)
        display_y += 20
      end     
    end
  end
    if monsters == 7
    self.contents.font.size = 14
    for i in $game_troop.enemies
      if i.exist?
        name = i.name
        self.contents.draw_text(4, display_y, 200, 28, name)
        display_y += 18
      end     
    end
  end
    if monsters == 8
    self.contents.font.size = 10
    for i in $game_troop.enemies
      if i.exist?
        name = i.name
        self.contents.draw_text(4, display_y, 200, 28, name)
        display_y += 14
      end     
    end
    end
  end
  #--------------------------------------------------------------------------
  # Frame Update.
  #--------------------------------------------------------------------------
  def update
    super
  end
end


class Window_Base < Window
  def draw_actor_name(actor, x, y, highlight = false)
    if highlight
      self.contents.font.color = crisis_color
    else
      self.contents.font.color = normal_color
    end
    self.contents.draw_text(x, y, 120, 32, actor.name)
  end
end


#==============================================================================
# ** Scene_Battle (part 1)
#------------------------------------------------------------------------------
#  This class performs battle screen processing.
#==============================================================================

class Scene_Battle
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # Initialize each kind of temporary battle data
    $game_temp.in_battle = true
    $game_temp.battle_turn = 0
    $game_temp.battle_event_flags.clear
    $game_temp.battle_abort = false
    $game_temp.battle_main_phase = false
    $game_temp.battleback_name = $game_map.battleback_name
    $game_temp.forcing_battler = nil
    # Initialize battle event interpreter
    $game_system.battle_interpreter.setup(nil, 0)
    # Prepare troop
    @troop_id = $game_temp.battle_troop_id
    $game_troop.setup(@troop_id)
    # Make actor command window
    s1 = $data_system.words.attack
    s2 = $data_system.words.skill
    s3 = $data_system.words.guard
    s4 = $data_system.words.item
    @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4])
    @actor_command_window.y = 320
    @actor_command_window.back_opacity = 255
    @actor_command_window.active = false
    @actor_command_window.visible = false
    # Make other windows
    @party_command_window = Window_PartyCommand.new
    @help_window = Window_Help.new
    @help_window.back_opacity = 160
    @help_window.visible = false
    @status_window = Window_BattleStatus.new
    @effect_window = Window_BattleEffect.new
    @effect_window.visible = false
    @monster_window = Window_MonsterName.new
    @message_window = Window_Message.new
    # Make sprite set
    @spriteset = Spriteset_Battle.new
    # Initialize wait count
    @wait_count = 0
    # Execute transition
    if $data_system.battle_transition == ""
      Graphics.transition(20)
    else
      Graphics.transition(40, "Graphics/Transitions/" +
        $data_system.battle_transition)
    end
    # Start pre-battle phase
    start_phase1
    # Main loop
    loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      # Frame update
      update
      # Abort loop if screen is changed
      if $scene != self
        break
      end
    end
    # Refresh map
    $game_map.refresh
    # Prepare for transition
    Graphics.freeze
    # Dispose of windows
    @actor_command_window.dispose
    @party_command_window.dispose
    @help_window.dispose
    @status_window.dispose
    @monster_window.dispose
    @message_window.dispose
    if @skill_window != nil
      @skill_window.dispose
    end
    if @item_window != nil
      @item_window.dispose
    end
    if @result_window != nil
      @result_window.dispose
    end
    # Dispose of sprite set
    @spriteset.dispose
    # If switching to title screen
    if $scene.is_a?(Scene_Title)
      # Fade out screen
      Graphics.transition
      Graphics.freeze
    end
    # If switching from battle test to any screen other than game over screen
    if $BTEST and not $scene.is_a?(Scene_Gameover)
      $scene = nil
    end
  end

  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # If battle event is running
    if $game_system.battle_interpreter.running?
      # Update interpreter
      $game_system.battle_interpreter.update
      # If a battler which is forcing actions doesn't exist
      if $game_temp.forcing_battler == nil
        # If battle event has finished running
        unless $game_system.battle_interpreter.running?
          # Rerun battle event set up if battle continues
          unless judge
            setup_battle_event
          end
        end
        # If not after battle phase
        if @phase != 5
          # Refresh status window
          @status_window.refresh
        end
      end
    end
    # Update system (timer) and screen
    $game_system.update
    $game_screen.update
    # If timer has reached 0
    if $game_system.timer_working and $game_system.timer == 0
      # Abort battle
      $game_temp.battle_abort = true
    end
    # Update windows
    @help_window.update
    @party_command_window.update
    @actor_command_window.update
    @status_window.update
    @monster_window.update
    @message_window.update
    @effect_window.update
    # Update sprite set
    @spriteset.update
    # If transition is processing
    if $game_temp.transition_processing
      # Clear transition processing flag
      $game_temp.transition_processing = false
      # Execute transition
      if $game_temp.transition_name == ""
        Graphics.transition(20)
      else
        Graphics.transition(40, "Graphics/Transitions/" +
          $game_temp.transition_name)
      end
    end
    # If message window is showing
    if $game_temp.message_window_showing
      return
    end
    # If effect is showing
    if @spriteset.effect?
      return
    end
    # If game over
    if $game_temp.gameover
      # Switch to game over screen
      $scene = Scene_Gameover.new
      return
    end
    # If returning to title screen
    if $game_temp.to_title
      # Switch to title screen
      $scene = Scene_Title.new
      return
    end
    # If battle is aborted
    if $game_temp.battle_abort
      # Return to BGM used before battle started
      $game_system.bgm_play($game_temp.map_bgm)
      # Battle ends
      battle_end(1)
      return
    end
    # If waiting
    if @wait_count > 0
      # Decrease wait count
      @wait_count -= 1
      return
    end
    # If battler forcing an action doesn't exist,
    # and battle event is running
    if $game_temp.forcing_battler == nil and
      $game_system.battle_interpreter.running?
      return
    end
    # Branch according to phase
    case @phase
    when 1  # pre-battle phase
      update_phase1
    when 2  # party command phase
      update_phase2
    when 3  # actor command phase
      update_phase3
    when 4  # main phase
      update_phase4
    when 5  # after battle phase
      update_phase5
    end
  end
 
  #--------------------------------------------------------------------------
  # * Actor Command Window Setup
  #--------------------------------------------------------------------------
  def phase3_setup_command_window
    # Disable party command window
    @party_command_window.active = false
    @party_command_window.visible = false
    # Enable actor command window
    @actor_command_window.active = true
    @actor_command_window.visible = true
    # Set actor command window position
    @actor_command_window.x = 60
    @monster_window.z = 849
    @actor_command_window.z = 3000
    @status_window.highlight_index = @actor_index
    @status_window.refresh
    # Set index to 0
    @actor_command_window.index = 0
  end
 
  #--------------------------------------------------------------------------
  # * Make Skill Action Results
  #--------------------------------------------------------------------------
  def make_skill_action_result
    # Get skill
    @skill = $data_skills[@active_battler.current_action.skill_id]
    # If not a forcing action
    unless @active_battler.current_action.forcing
      # If unable to use due to SP running out
      unless @active_battler.skill_can_use?(@skill.id)
        # Clear battler being forced into action
        $game_temp.forcing_battler = nil
        # Shift to step 1
        @phase4_step = 1
        return
      end
    end
    # Use up SP
    @active_battler.sp -= @skill.sp_cost
    # Refresh status window
    @status_window.refresh
    # Show skill name on help window
    @effect_window.effect = @skill.name
    @effect_window.refresh
    @effect_window.visible = true
    #@help_window.set_text(@skill.name, 1)
    # Set animation ID
    @animation1_id = @skill.animation1_id
    @animation2_id = @skill.animation2_id
    # Set command event ID
    @common_event_id = @skill.common_event_id
    # Set target battlers
    set_target_battlers(@skill.scope)
    # Apply skill effect
    for target in @target_battlers
      target.skill_effect(@active_battler, @skill)
    end
  end
 
  #--------------------------------------------------------------------------
  # * Frame Update (main phase step 5 : damage display)
  #--------------------------------------------------------------------------
  def update_phase4_step5
    # Hide help window
    @help_window.visible = false
    @effect_window.visible = false
    # Refresh status window
    @status_window.refresh
    # Display damage
    for target in @target_battlers
      if target.damage != nil
        target.damage_pop = true
      end
    end
    # Shift to step 6
    @phase4_step = 6
  end
 
  def update_phase4_step6
    # Clear battler being forced into action
    $game_temp.forcing_battler = nil
    # If common event ID is valid
    if @common_event_id > 0
      # Set up event
      common_event = $data_common_events[@common_event_id]
      $game_system.battle_interpreter.setup(common_event.list, 0)
    end
    @monster_window.refresh
    # Shift to step 1
    @phase4_step = 1
  end
end

Who's 백호

?

이상혁입니다.

http://elab.kr

Atachment
첨부 '1'
Comment '4'

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 습작 2012.12.24 6153
901 이름입력 이름입력스크립트 ps인간 2009.01.23 3632
900 아이템 아이템창변경 27 카르닉스 2010.02.26 3631
899 타이틀/게임오버 타이틀 가기전에 오프닝 이벤트 시작하기?! 13 file 백호 2009.02.21 3629
898 기타 3d 렌더링스크립트 어렵게 찾음 9 라구나 2011.03.05 3610
» 전투 RPG Advocate의 데모에서 발췌한 사이드뷰용 전투상태창 4 file 백호 2009.02.22 3596
896 키입력 메세지 입력 스크립트. 25 file Bera 2010.10.18 3582
895 상점 상점 메뉴 개조시킨 스크립트 [한글] 35 file 백호 2009.02.21 3566
894 [ 무기 & 방어구 레벨제한 스크립트 ]엄청유용! ㅎ 24 file 제로스S2 2009.08.05 3554
893 타이틀/게임오버 타이틀 전에 로고 띄우기, 홈피 띄우기, 메일 보내기 13 file 유아 2009.01.09 3554
892 HUD 맵이름스크립트 52 file 이안 2010.01.17 3552
891 HUD xp대화창에 얼굴, 이름 넣기!! [방법두 있음] 3 백호 2009.02.21 3545
890 이동 및 탈것 그림자 스크립트 13 file 백호 2009.02.22 3540
889 전투 [신기술 체험] SRPG-Test 13 file 백호 2009.02.22 3536
888 메뉴 [메뉴] 간단한 형식의 CoaMenu2Scroll 버젼 20 file 코아 코스튬 2010.10.24 3526
887 전투 srpg용 스크립트라는데 4 세죠 2010.03.26 3524
886 전투 사이트뷰 전투 스크립트 (CBS R1) 8 file 백호 2009.02.21 3498
885 이동 및 탈것 새로운 픽셀 이동 스크립트 27 file 케나이 2010.04.10 3496
884 메뉴 링 메뉴 16 Neowitch* 2008.04.18 3478
883 전투 Mr. Mo's ABS 5.5 13 Alkaid 2010.09.10 3459
882 이동 및 탈것 반칸 이동하기 14 file 느싱 2009.03.09 3458
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ... 52 Next
/ 52