View difference between Paste ID: 7jbv7jra and PPjt7AxE
SHOW: | | - or go back to the newest paste.
1
# ------------------------------------------------------------------------------
2
# Script: Party System (v1.0)
3
# Author: flixbeat
4
#
5
# Description: 
6
# This script allows you to manage your party members, by
7
# adding, removing or swapping members.
8
#
9
# Compatibility issues:
10
# This script is incompatible with other scripts that adds a new command in
11
# the menu window as well. This script adds a new command "party" to the menu
12
# window and it should be at the bottom of status command. Any new commands
13
# that are also being added after the status command will be overriden, in order
14
# to avoid this issue read the installation instructions.
15
#
16
# Installation:
17
# 1) This script is plug and play, just be sure to place it above ▼ Main Process
18
# 2) If there are other scripts that add new commands like this script does,
19
#    be sure to put this script above that script, an example of a script that
20
#    adds a new command is KCG quest journal script. It adds a 'quest' command
21
#    on the menu. If this script is placed below KGC quest journal script
22
#    the 'quest' command will be overriden.
23
#
24
# Default Controls:
25
# Button "C" - select an actor (Key "Z","Enter" for keyboard)
26
# Button "A" - remove an actor (Key "Shift" for keyboard)
27
#
28
# Relase Date: July 30
29
#
30
# Updates:
31
#
32
# ------------------------------------------------------------------------------
33
34
# ======================== START OF CUSTOMIZATION ==============================
35
36
# If you will change the number of your max party members here, be sure to
37
# change the value of MAX_MEMBERS constant in the Game_Party Script as well. Make
38
# sure that the MAX_MEMBERS value matches with SIZE value.
39
module Flix_Max_Party
40
  SIZE = 4
41
end
42
43
# If you want to disable some actors from being removed or replace from the
44
# party, place their IDs here, each actor's ID can be found in the actor tab
45
# in the database, by default the actor who has an ID of 1 is ralph and 2 for
46
# ulrika
47
48
# to add actor IDs see syntax and example below
49
# syntax : key => actor_id
50
# example : 5 => 5 
51
# - in this case, whoever actor that has an id of 5 will not
52
# be removed or replaced in party.
53
# I recommend that you match the key and the actor id
54
# NOTE: Don't forget to place a comma right after you add new key and actor id
55
module Flix_Disable_Actors
56
  ACTOR_ID = {
57
  1=>1,
58
  2=>2,
59
  }
60
end
61
62
# Place actor id's here, actors that are present in this section will show
63
# in standby actors, watch for the comma here as well.
64
module Flix_Standby_Actors
65
  ACTOR_ID = [5,6,7,8]
66
end
67
68
# You can customize texts guides that are being displayed on party window
69
module Flix_Text
70
    VACANT_TEXT = "-vacant-" # text for a vacant slot
71
    TITLE_TEXT = "Party" # the title of the window
72
    PARTY_TEXT = "Active" # members that are currenly in the party
73
    STANDBY_ACTORS_TITLE_TEXT = "Standby" # members that are in standby for future use
74
    BUTTON_GUIDE = "(Press C to select or A to remove a character)" # button guide
75
    # NOTE: changing the text button like C or A will not change the controls.
76
end
77
78
# ======================== END OF CUSTOMIZATION ================================
79
80
# ------------------------------------------------------------------------------ 
81
# * Title Window
82
# ------------------------------------------------------------------------------
83
class Window_Title < Window_Base
84
  def initialize
85
    super(0,0,544,50)
86
    self.contents.draw_text(0,-5,self.width,WLH,Flix_Text::TITLE_TEXT + " " + Flix_Text::BUTTON_GUIDE)
87
  end
88
end
89
90
# ------------------------------------------------------------------------------ 
91
# * Party Name Window (Title)
92
# ------------------------------------------------------------------------------
93
class Window_Party_Title < Window_Base
94
  def initialize
95
    super(0,50,160,50)
96
    self.contents.draw_text(0,-5,self.width,WLH,Flix_Text::PARTY_TEXT)
97
  end
98
end
99
100
# ------------------------------------------------------------------------------ 
101
# * Party Names Window
102
# ------------------------------------------------------------------------------
103
class Window_Party_Command < Window_Selectable
104
  
105
  def initialize
106
    @actor = $game_actors
107
    @party = $game_party
108
    super(0,100,160,130)
109
    self.alias_func
110
    self.prepare_party_member_selection
111
  end
112
  
113
  def alias_func
114
    alias :prepare_party_member_selection :select
115
  end
116
  
117
  def select
118
    @selections = [] 
119
    
120
    if @party.members.size == Flix_Max_Party::SIZE
121
      for i in [email protected]
122
        @selections.push(@party.members[i].name)
123
      end
124
    else 
125
      for i in [email protected]
126
        @selections.push(@party.members[i].name)
127
      end  
128
    
129
      slot = Flix_Max_Party::SIZE - @party.members.size
130
      
131
      for i in 0..slot-1
132
        @selections.push("-vacant-")
133
      end
134
      
135
    end
136
    
137
    self.index = 0
138
    @item_max = @selections.size 
139
140
    for i in [email protected]
141
      rect = self.item_rect(i)
142
      self.contents.draw_text(rect,@selections[i])
143
    end
144
    
145
  end
146
end
147
148
# ------------------------------------------------------------------------------ 
149
# * Standby Window (Title)
150
# ------------------------------------------------------------------------------
151
class Window_Standby_Title < Window_Base
152
  def initialize
153
    super(0,230,160,50) 
154
    self.contents.draw_text(0,-5,self.width,WLH,Flix_Text::STANDBY_ACTORS_TITLE_TEXT)
155
  end
156
end
157
158
# ------------------------------------------------------------------------------ 
159
# * Standby Window Command
160
# ------------------------------------------------------------------------------
161
class Window_Standby_Selectable < Window_Selectable
162
  def initialize
163
    super(0,280,160,130)
164
    self.setup_selectables
165
  end
166
  
167
  def setup_selectables
168
    
169
    if Flix_Standby_Actors::ACTOR_ID!=[]
170
      
171
      @selectables = [] 
172
      for i in 0..Flix_Standby_Actors::ACTOR_ID.size-1
173
        @selectables.push($game_actors[Flix_Standby_Actors::ACTOR_ID[i]].name)
174
      end
175
      
176
      self.index = 0
177
      @item_max = @selectables.size 
178
      self.create_contents
179
      
180
      for i in [email protected]
181
        rect = item_rect(i)
182
        self.contents.draw_text(rect,@selectables[i])
183
      end
184
      
185
    end
186
      
187
  end
188
end
189
190
# ------------------------------------------------------------------------------ 
191
# * Actor Info Window (In Party)
192
# ------------------------------------------------------------------------------
193
class Window_Show_Actor_Info < Window_Base
194
  def initialize
195
    super(160,50,384,180)
196
    @actor = $game_actors
197
  end
198
  
199
  def show_actor_info(actor_index)
200
    self.contents.clear
201
    if actor_index == nil
202
      self.contents.clear
203
    else
204
      self.draw_actor_face(@actor[actor_index],0,0)
205
      self.draw_actor_graphic(@actor[actor_index], 13, 96)
206
      self.draw_actor_level(@actor[actor_index], 260, 0)
207
      self.draw_actor_name(@actor[actor_index],0,100)
208
      self.draw_actor_class(@actor[actor_index], 0, 124)
209
      self.draw_actor_hp(@actor[actor_index], 120, 0)
210
      self.draw_actor_mp(@actor[actor_index], 120, 24)
211
      self.contents.draw_text(120,50,self.width,WLH,"ATK: "+@actor[actor_index].base_atk.to_s)
212
      self.contents.draw_text(120,74,self.width,WLH,"DEF: "+@actor[actor_index].base_def.to_s)
213
      self.contents.draw_text(120,98,self.width,WLH,"AGI: "+@actor[actor_index].base_agi.to_s)
214
      self.contents.draw_text(120,122,self.width,WLH,"SPI: "+@actor[actor_index].base_spi.to_s)
215
      self.contents.draw_text(240,50,self.width,WLH,"EVA: "+@actor[actor_index].agi.to_s)
216
      self.contents.draw_text(240,74,self.width,WLH,"CRI: "+@actor[actor_index].cri.to_s)
