[RESOLVED]Leaderchange with a Call Script

Started by fjurio, January 31, 2011, 08:08:43 am

Previous topic - Next topic

fjurio

January 31, 2011, 08:08:43 am Last Edit: January 31, 2011, 10:21:04 am by fjurio
I looking for a call script for the BlizzABS that change the partyleader. (like you can do it with the "o"-button in the game)
Thanks in advance.

Blizzard

Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

fjurio

Great. Thanks, that should solve our problems.

Blizzard

Edit your first post and add [RESOLVED] before the title for future reference.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

The Niche

Level me down, I'm trying to become the anti-blizz!
Quote from: winkio on June 15, 2011, 07:30:23 pm
Ah, excellent.  You liked my amusing sideshow, yes?  I'm just a simple fool, my wit entertains the wise, and my wisdom fools the fools.



I'm like the bible, widely hated and beautifully quotable.

Dropbox is this way, not any other way!

Blizzard

Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

The Niche

I'd tell you again, but I've got something more pressing. To set it to a certain actor, would it be $BlizzABS.player.switch_leader_game_party.actors(4)
(Four being the party position of the actor I want in slot one)
Level me down, I'm trying to become the anti-blizz!
Quote from: winkio on June 15, 2011, 07:30:23 pm
Ah, excellent.  You liked my amusing sideshow, yes?  I'm just a simple fool, my wit entertains the wise, and my wisdom fools the fools.



I'm like the bible, widely hated and beautifully quotable.

Dropbox is this way, not any other way!

Blizzard

Just call $BlizzABS.player.switch_leader 3 times. That's the safest way to do it.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

elmangakac

Well if you need it...  someone gives me a script that allows you select the leader in a little window when you hit a button... in my case is ctrl... if you are dead... the windows appears and let you select the leader that continues...

module BlizzABS
 
 
  class Controller
 
    def update_control
      # get pixel movement rate
      pix = $BlizzABS.pixel
      # reset move speed
      player.move_speed = player.normal_speed
      # reset spriteset name
      player.character_name = player.character_name_org
      # if allowed to change speed
      unless $game_system.map_interpreter.running? ||
          player.move_route_forcing || $game_temp.message_window_showing
        # if run button works and running
        if $game_system.running_button && Input.press?(Input::Run)
          # set running speed
          player.move_speed = Config::RUN_SPEED
        # if sneak button works and sneaking
        elsif $game_system.sneaking_button && Input.press?(Input::Sneak) ||
            Config::SNEAK_SPEED > 0 && Config::SNEAK_ON_CHARGE && player.charging?
          # set sneaking speed
          player.move_speed = Config::SNEAK_SPEED
        end
      end
      # if battler exists and either dead or select triggered
      if player.battler != nil && ($game_system.select_button &&
          Input.trigger?(Input::Select) || player.battler.dead?)
        # switch to next valid actor
        $scene = Scene_Player_Select.new
      end
      # setup sprite animation
      player.sprite_animation_setup
      # update action
      player.update_action
      # if allowed to turn and pressed turning button or defending
      if ((player.ai.act.defend? && player.attacked == 0) ||
          $game_system.turn_button && Input.press?(Input::Turn)) &&
          !player.moving? && !$game_system.map_interpreter.running? &&
          !player.move_route_forcing && !$game_temp.message_window_showing
        # get input depending on confusion
        input = (player.restriction == 3 ? 10 - Input.dir4 : Input.dir4)
        # depending on input turn
        case input
        when 2 then player.turn_down
        when 4 then player.turn_left
        when 6 then player.turn_right
        when 8 then player.turn_up
        end
        # updates any attacked action
        player.update_attacked
        # abort method
        return nil
      end
      # updates any attacked action
      player.update_attacked
      # if acting
      if player.in_action > 0
        # decrease action counter if in_action is greater than 0
        player.in_action -= 1 if player.in_action > 0
        # return data
        return [player.moving?, player.real_x, player.real_y]
      end
      # if allowed to move
      unless $game_system.map_interpreter.running? ||
          player.move_route_forcing || $game_temp.message_window_showing
        # if jump button was pressed and not already jumping
        if $game_system.jumping_button && Input.trigger?(Input::Jump) &&
            !player.jumping? && player.restriction < 4
          # set to jump
          @memory_jump = true
        end
        # if not moving
        unless player.moving?
          # get jumping range
          range = Config::JUMPING
          # if jumping turned on and not jumping and jumped
          if range > 0 && !player.jumping? && @memory_jump
            # if sneaking or running is possible
            if Config::RUN_SPEED > 0 || Config::SNEAK_SPEED > 0
              # get difference between current speed and normal speed
              dplus = player.move_speed - player.normal_speed
            else
              # difference is 0
              dplus = 0
            end
            # get direction
            direction = $game_system._8_way ? Input.dir8 : Input.dir4
            # set jumping direction
            x, y = Cache::DirOffsets[direction]
            # jump into direction with considering running/sneaking
            player.jump(x*range + x*dplus, y*range + y*dplus, direction)
          # if not already jumping
          elsif !player.jumping?
            # move
            move($game_system._8_way ? Input.dir8 : Input.dir4)
            # allow idle if no movement
            player.idle_allowed = !player.moving?
          end
          # not jumping anymore
          @memory_jump = false
        end
      end
      # return data
      return [player.moving?, player.real_x, player.real_y]
    end
  end
