Party Changing Script

First of all some screenshots which explain this script.
Fomar's Screenshots Spoiler
Image
Image
Wow 8 people (4 in battle)
Image
I can go over to the characters pushing left or right!
Image
I have now clicked on Gloria...
Image
I am about to click on that green haired person.
Image
THEY SWAPPED PLACES!!!


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

Now for the script:
  1. class Game_Party
  2.  
  3.   Max_Party_Size = 8
  4.  
  5.   def max_party_size
  6.     return Max_Party_Size
  7.   end
  8.  
  9.   def add_actor(actor_id)
  10.     actor = $game_actors[actor_id]
  11.     if not @actors.include?(actor) and $game_party.actors.size < Max_Party_Size
  12.       @actors.push(actor)
  13.       $game_player.refresh
  14.     end
  15.   end
  16.  
  17.   def all_dead?
  18.     if $game_party.actors.size == 0
  19.       return false
  20.     end
  21.     for actor in @actors
  22.       if actor.hp > 0
  23.         return false
  24.       end
  25.       if actor.index >= 4
  26.         return true
  27.       end
  28.     end
  29.     return true
  30.   end
  31. end
  32.  
  33. class Scene_Menu
  34.  
  35.   alias party_swap_update_command update_command
  36.   def update_command
  37.     party_swap_update_command
  38.     if Input.trigger?(Input::LEFT) or Input.trigger?(Input::RIGHT)
  39.       $game_system.se_play($data_system.cursor_se)
  40.       @previous_index = @command_window.index
  41.       @command_window.index = -1
  42.       @command_window.active = false
  43.       @status_window.active = true
  44.       @status_window.index = @status_window.top_row
  45.       return
  46.     end
  47.   end
  48.  
  49.   alias party_swap_update_status update_status
  50.   def update_status
  51.     if Input.trigger?(Input::B)
  52.       unless @swapee != nil
  53.         $game_system.se_play($data_system.cancel_se)
  54.         if @command_window.index == -1
  55.           @command_window.index = @previous_index
  56.         end
  57.         @command_window.active = true
  58.         @status_window.active = false
  59.         @status_window.index = -1
  60.         return
  61.       end
  62.       @swapee = nil
  63.       return
  64.     end
  65.     if Input.trigger?(Input::C) and @command_window.index == -1
  66.       unless @swapee != nil
  67.         @swapee = @status_window.index
  68.         $game_system.se_play($data_system.decision_se)
  69.         return
  70.       end
  71.       if @swapee == @status_window.index
  72.         $game_system.se_play($data_system.decision_se)
  73.         @swapee = nil
  74.         return
  75.       end
  76.       $game_system.se_play($data_system.decision_se)
  77.       party_ids = []
  78.       for actor in $game_party.actors
  79.         party_ids.push(actor.id)
  80.       end
  81.       swapee2 = @status_window.index
  82.       if @swapee < swapee2
  83.         for i in @swapee...party_ids.size
  84.           $game_party.remove_actor(party_ids[i])
  85.         end
  86.         $game_party.add_actor(party_ids[swapee2])
  87.         for i in (@swapee + 1)...party_ids.size
  88.           unless i == swapee2
  89.             $game_party.add_actor(party_ids[i])
  90.           else
  91.             $game_party.add_actor(party_ids[@swapee])
  92.           end
  93.         end
  94.       else
  95.         for i in swapee2...party_ids.size
  96.           $game_party.remove_actor(party_ids[i])
  97.         end
  98.         $game_party.add_actor(party_ids[@swapee])
  99.         for i in (swapee2 + 1)...party_ids.size
  100.           unless i == @swapee
  101.             $game_party.add_actor(party_ids[i])
  102.           else
  103.             $game_party.add_actor(party_ids[swapee2])
  104.           end
  105.         end
  106.       end
  107.       @swapee = nil
  108.       @status_window.refresh
  109.       return
  110.     end
  111.     if Input.trigger?(Input::LEFT) or Input.trigger?(Input::RIGHT)
  112.       if @swapee == nil and @command_window.index == -1
  113.         $game_system.se_play($data_system.cursor_se)
  114.         @command_window.index = @previous_index
  115.         @command_window.active = true
  116.         @status_window.active = false
  117.         @status_window.index = -1
  118.       end
  119.     end
  120.     party_swap_update_status
  121.   end
  122.  
  123.  
  124. end
  125.  
  126. class Window_MenuStatus < Window_Selectable
  127.  
  128.   def initialize
  129.     unless $game_party.actors.size > 4
  130.       super(0, 0, 480, 480)
  131.     else
  132.       super(0, 0, 480, 160 * $game_party.actors.size)
  133.     end
  134.     self.contents = Bitmap.new(width - 32, height - 32)
  135.     refresh
  136.     self.active = false
  137.     self.index = -1
  138.   end
  139.  
  140.   alias large_refresh refresh
  141.   def refresh
  142.     large_refresh
  143.     self.height = 480
  144.   end
  145.  
  146.   def update_cursor_rect
  147.     if @index < 0
  148.       self.cursor_rect.empty
  149.       return
  150.     end
  151.     row = @index / @column_max
  152.     if row < self.top_row
  153.       self.top_row = row
  154.     end
  155.     if row > self.top_row + (self.page_row_max - 1)
  156.       self.top_row = row - (self.page_row_max - 1)
  157.     end
  158.     cursor_width = self.width / @column_max - 32
  159.     x = @index % @column_max * (cursor_width + 32)
  160.     y = @index / @column_max * 116 - self.oy
  161.     self.cursor_rect.set(x, y, cursor_width, 96)
  162.   end
  163.  
  164.   def top_row
  165.     return self.oy / 116
  166.   end
  167.  
  168.   def top_row=(row)
  169.     if row < 0
  170.       row = 0
  171.     end
  172.     if row > row_max - 1
  173.       row = row_max - 1
  174.     end
  175.     self.oy = row * 116
  176.   end
  177.  
  178.   def page_row_max
  179.     return 4
  180.   end
  181. end
  182.  
  183. class Scene_Battle
  184.   def phase3_next_actor
  185.     begin
  186.       if @active_battler != nil
  187.         @active_battler.blink = false
  188.       end
  189.       if @actor_index == ([$game_party.actors.size, 4].min - 1)
  190.         start_phase4
  191.         return
  192.       end
  193.       @actor_index += 1
  194.       @active_battler = $game_party.actors[@actor_index]
  195.       @active_battler.blink = true
  196.     end until @active_battler.inputable?
  197.     phase3_setup_command_window
  198.   end
  199.  
  200. end
  201.  
  202. class Game_Actor < Game_Battler
  203.   def exist?
  204.     return super == self.index < 4
  205.   end
  206. end
  207.  
  208.  
