Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Cross Commands
#1
Cross Commands
by Blazingamer

Introduction:
I modeled a cross command system for battle since my brother likes them. So in my spare time I made it.

The Script:

Code:
#==============================================================================
#  CrossCommand
#  
#   Blazingamer
#  -----------------------------------------
#   Makes a pretty command window in a shape of a cross like in Wild Arms
#==============================================================================

class CrossCommand < Window_Selectable

  def initialize
    super(320 - 128, 160 - 128, 256, 256)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 0
    @commands = ["attack", "magic","defend","items","run away"]
    @item_max = 5
    draw_item(0, 32,32,"Attack")
    draw_item(1, 32,0, "Magic")
    draw_item(2, 64,32,"Defend")
    draw_item(3, 0,32, "Items")
    draw_item(4, 32,64, "Run")
    self.active = false
    self.visible = false
    self.index = 0
  end

  def draw_item(index, x, y, icon)  
    bitmap = RPG::Cache.icon(icon)
    self.contents.blt(x, y, bitmap, Rect.new(0, 0, 32, 32))
  end

  def update_cursor_rect
    if index == 3
      self.cursor_rect.set(0, 32, 32, 32)
    elsif index == 2
      self.cursor_rect.set(64, 32, 32, 32)
    elsif index == 1
       self.cursor_rect.set(32,0,32,32)
    elsif index == 4
       self.cursor_rect.set(32,64,32,32)
    else
       self.cursor_rect.set(32,32,32,32)
    end
    if Input.press?(Input::LEFT)
      @index = 3
    elsif Input.press?(Input::RIGHT)
      @index = 2
    elsif Input.press?(Input::UP)
      @index = 1
    elsif Input.press?(Input::DOWN)
      @index = 4
    else
      @index = 0
    end
  end
end

class Scene_Battle
  
  def update_phase3_basic_command
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      phase3_prior_actor
      return
    end
    if Input.trigger?(Input::C)
      case @actor_command_window.index
      when 0
        $game_system.se_play($data_system.decision_se)
        @active_battler.current_action.kind = 0
        @active_battler.current_action.basic = 0
        start_enemy_select
      when 1
        $game_system.se_play($data_system.decision_se)
        @active_battler.current_action.kind = 1
        start_skill_select
      when 2
        $game_system.se_play($data_system.decision_se)
        @active_battler.current_action.kind = 0
        @active_battler.current_action.basic = 1
        phase3_next_actor
      when 3
        $game_system.se_play($data_system.decision_se)
        @active_battler.current_action.kind = 2
        start_item_select
      when 4
        enemies_agi = 0
        enemies_number = 0
        for enemy in $game_troop.enemies
          if enemy.exist?
            enemies_agi += enemy.agi
            enemies_number += 1
          end
        end
        if enemies_number > 0
          enemies_agi /= enemies_number
        end
        actors_agi = 0
        actors_number = 0
        for actor in $game_party.actors
          if actor.exist?
            actors_agi += actor.agi
            actors_number += 1
          end
        end
        if actors_number > 0
          actors_agi /= actors_number
        end
        success = rand(100) < 50 * actors_agi / enemies_agi
        if success
          $game_system.se_play($data_system.escape_se)
          $game_system.bgm_play($game_temp.map_bgm)
          battle_end(1)
        else
          $game_party.clear_actions
          start_phase4
        end
      end
      return
    end
  end
end
Instead of using pictures, it uses 32 x 32 pixels icons. You can change the size of the icons to what ever size you want, but it will take a bit of adjustments in the script.

Instructions:

To use it in battle, replace

Code:
@actor_command_window = Window_Command.new(160, [s1, s2, s3, s4])
with

Code:
@actor_command_window = CrossCommand.new
To use it, you can either make your own icons or if you want, use these provided for you

[Image: post-4874-1186159701.png]
[Image: post-4874-1186159758.png]
[Image: post-4874-1186159745.png]
[Image: post-4874-1186159727.png]
[Image: post-4874-1186159715.png]

FAQ:

Q:
Why can't I select commands other than attack?
A: You must hold down the directional key to select.

Q: Why when I press up it flashes between the two?
A: I have no freakin' idea, so don't ask.

Thank you, have a nice day!
Reply }


Possibly Related Threads…
Thread Author Replies Views Last Post
   Individual Battle Commands by Charlie Fleed, Version 1.0 Charlie Fleed 3 10,165 01-25-2014, 12:15 PM
Last Post: Charlie Fleed
   Individual Battle Commands RPG Advocate 4 9,710 10-09-2011, 04:44 AM
Last Post: DerVVulfman
   Advanced Individual Battle Commands Trickster 6 14,414 01-29-2011, 04:30 AM
Last Post: DerVVulfman
   Custom Commands Dargor 0 4,326 03-07-2008, 04:27 AM
Last Post: Dargor
   Skill Update / Tactical Commands Patch DerVVulfman 0 4,278 03-04-2008, 05:55 AM
Last Post: DerVVulfman
   Trickster's Bag of Battle Commands Trickster 0 4,807 03-02-2008, 07:04 AM
Last Post: Trickster



Users browsing this thread: