RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Help!!! (Party switch script)

0 Members and 1 Guest are viewing this topic.

**
Rep: +0/-0Level 88
Hey all Im trying to write a script that will allow me to open a scene with three windows: one for the active party (the four that fight) one for the reserve party (the characters you can choose to fight) and one as a help window (e.g. 'swap character A with character B?')
Im somewhat of  novice at RGSS and have tried but after making a complete mess I've just had enough! Heres what I've done if you can make sense of it all and would appreciate any help!  ???
Thanks!

Code: [Select]
#===============================================================================
#Displays party members in the reserve party and allows the player to switch
#them with the Active Party.
#===============================================================================
class Scene_ReserveParty < Window_Base
  
def initialize(menu_index = 0)
   @menu_index = menu_index #Store the cursor position
end
  
  def main
   @window_1 = Window_1.new #Reserve Party
   @window_1.y = 200
    
   @window_2 = Window_2.new #Active Party
  
   @window_3 = Window_3.new #Help Window
   @window_3.update#Send the help text by default to the help window
  
  @column_max = 4
  
   s1 = draw_actor_graphic($game_party.actors[0])
   s2 = draw_actor_graphic($game_party.actors[1])
   s3 = draw_actor_graphic($game_party.actors[2])
   s4 = draw_actor_graphic($game_party.actors[3])
   @window_2 = Window_command.new([s1, s2, s3, s4], 200)# 200 is height
   @window_2.index = @menu_index
   @window_2.active = true
   @window_1.active = false
  
def update
    swap
@window_2.update #menu

#THIS IS FOR THE HELP DISPLAY WINDOW:
case @window_a2.index #window_a2 is the menu... index is it's cursor position !
  when 0 #Remember that the cursor position start at 0, because it's an Array !!
    @window_3.update("Swap", $game_party.actor.name[0],"?" ) #1st Party Member
  when 1
    @window_3.update("Swap", $game_party.actor.name[1],"?" ) #2nd Party Member
  when 2
    @window_3.update("Swap", $game_party.actor.name[2],"?" ) #3rd Party Member
  when 3
    @window_3.update("Swap", $game_party.actor.name[3],"?" ) #4th Party Member
end
  
  if Input.trigger?(Input::B) #Press ESCAPE to exit
  $game_system.se_play($data_system.cancel_se)
  $scene = Scene_Map.new
  $game_map.autoplay #Because we play music in the menu...
end  

#THIS IS FOR THE OPTION FUNCTIONS:
if Input.trigger?(Input::C) #Do the following if ENTER is pressed...
case @window_2.index #window_a2 is the menu... index is it's cursor position !
  when 0 #Remember that the cursor position start at 0, because it's an Array !!
    swap = $game_party.actor[0]
  when 1
    swap = $game_party.actor[1]
  when 2
    swap = $game_party.actor[2]
  when 3
    swap = $game_party.actor[3]
  
  @window_2.active = false
  @window_1.active = true
end

   s1 = $game_party.actor.graphic[0]
   s2 = $game_party.actor.graphic[1]
   s3 = $game_party.actor.graphic[2]
   s4 = $game_party.actor.graphic[3]
   s5 = $game_party.actor.graphic[4]
   s6 = $game_party.actor.graphic[5]
   @window_1 = Window_command.new([s1, s2, s3, s4, s5, s6], 320)# 320 is height
   @window_1.index = @menu_index
   if $game_party.actors.size < 4
      # Disable absent party members
      @command_window.disable_item(0)
      @command_window.disable_item(1)
      @command_window.disable_item(2)
      @command_window.disable_item(3)
      @command_window.disable_item(4)
      @command_window.disable_item(5)
    end
  end
  
  
def update
  @window_1.update
  if Input.trigger? (Input::B)
    $game_system.se_play($data_system.cancel_se)
    $scene = Scene_Map.new
  end

end
end

   #This is what makes the scene update itself constantly:
Graphics.transition
loop do
Graphics.update
Input.update
update #Call the method DEF UPDATE starting below
if $scene != self
  break
end
end

#Execute when exiting the scene:
Graphics.freeze
@window_1.dispose
@window_2.dispose
@window_3.dispose
end
end
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------

#Reserve Party Window

class Window_1 < Window_Selectable
  
  def initialize
  super(0, 0, 640, 280)
  self.contents = Bitmap.new(width - 32, height - 32)
  self.contents.font.name = "Tahoma"
  self.contents.font.size = 24
  self.contents.draw_text(x, y - 30, 200, 100, "Reserve Party")
end

end
  
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------

# Active Party Window


class Window_2 < Window_Selectable

  def initialize
  super(0, 0, 400, 200)
  self.contents = Bitmap.new(width - 32, height - 32)
  self.contents.font.name = "Tahoma"
  self.contents.font.size = 24
  self.contents.draw_text(x, y - 30, 200, 100, "Active Party")
  self.active = true
    self.index = -1
  for i in 0...$game_party.actors.size
      x = i * 100
      y = 0
      actor = $game_party.actors[i]
      draw_actor_graphic(actor, x + 25, y + 130)
      draw_actor_name(actor, x, y + 50)
      draw_actor_level(actor, x, y + 130)
    end
  end
  
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------

# Help Window

class Window_3 < Window_Base
  
  def initialize
    super(0, 400, 240, 200)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = "Tahoma"
    self.contents.font.size = 24
  
  def update(help_text) #Receive argument, show relevant help text in window
  self.contents.clear #Clear the content before displaying new data !
  self.contents.draw_text(0, 0, 440, 32, help_text) #show the content of "help_text" variable
end
end
end
end
« Last Edit: March 05, 2008, 03:31:06 AM by modern algebra »

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
I put your script in a code box for you - scripts get messed up by bbcode if you don't put them in code tags.

Hmm, proper indenting is a must for me when I'm trying to read a scrip :(

Anyway, are you trying this just because you want the system or is it to learn Ruby?

If it's just for the system, I'll direct you to:

http://rmrk.net/index.php/topic,20446.0.html


If it's to help learn Ruby, well, I guess I can take a look at your stuff eventually. I haven't got a lot of time though, so it will most likely take forever before I get around to it and I'll probably forget it.

**
Rep: +0/-0Level 88
I am trying to learn Ruby so would be great if you could tell me where I went wrong but no rush!
If you need me to indent it I can give it a go for you.
Thanks for your help ;D

******
Revolution is not a bed of roses.
Rep:
Level 91
Project of the Month winner for July 2009
Strike 1, this belongs in script help.

Party Switching Scripts are a bit too high for novices, if you don't have experience with scene creation, I'd suggest giving up, and focusing on easier scripts, like CMSs.