Expand to see the code.

On line 3
  1. Max_Party_Size = 8
Expand to see the code.

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.

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
Expand to see the code.

By default this forces the player to always have to have Hilda in the battle party (8th character).
@locked = [8]
Expand to see the code.

Is the line you need to change to affect the defualt party.
Other than that
$game_party.locked.push(1) # As if you'd lock Aluxes
$game_party.locked.delete(1) # That's more like it
Expand to see the code.


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:
$game_party.locked.delete(7)
Expand to see the code.


And when you no longer wanted him in the party:
$game_party.locked.push(7)
Expand to see the code.
ack how do you delete a post? T_T
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?
[QUOTE=Juuhou;113368]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?[/QUOTE]

You'd need to merge it I'm afraid.
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
Expand to see the code.


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
[QUOTE=Fomar0153;113512]You'd need to merge it I'm afraid.[/QUOTE]

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.
[QUOTE=XP Learner;113692]You did Fomar before the site was hacked.[/QUOTE]

Oh thanks for re-posting that.

[QUOTE=Ramenuzumaki;113695]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![/QUOTE]

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

[QUOTE=Ramenuzumaki;113695]
NOOOOOOOOOO!!O!O!O!O!O!O!O i cant play fomors game i get an error about some RGSS stuffz[/QUOTE]

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

[QUOTE=Juuhou;113725]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.[/QUOTE]

Actually what you've done may not need merging at all, this may work with no editing, try it.
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
[QUOTE=Juuhou;113950]No need for those fancy ones that take forever to integrate T_T :P[/QUOTE]

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.
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
[QUOTE=Juuhou;114348]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...[/QUOTE]

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

[QUOTE=japanrock;114454]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[/QUOTE]

I haven't seen that CMS, post a link.
This is A link To Chrono CMS
http://www.hbgames.org/forums/showthread.php?t=8683
and i need Your party Changing inside this CMS can you do that?

lets say when i click this Party Icon then link it to your Party Changing Display
[ATTACH]784[/ATTACH]

Thank you for quick reply
Oh, this is really cool. Where do you put the add-on? Do you just paste over the original script?
The add-on goes below the original script.
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
Hey, I just noticed something. It seems that everyone in the party gets equal experience, even if they aren't in the battle.

Is there any way to make it so only the battle party gets experience? And is it possible to make it so the non-combatants get experience, but much less than those in battle?

See, for me...giving experience points to characters that aren't in the battle is convenient, but I don't like the idea of characters gaining levels and getting stronger without doing anything...and I like this script. So I was wondering how to go about doing this...
[QUOTE=Armor King 108;119648]Hey, I just noticed something. It seems that everyone in the party gets equal experience, even if they aren't in the battle.

