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.

Party Changing Script

First of all some screenshots which explain this script.
partychanging01.png

partychanging02.png

Wow 8 people (4 in battle)
partychanging03.png

I can go over to the characters pushing left or right!
partychanging04.png

I have now clicked on Gloria...
partychanging05.png

I am about to click on that green haired person.
partychanging06.png

THEY SWAPPED PLACES!!!

I hope the screenshots explained how to use this script...

Now for the script:
Code:
class Game_Party

  

  Max_Party_Size = 8

  

  def max_party_size

    return Max_Party_Size

  end

  

  def add_actor(actor_id)

    actor = $game_actors[actor_id]

    if not @actors.include?(actor) and $game_party.actors.size < Max_Party_Size

      @actors.push(actor)

      $game_player.refresh

    end

  end

  

  def all_dead?

    if $game_party.actors.size == 0

      return false

    end

    for actor in @actors

      if actor.hp > 0

        return false

      end

      if actor.index >= 4

        return true

      end

    end

    return true

  end

end

 

class Scene_Menu

  

  alias party_swap_update_command update_command

  def update_command

    party_swap_update_command

    if Input.trigger?(Input::LEFT) or Input.trigger?(Input::RIGHT)

      $game_system.se_play($data_system.cursor_se)

      @previous_index = @command_window.index

      @command_window.index = -1

      @command_window.active = false

      @status_window.active = true

      @status_window.index = @status_window.top_row

      return

    end

  end

  

  alias party_swap_update_status update_status

  def update_status

    if Input.trigger?(Input::B)

      unless @swapee != nil

        $game_system.se_play($data_system.cancel_se)

        if @command_window.index == -1

          @command_window.index = @previous_index

        end

        @command_window.active = true

        @status_window.active = false

        @status_window.index = -1

        return

      end

      @swapee = nil

      return

    end

    if Input.trigger?(Input::C) and @command_window.index == -1

      unless @swapee != nil

        @swapee = @status_window.index

        $game_system.se_play($data_system.decision_se)

        return

      end

      if @swapee == @status_window.index

        $game_system.se_play($data_system.decision_se)

        @swapee = nil

        return

      end

      $game_system.se_play($data_system.decision_se)

      party_ids = []

      for actor in $game_party.actors

        party_ids.push(actor.id)

      end

      swapee2 = @status_window.index

      if @swapee < swapee2

        for i in @swapee...party_ids.size

          $game_party.remove_actor(party_ids[i])

        end

        $game_party.add_actor(party_ids[swapee2])

        for i in (@swapee + 1)...party_ids.size

          unless i == swapee2

            $game_party.add_actor(party_ids[i])

          else

            $game_party.add_actor(party_ids[@swapee])

          end

        end

      else

        for i in swapee2...party_ids.size

          $game_party.remove_actor(party_ids[i])

        end

        $game_party.add_actor(party_ids[@swapee])

        for i in (swapee2 + 1)...party_ids.size

          unless i == @swapee

            $game_party.add_actor(party_ids[i])

          else

            $game_party.add_actor(party_ids[swapee2])

          end

        end

      end

      @swapee = nil

      @status_window.refresh

      return

    end

    if Input.trigger?(Input::LEFT) or Input.trigger?(Input::RIGHT)

      if @swapee == nil and @command_window.index == -1

        $game_system.se_play($data_system.cursor_se)

        @command_window.index = @previous_index

        @command_window.active = true

        @status_window.active = false

        @status_window.index = -1

      end

    end

    party_swap_update_status

  end

  

  

end

 

class Window_MenuStatus < Window_Selectable

  

  def initialize

    unless $game_party.actors.size > 4

      super(0, 0, 480, 480)

    else

      super(0, 0, 480, 160 * $game_party.actors.size)

    end

    self.contents = Bitmap.new(width - 32, height - 32)

    refresh

    self.active = false

    self.index = -1

  end

  

  alias large_refresh refresh

  def refresh

    large_refresh

    self.height = 480

  end

  

  def update_cursor_rect

    if @index < 0

      self.cursor_rect.empty

      return

    end

    row = @index / @column_max

    if row < self.top_row

      self.top_row = row

    end

    if row > self.top_row + (self.page_row_max - 1)

      self.top_row = row - (self.page_row_max - 1)

    end

    cursor_width = self.width / @column_max - 32

    x = @index % @column_max * (cursor_width + 32)

    y = @index / @column_max * 116 - self.oy

    self.cursor_rect.set(x, y, cursor_width, 96)

  end

  

  def top_row

    return self.oy / 116

  end

  

  def top_row=(row)

    if row < 0

      row = 0

    end

    if row > row_max - 1

      row = row_max - 1

    end

    self.oy = row * 116

  end

  

  def page_row_max

    return 4

  end