end
#==============================================================================
# Scene Player Select
#==============================================================================
class Scene_Player_Select
   
  def main
    @spriteset = Spriteset_Map.new
    @change_char = Window_Player_Select.new
    @change_char.x = 320 - (@change_char.width / 2)
    @change_char.y = 240 - (@change_char.height / 2)
    # create HUD if HUD is turned on and HUD active
    @hud = Hud.new if BlizzABS::Config::HUD_ENABLED && $game_system.hud
    # if ASSIGNMENT is turned on and assignment display active
    if BlizzABS::Config::HOTKEYS && $game_system.hotkeys
      # create assignment display
      @hotkeys = Hotkey_Assignment.new
    end
    # if MINIMAP is turned on and minimap active
    if BlizzABS::Config::MINIMAP && $game_system.minimap > 0
      # create HUD
      @minimap = Minimap.new
      # create HUD
      @minimap.update
    end
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      break if $scene != self
    end
    Graphics.freeze
    [@hud, @hotkeys, @minimap].each {|s| s.dispose if s != nil}
    @change_char.dispose
    @spriteset.dispose
  end
 
  def update
    @change_char.update
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Map.new
    elsif Input.trigger?(Input::C)
      $game_system.se_play($data_system.decision_se)
      $game_party.swap_actor(@change_char.index)
      $scene = Scene_Map.new
    end
  end
 
end
#==============================================================================
# Window Plyer Select
#==============================================================================
class Window_Player_Select < Window_Selectable
 
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(350, 200, 150,($game_party.actors.size*32)+ 32)
    @column_max = 1
    refresh
    self.index = 0
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @item_max = $game_party.actors.size
    self.contents = Bitmap.new(width - 32, (@item_max*32))
    (0...@item_max).each{|i|draw_item(i)}
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #--------------------------------------------------------------------------
  def draw_item(index)
    name = $game_party.actors[index].name
    y = index * 32
    self.contents.draw_text(4, y, 100, 32, name.to_s)
  end
end
#==============================================================================
# Game_Party
#==============================================================================
class Game_Party
 
  def swap_actor(switch_id)
    hold = @actors[0]
    @actors[0] = @actors[switch_id]
    @actors[switch_id] = hold
    $game_player.refresh
  end
 
end






Put it below Bliz abs

The Niche

@Blizz: But that requires me to know how many are in the party at all times. This won't work for either mine or Fjurio's purpo- Oh. Right. There's a variable control for setting a variable equal to party members. Woops. [/overlook]
Level me down, I'm trying to become the anti-blizz!
Quote from: winkio on June 15, 2011, 07:30:23 pm
Ah, excellent.  You liked my amusing sideshow, yes?  I'm just a simple fool, my wit entertains the wise, and my wisdom fools the fools.



I'm like the bible, widely hated and beautifully quotable.

Dropbox is this way, not any other way!

Storm

Quote from: elmangakac on January 31, 2011, 12:49:28 pm
Well if you need it...  someone gives me a script that allows you select the leader in a little window when you hit a button... in my case is ctrl... if you are dead... the windows appears and let you select the leader that continues...

