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 6202
34 전투 Trickster씨의 전투 시스템 (SDK 필수?) Alkaid 2012.09.18 3261
33 전투 캐릭터고르기스크립트? ps인간 2009.01.23 3264
32 전투 간단 액알 사용법(3번째) 12 file 백호 2009.02.21 3337
31 전투 흠.. 아직도 이 스크립트가 없군요 ㅋㅋ(제가올림..) 1 file 백호 2009.02.21 3337
30 전투 ATB전투 5 백호 2009.02.22 3369
29 전투 CTB by Charlie Fleed 3.2 - FF10 스타일의 전투 시스템 7 Alkaid 2010.10.14 3450
28 전투 Mr. Mo's ABS 5.5 13 Alkaid 2010.09.10 3459
27 전투 펫 시스템(ABS 3.4v포함) 23 file 백호 2009.02.22 3462
26 전투 사이트뷰 전투 스크립트 (CBS R1) 8 file 백호 2009.02.21 3499
25 전투 srpg용 스크립트라는데 4 세죠 2010.03.26 3524
24 전투 [신기술 체험] SRPG-Test 13 file 백호 2009.02.22 3540
» 전투 RPG Advocate의 데모에서 발췌한 사이드뷰용 전투상태창 4 file 백호 2009.02.22 3599
22 전투 보행그래픽으로 싸우는 턴알 17 백호 2009.02.22 3782
21 전투 XAS Hero Edition Ver. 3.91 3 프리즌커피 2011.12.23 3899
20 전투 RTAB 1.16ver 12 file 백호 2009.02.22 3962
19 전투 일본사이트에서 찾은 턴제 스크립트 23 file 백호 2009.02.21 3997
18 전투 Blizz-ABS 1.95 27 아방스 2008.03.05 4028
17 전투 xas히어로에디션 3.4 14 ps인간 2009.01.04 4044
16 전투 중복일지도 모르는 ATB 전투 11 file 백호 2009.02.22 4057
15 전투 에너미들도 게이지바 달고싶다~!! 14 file 백호 2009.02.21 4100
Board Pagination Prev 1 2 3 4 5 6 7 8 9 Next
/ 9