217
      self.contents.draw_text(240,98,self.width,WLH,"HTR: "+@actor[actor_index].hit.to_s) 
218
    end
219
    
220
  end
221
end
222
223
# ------------------------------------------------------------------------------ 
224
# * Actor Info Window (In Standby)
225
# ------------------------------------------------------------------------------
226
class Window_Show_Actor_Info_ST < Window_Base
227
  def initialize
228
    super(160,230,384,186)
229
    @actor = $game_actors
230
  end
231
  
232
  def show_actor_info(actor_index)
233
    self.contents.clear
234
    self.draw_actor_face(@actor[actor_index],0,0)
235
    self.draw_actor_graphic(@actor[actor_index], 13, 96)
236
    self.draw_actor_level(@actor[actor_index], 260, 0)
237
    self.draw_actor_name(@actor[actor_index],0,100)
238
    self.draw_actor_class(@actor[actor_index], 0, 124)
239
    self.draw_actor_hp(@actor[actor_index], 120, 0)
240
    self.draw_actor_mp(@actor[actor_index], 120, 24)
241
    self.contents.draw_text(120,50,self.width,WLH,"ATK: "+@actor[actor_index].base_atk.to_s)
242
    self.contents.draw_text(120,74,self.width,WLH,"DEF: "+@actor[actor_index].base_def.to_s)
243
    self.contents.draw_text(120,98,self.width,WLH,"AGI: "+@actor[actor_index].base_agi.to_s)
244
    self.contents.draw_text(120,122,self.width,WLH,"SPI: "+@actor[actor_index].base_spi.to_s)
245
    self.contents.draw_text(240,50,self.width,WLH,"EVA: "+@actor[actor_index].agi.to_s)
246
    self.contents.draw_text(240,74,self.width,WLH,"CRI: "+@actor[actor_index].cri.to_s)
247
    self.contents.draw_text(240,98,self.width,WLH,"HTR: "+@actor[actor_index].hit.to_s) 
248
  end
249
end
250
251-
class Scene_Menu < Scene_Menu
251+
252
# * Scene Menu - This scene is identical to the original Scene_Menu for easy
253-
    print "scene menu called"
253+
254-
  end 
254+
255
256
class Scene_Menu < Scene_Base
257
  def initialize(menu_index = 0)
258
    @menu_index = menu_index
259
    if @menu_index > 4
260
      self.menu_index(@menu_index+=1)
261
    end
262
  end
263
  
264
  def menu_index(previous_selection_index)
265
    @menu_index = previous_selection_index
266
  end
267
  
268
  def create_command_window
269
    s1 = Vocab::item      # 0
270
    s2 = Vocab::skill     # 1
271
    s3 = Vocab::equip     # 2
272
    s4 = Vocab::status    # 3
273
    party = "Party"       # 4
274
    
275
    save = Vocab::save    # 5
276
    game_end = Vocab::game_end #6
277
    
278
    @main_selectables = [s1,s2,s3,s4,party,save,game_end]
279
    # create commands < window selectable
280
    @command_window = Window_Command.new(160, @main_selectables)
281
    @command_window.index = @menu_index
282
    if $game_party.members.size == 0          # If number of party members is 0
283
      @command_window.draw_item(@main_selectables[0], false)     # Disable item
284
      @command_window.draw_item(@main_selectables[1], false)     # Disable skill
285
      @command_window.draw_item(@main_selectables[2], false)     # Disable equipment
286
      @command_window.draw_item(@main_selectables[3], false)     # Disable status
287
      @command_window.draw_item(@main_selectables[4], false)     # Disable party
288
    end
289
    if $game_system.save_disabled             # If save is forbidden
290
      @command_window.draw_item(5, false)     # Disable save
291
    end
292
  end
293
  
294
  def update_command_selection
295
    if Input.trigger?(Input::B)
296
      Sound.play_cancel
297
      $scene = Scene_Map.new
298
    elsif Input.trigger?(Input::C)
299
      if $game_party.members.size == 0 and @command_window.index < 5
300
        Sound.play_buzzer
301
        return
302
      elsif $game_system.save_disabled and @command_window.index == 5