Is there any way to make it so only the battle party gets experience? And is it possible to make it so the non-combatants get experience, but much less than those in battle?

See, for me...giving experience points to characters that aren't in the battle is convenient, but I don't like the idea of characters gaining levels and getting stronger without doing anything...and I like this script. So I was wondering how to go about doing this...[/QUOTE]

class Scene_Battle
 
  def start_phase5
    @phase = 5
    $game_system.me_play($game_system.battle_end_me)
    $game_system.bgm_play($game_temp.map_bgm)
    exp = 0
    gold = 0
    treasures = []
    for enemy in $game_troop.enemies
      unless enemy.hidden
        exp += enemy.exp
        gold += enemy.gold
        if rand(100) < enemy.treasure_prob
          if enemy.item_id > 0
            treasures.push($data_items[enemy.item_id])
          end
          if enemy.weapon_id > 0
            treasures.push($data_weapons[enemy.weapon_id])
          end
          if enemy.armor_id > 0
            treasures.push($data_armors[enemy.armor_id])
          end
        end
      end
    end
    treasures = treasures[0..5]
    for i in 0...$game_party.actors.size
      actor = $game_party.actors[i]
      if actor.cant_get_exp? == false
        if i < 4
          last_level = actor.level
          actor.exp += exp
          if actor.level > last_level
            @status_window.level_up(i)
          end
        else
          actor.exp += (exp / 2) # EDIT THIS LINE
          # At the moment actors not in battle gain 50% of the exp
        end
      end
    end
    $game_party.gain_gold(gold)
    for item in treasures
      case item
      when RPG::Item
        $game_party.gain_item(item.id, 1)
      when RPG::Weapon
        $game_party.gain_weapon(item.id, 1)
      when RPG::Armor
        $game_party.gain_armor(item.id, 1)
      end
    end
    @result_window = Window_BattleResult.new(exp, gold, treasures)
    @phase5_wait_count = 100
  end
end
Expand to see the code.


[QUOTE=japanrock;119582]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[/QUOTE]

I'm guessing you don't know that it is over 2000 lines long?
I had already started merging them but I'm probably not going to finish by tonight (and then I go on holiday for christmas) so you'll just have to wait.
I'm guessing you don't know that it is over 2000 lines long?
yes thats right in fact i dont know anything hahahaha.. sorry i dont mean to rush..

i'm very happy if you can make that happend to my project
its not a problem for me to wait cause i'm the one who need your help
but dont forget about me hehehehe
I hope you enjoy your Holiday .. Thanks for read my Post
Really sorry for asking such a stupid question, but I was trying to implement an 8 person party in my game using this script. I've tried to read a few FAQs on scripting and whatnot, but I still haven't been able to figure out where exactly to put all of the necessary information. I see that Fomar's on vacation, but would anyone be able to point out where to place this at? Sorry again for asking this, I know it's the type of question that annoys most people.
Nice script you got there, Fomar. But I encountered some error while testing it.

If my party has more than 4 characters (6 in my case), I can't get a game over scene. I tried fighting a powerful opponent, but once all my party members all wiped out the game still has the 'Fight' and 'Escape' option and won't let the 'Game Over' screen appear.

Can you please help me with my problem?
[QUOTE=Tierra;120787]Really sorry for asking such a stupid question, but I was trying to implement an 8 person party in my game using this script. I've tried to read a few FAQs on scripting and whatnot, but I still haven't been able to figure out where exactly to put all of the necessary information. I see that Fomar's on vacation, but would anyone be able to point out where to place this at? Sorry again for asking this, I know it's the type of question that annoys most people.[/QUOTE]

I still have some internet access (ie this is the only time I've been on today) do you mean where to place the script? If so anywhere above main and below the defualt scripts will work (insert adds another place to put scripts in the editor).

[QUOTE=Eriel;121065]Nice script you got there, Fomar. But I encountered some error while testing it.

If my party has more than 4 characters (6 in my case), I can't get a game over scene. I tried fighting a powerful opponent, but once all my party members all wiped out the game still has the 'Fight' and 'Escape' option and won't let the 'Game Over' screen appear.

Can you please help me with my problem?[/QUOTE]

Do you use a CBS that doesn't call $game_party.all_dead? if you do that's why, or it may be another script.
Mr. Fomar0153 how do we make the first 4 fight only
coz I think that I can see all the members attacking.

one more thing is there is a script that alow you to change members in the battle?

thank you :)
They do only fight, you probably have a CBS below this script.
Yeah I'm Using the Action Cost CBS so is there a way to fix it:?
I fly back tommorrow so I'll fix it then.

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=9722