module BlizzABS
 
 
  class Controller
 
    def update_control
      # get pixel movement rate
      pix = $BlizzABS.pixel
      # reset move speed
      player.move_speed = player.normal_speed
      # reset spriteset name
      player.character_name = player.character_name_org
      # if allowed to change speed
      unless $game_system.map_interpreter.running? ||
          player.move_route_forcing || $game_temp.message_window_showing
        # if run button works and running
        if $game_system.running_button && Input.press?(Input::Run)
          # set running speed
          player.move_speed = Config::RUN_SPEED
        # if sneak button works and sneaking
        elsif $game_system.sneaking_button && Input.press?(Input::Sneak) ||
            Config::SNEAK_SPEED > 0 && Config::SNEAK_ON_CHARGE && player.charging?
          # set sneaking speed
          player.move_speed = Config::SNEAK_SPEED
        end
      end
      # if battler exists and either dead or select triggered
      if player.battler != nil && ($game_system.select_button &&
          Input.trigger?(Input::Select) || player.battler.dead?)
        # switch to next valid actor
        $scene = Scene_Player_Select.new
      end
      # setup sprite animation
      player.sprite_animation_setup
      # update action
      player.update_action
      # if allowed to turn and pressed turning button or defending
      if ((player.ai.act.defend? && player.attacked == 0) ||
          $game_system.turn_button && Input.press?(Input::Turn)) &&
          !player.moving? && !$game_system.map_interpreter.running? &&
          !player.move_route_forcing && !$game_temp.message_window_showing
        # get input depending on confusion
        input = (player.restriction == 3 ? 10 - Input.dir4 : Input.dir4)
        # depending on input turn
        case input
        when 2 then player.turn_down
        when 4 then player.turn_left
        when 6 then player.turn_right
        when 8 then player.turn_up
        end
        # updates any attacked action
        player.update_attacked
        # abort method
        return nil
      end
      # updates any attacked action
      player.update_attacked
      # if acting
      if player.in_action > 0
        # decrease action counter if in_action is greater than 0
        player.in_action -= 1 if player.in_action > 0
        # return data
        return [player.moving?, player.real_x, player.real_y]
      end
      # if allowed to move
      unless $game_system.map_interpreter.running? ||
          player.move_route_forcing || $game_temp.message_window_showing
        # if jump button was pressed and not already jumping
        if $game_system.jumping_button && Input.trigger?(Input::Jump) &&
            !player.jumping? && player.restriction < 4
          # set to jump
          @memory_jump = true
        end
        # if not moving
        unless player.moving?
          # get jumping range
          range = Config::JUMPING
          # if jumping turned on and not jumping and jumped
          if range > 0 && !player.jumping? && @memory_jump
            # if sneaking or running is possible
            if Config::RUN_SPEED > 0 || Config::SNEAK_SPEED > 0
              # get difference between current speed and normal speed
              dplus = player.move_speed - player.normal_speed
            else
              # difference is 0
              dplus = 0
            end
            # get direction
            direction = $game_system._8_way ? Input.dir8 : Input.dir4
            # set jumping direction
            x, y = Cache::DirOffsets[direction]
            # jump into direction with considering running/sneaking
            player.jump(x*range + x*dplus, y*range + y*dplus, direction)
          # if not already jumping
          elsif !player.jumping?
            # move
            move($game_system._8_way ? Input.dir8 : Input.dir4)
            # allow idle if no movement
            player.idle_allowed = !player.moving?
          end
          # not jumping anymore
          @memory_jump = false
        end
      end
      # return data
      return [player.moving?, player.real_x, player.real_y]
    end
  end
end
#==============================================================================
# Scene Player Select
#==============================================================================
class Scene_Player_Select
   
  def main
    @spriteset = Spriteset_Map.new
    @change_char = Window_Player_Select.new
    @change_char.x = 320 - (@change_char.width / 2)
    @change_char.y = 240 - (@change_char.height / 2)
    # create HUD if HUD is turned on and HUD active
    @hud = Hud.new if BlizzABS::Config::HUD_ENABLED && $game_system.hud
    # if ASSIGNMENT is turned on and assignment display active
    if BlizzABS::Config::HOTKEYS && $game_system.hotkeys
      # create assignment display
      @hotkeys = Hotkey_Assignment.new
    end
    # if MINIMAP is turned on and minimap active
    if BlizzABS::Config::MINIMAP && $game_system.minimap > 0
      # create HUD
      @minimap = Minimap.new
      # create HUD
      @minimap.update
    end
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      break if $scene != self
    end
    Graphics.freeze
    [@hud, @hotkeys, @minimap].each {|s| s.dispose if s != nil}
    @change_char.dispose
    @spriteset.dispose
  end
 
  def update
    @change_char.update
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Map.new
    elsif Input.trigger?(Input::C)
      $game_system.se_play($data_system.decision_se)
      $game_party.swap_actor(@change_char.index)
      $scene = Scene_Map.new
    end
  end
 
end
#==============================================================================
# Window Plyer Select
#==============================================================================
class Window_Player_Select < Window_Selectable
 
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(350, 200, 150,($game_party.actors.size*32)+ 32)
    @column_max = 1
    refresh
    self.index = 0
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @item_max = $game_party.actors.size
    self.contents = Bitmap.new(width - 32, (@item_max*32))
    (0...@item_max).each{|i|draw_item(i)}
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #--------------------------------------------------------------------------
  def draw_item(index)
    name = $game_party.actors[index].name
    y = index * 32
    self.contents.draw_text(4, y, 100, 32, name.to_s)
  end
end
#==============================================================================
# Game_Party
#==============================================================================
class Game_Party
 
  def swap_actor(switch_id)
    hold = @actors[0]
    @actors[0] = @actors[switch_id]
    @actors[switch_id] = hold
    $game_player.refresh
  end
 
end






Put it below Bliz abs

Awesome! *chucked it in the script bucket*
I was working on the game called The Orion.
It would be nice if you can join our small community by sharing a little by little scripts/ideas at The Orion Forum

I am: RPG Maker XP Scripter
Project Working On: The Orion MMORPG Game, visit The Orion Forum for more information!
Visit my: Deviantart

LEVEL ME UP OR ELSE LEVEL ME DOWN, IT'S EASY! XD