303
        Sound.play_buzzer
304
        return
305
      end
306
      Sound.play_decision
307
      case @command_window.index
308
      when 0      # Item
309
        $scene = Scene_Item.new
310
      when 1,2,3  # Skill, equipment, status
311
        start_actor_selection
312
      when 4      # Flix Party
313
        self.menu_index(@menu_index)
314
        $scene = Flix_Scene_Party.new
315
      when 5      # Save
316
        $scene = Scene_File.new(true, false, false)
317
      when 6      # End Game
318
        $scene = Scene_End.new
319
      end
320
    end
321
  end
322
  
323
  #--------------------------------------------------------------------------
324
  # * Start Actor Selection
325
  #--------------------------------------------------------------------------
326
  def start_actor_selection
327
    @command_window.active = false
328
    @status_window.active = true
329
    if $game_party.last_actor_index < @status_window.item_max
330
      @status_window.index = $game_party.last_actor_index
331
    else
332
      @status_window.index = 0
333
    end
334
  end
335
  #--------------------------------------------------------------------------
336
  # * End Actor Selection
337
  #--------------------------------------------------------------------------
338
  def end_actor_selection
339
    @command_window.active = true
340
    @status_window.active = false
341
    @status_window.index = -1
342
  end
343
  #--------------------------------------------------------------------------
344
  # * Update Actor Selection
345
  #--------------------------------------------------------------------------
346
  def update_actor_selection
347
    if Input.trigger?(Input::B)
348
      Sound.play_cancel
349
      end_actor_selection
350
    elsif Input.trigger?(Input::C)
351
      $game_party.last_actor_index = @status_window.index
352
      Sound.play_decision
353
      case @command_window.index
354
      when 1  # skill
355
        $scene = Scene_Skill.new(@status_window.index)
356
      when 2  # equipment
357
        $scene = Scene_Equip.new(@status_window.index)
358
      when 3  # status
359
        $scene = Scene_Status.new(@status_window.index)
360
      end
361
    end
362
  end
363
  
364
  #--------------------------------------------------------------------------
365
  # * Start processing
366
  #--------------------------------------------------------------------------
367
  def start
368
    super
369
    create_menu_background
370
    create_command_window
371
    @gold_window = Window_Gold.new(0, 360)
372
    @status_window = Window_MenuStatus.new(160, 0)
373
  end
374
  #--------------------------------------------------------------------------
375
  # * Termination Processing
376
  #--------------------------------------------------------------------------
377
  def terminate
378
    super
379
    dispose_menu_background
380
    @command_window.dispose
381
    @gold_window.dispose
382
    @status_window.dispose
383
  end
384
  #--------------------------------------------------------------------------
385
  # * Frame Update
386
  #--------------------------------------------------------------------------
387
  def update
388
    super
389
    update_menu_background
390
    @command_window.update
391
    @gold_window.update
392
    @status_window.update
393
    if @command_window.active
394
      update_command_selection
395
    elsif @status_window.active
396
      update_actor_selection
397
    end
398
  end
399
  
400
  
401
end
402
403
# ============================================================================== 
404
# * Scene
405
# ==============================================================================
406
class Flix_Scene_Party < Scene_Base
407
  
408
  def start
409
    
410
    self.create_menu_background 
411
    #---------------------------------------------
412
    @win_title = Window_Title.new
413
    @win_ptitle = Window_Party_Title.new
414
    @win_cparty = Window_Party_Command.new
415
    @win_show_actor = Window_Show_Actor_Info.new
416
    #---------------------------------------------
417
    @win_stitle = Window_Standby_Title.new
418
    @win_cstandby = Window_Standby_Selectable.new
419
    @win_show_actor_st = Window_Show_Actor_Info_ST.new
420
    #---------------------------------------------
421
    
422
    
423
    @members = []
424
    for i in 0..$game_party.members.size-1
425
      @members.push($game_party.members[i].id)
426
    end
427
    
428
    @win_cstandby.active = false
429
    self.refresh_selection
430
    
431
  end
432
  
433
  def update
434
    @win_cparty.update
435
    @win_cstandby.update
436
    if Input.trigger?(Input::C)