end

 

class Scene_Battle

  def phase3_next_actor

    begin

      if @active_battler != nil

        @active_battler.blink = false

      end

      if @actor_index == ([$game_party.actors.size, 4].min - 1)

        start_phase4

        return

      end

      @actor_index += 1

      @active_battler = $game_party.actors[@actor_index]

      @active_battler.blink = true

    end until @active_battler.inputable?

    phase3_setup_command_window

  end

  

end

 

class Game_Actor < Game_Battler

  def exist?

    return super == self.index < 4

  end

end

 

 
On line 3
Code:
Max_Party_Size = 8
Change the 8 to the maximum party size.

I plan to merge this with my large party script to allow parties like 3 in battle and 6 in menu for example.
 
Being as there are no new posts I guess this is double posting but ohwell being as otherwise no one will see this add-on which was requested a fair amount of times.

Code:
class Game_Party
  
  attr_accessor   :locked
  
  alias locked_initialize initialize
  def initialize
    locked_initialize
    @locked = [8]
  end
  
end

class Scene_Menu
  
  alias locked_update update
  def update
    if @locked_window != nil
      if Input.trigger?(Input::B) or Input.trigger?(Input::C)
        @locked_window.dispose
        @locked_window = nil
      end
      return
    end
    locked_update
  end
  
  alias locked_update_command update_command
  def update_command
    if Input.trigger?(Input::B)
      if $game_party.locked == [] or $game_party.actors.size <= 4 or $game_party.locked.size > 4
        $game_system.se_play($data_system.cancel_se)
        $scene = Scene_Map.new
        return
      end
      locked = $game_party.locked.clone
      for i in 0...4
        locked.delete($game_party.actors[i].id)
      end
      if locked == []
        $game_system.se_play($data_system.cancel_se)
        $scene = Scene_Map.new
      else
        $game_system.se_play($data_system.buzzer_se)
        @locked_window = Locked.new($game_actors[locked[0]])
      end
      return
    end
    locked_update_command
  end
  
end



class Locked < Window_Base
  
  def initialize(actor)
    super(((640 - 460)/2), ((480 - 70)/2), 460, 70)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.z = 5000
    @actor = actor
    refresh
  end
  
  def refresh
    self.contents.clear
    text = @actor.name + ' needs to be in the active party'
    self.contents.draw_text(4, 0, 460, 32, text)
  end
end
By default this forces the player to always have to have Hilda in the battle party (8th character).
Code:
@locked = [8]
Is the line you need to change to affect the defualt party.
Other than that
Code:
$game_party.locked.push(1) # As if you'd lock Aluxes
$game_party.locked.delete(1) # That's more like it

I hope this helps all you people who requested this.
 
Awesome! I've been looking for something like this for a while now.
A simple party changing script that also lets you change the onscreen character (by switching the first person) and it seems that you add characters to the party the normal way, but it's different because of the script. When I tested it out, I had a party of 4...I went to the five party member, who joins after spoken too, and after he joined...I went on the status screen and there he was. So you add characters to the "party" the normal way? Do you remove them the same way?

And how does that add-on work? Do I just stick it on the same space as the first script or what? And what does those two things at the end do? Are those call scripts? Like, if I wanted to make character #7 forced in the battle party for an area, is that how I would do that?

Anyway, this is a nice script, just what I was looking for in a party changing script! I'll probably use this in more than one project!
 
Yes it was designed so you could use the events mostly so add/remove characters like normal, with my add-ons you always put it below the original script and above main. To lock characters your guess of using the call script event was correct.

And to force character 7 to be in the battle party:
Code:
$game_party.locked.delete(7)

And when you no longer wanted him in the party:
Code:
$game_party.locked.push(7)
 

Juuhou

Sponsor

Is this compatible with just the default menu? So say if I changed up the menu, like moved around just about everything, would it still be compatible?
 
Juuhou;113368 said:
Is this compatible with just the default menu? So say if I changed up the menu, like moved around just about everything, would it still be compatible?

You'd need to merge it I'm afraid.
 
Code:
class Window_MenuStatus < Window_Selectable
  
  def draw_actor_name(actor, x, y)
    self.contents.font.color = normal_color
    self.contents.draw_text(x, y, 120, 32, actor.name)
    if actor.index < 4
      bitmap = RPG::Cache.icon('001-Weapon01')
      opacity = self.contents.font.color == normal_color ? 255 : 128
      self.contents.blt(x + 120, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
    end
  end
  
end

You did Fomar before the site was hacked.
 
he did what? oh and Fomar did i mention you are god yet? you have so many scripts i need T_T thanks a bazillion!

EDIT!!!::::

NOOOOOOOOOO!!O!O!O!O!O!O!O i cant play fomors game i get an error about some RGSS stuffz
 

Juuhou

Sponsor

Fomar0153;113512 said:
You'd need to merge it I'm afraid.

Em, what do you mean? It is just moving around the default menu. Unless you mean that I would have to move around the info accordingly within the script as well. Then I knew that was bound to happen, I just want to make sure it wouldnt cause any errors. Well there's no better way than to try it so Ill do just that and report any errors.
 
XP Learner;113692 said:
You did Fomar before the site was hacked.

Oh thanks for re-posting that.

Ramenuzumaki;113695 said:
he did what? oh and Fomar did i mention you are god yet? you have so many scripts i need T_T thanks a bazillion!

It makes an icon appear by the battle party's names in the menu.

Ramenuzumaki;113695 said:
NOOOOOOOOOO!!O!O!O!O!O!O!O i cant play fomors game i get an error about some RGSS stuffz

Can you tell me the error, so I can investigate it and hopefully correct it.

Juuhou;113725 said:
Em, what do you mean? It is just moving around the default menu. Unless you mean that I would have to move around the info accordingly within the script as well. Then I knew that was bound to happen, I just want to make sure it wouldnt cause any errors. Well there's no better way than to try it so Ill do just that and report any errors.

Actually what you've done may not need merging at all, this may work with no editing, try it.
 

Juuhou

Sponsor

Whoa...well for some reason when I get more than 4 members it wont show up on my menu. Like you cant scroll down to the 5th member which is a bummer. On the plus side, Ive been wanting to do something like this. Being able to change the battle formation within the menu...so cool! :P So I can have different characters as the map character. Really cool. Although, I wouldnt mind getting it to fully work, seeing how the party changer is simple and really effective. Also with the added *you cant switch this character* it makes it perfect. No need for those fancy ones that take forever to integrate T_T :P
 
Juuhou;113950 said:
No need for those fancy ones that take forever to integrate T_T :P

You think scripts take a long time to integrate try hyperbolic functions. That's my maths joke for the day.

Do you have a CMS? If so then that's probably the problem, post it here and I'll see what I can do.
 

Juuhou

Sponsor

Its not really a CMS. I just moved around some stuff within the default system to make it look like how I wanted it. I just edited it through the SDK...

And yes, hyperbolic functions are annoying.
 
Wow i really need this script

Dear Fomar can you help to add the Script to Chrono CMS ?
cause i use it for my game and i really want to use your script also ( cause my party is 9 People thehehe)

cause i didnt so expert in script its really help if you can give me the demo

thank you
 
Juuhou;114348 said:
Its not really a CMS. I just moved around some stuff within the default system to make it look like how I wanted it. I just edited it through the SDK...

I would have thought this script would work if it was posted below the SDK.

japanrock;114454 said:
Wow i really need this script

Dear Fomar can you help to add the Script to Chrono CMS ?
cause i use it for my game and i really want to use your script also ( cause my party is 9 People thehehe)

cause i didnt so expert in script its really help if you can give me the demo

thank you

I haven't seen that CMS, post a link.
 
dear fomar
can you tell me how to put your script to that Icon?
So when i Click that icon i can Call Your Script in My windows menu
cause i dont know much about script
Thank you for read my Post
 

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