437
      if Flix_Disable_Actors::ACTOR_ID.has_value?@members[@win_cparty.index] or
438
        Flix_Standby_Actors::ACTOR_ID==[]
439
        Sound.play_buzzer
440
      else
441
        
442
        if @win_cparty.active
443
          Sound.play_decision
444
          @win_cstandby.active = true
445
          @win_cparty.active = false
446
        elsif @win_cstandby.active
447
          Sound.play_equip
448
          @win_cstandby.active = false
449
          @win_cparty.active = true
450
          
451
          if @members[@win_cparty.index] == nil
452
            @members.delete_at(@win_cparty.index)
453
            @members.push(Flix_Standby_Actors::ACTOR_ID[@win_cstandby.index])
454
            $game_party.add_actor(Flix_Standby_Actors::ACTOR_ID[@win_cstandby.index])
455
            Flix_Standby_Actors::ACTOR_ID.delete(Flix_Standby_Actors::ACTOR_ID[@win_cstandby.index])
456
          else
457
            
458
            actor_id_buffer = @members[@win_cparty.index]
459
            $game_party.remove_actor(@members[@win_cparty.index])
460
            @members.delete(@members[@win_cparty.index])
461
            @members.push(Flix_Standby_Actors::ACTOR_ID[@win_cstandby.index])
462
            $game_party.add_actor(Flix_Standby_Actors::ACTOR_ID[@win_cstandby.index])
463
            Flix_Standby_Actors::ACTOR_ID.delete(Flix_Standby_Actors::ACTOR_ID[@win_cstandby.index])
464
            Flix_Standby_Actors::ACTOR_ID.push(actor_id_buffer)
465
          end
466
      
467
        self.refresh_selection
468
        self.command_window_refresh
469
        
470
        end
471
        
472
      end
473
      
474
    elsif Input.trigger?(Input::UP) or Input.trigger?(Input::DOWN)
475
      if @win_cparty.active
476
        @win_show_actor.show_actor_info(@members[@win_cparty.index]) 
477
      elsif @win_cstandby.active
478
        @win_show_actor_st.show_actor_info(Flix_Standby_Actors::ACTOR_ID[@win_cstandby.index])
479
      end
480
481
    elsif Input.trigger?(Input::A)
482
      if @win_cstandby.active
483
        Sound.play_buzzer
484
      else
485
486
        if Flix_Disable_Actors::ACTOR_ID.has_value?@members[@win_cparty.index] or
487
          @members[@win_cparty.index] == nil
488
          Sound.play_buzzer
489
        else
490
          Sound.play_equip
491
          actor_id_buffer = @members[@win_cparty.index]
492
          @members.delete(@members[@win_cparty.index])
493
          $game_party.remove_actor(actor_id_buffer)
494
          Flix_Standby_Actors::ACTOR_ID.push(actor_id_buffer)
495
          
496
          self.command_window_refresh
497
          self.refresh_selection
498
          
499
        end
500
      end
501
      
502
    elsif Input.trigger?(Input::B)
503
      
504
      Sound.play_cancel
505
      
506
      if @win_cstandby.active
507
        @win_cstandby.active = false
508
        @win_cparty.active = true
509
      else
510
        $scene = Scene_Menu.new(4)
511
      end
512
  
513
    end
514
  end
515
  
516
  def command_window_refresh
517
    @win_cparty.dispose
518
    @win_cstandby.dispose
519
    @win_cparty = Window_Party_Command.new
520
    @win_cstandby = Window_Standby_Selectable.new
521
    @win_cstandby.active = false
522
  end
523
  
524
  def refresh_selection
525
  @win_show_actor.show_actor_info(@members[0])
526
    if Flix_Standby_Actors::ACTOR_ID!=[]
527
      @win_show_actor_st.show_actor_info(Flix_Standby_Actors::ACTOR_ID[0])
528
    end
529
  end
530
  
531
  def terminate
532
    @win_show_actor.dispose
533
    @win_cparty.dispose
534
    @win_title.dispose
535
    @win_ptitle.dispose
536
    
537
    @win_stitle.dispose
538
    @win_cstandby.dispose
539
    @win_show_actor_st.dispose
540
    
541
    dispose_menu_background
542
  end
543
  
544
end