Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Instructions: First, decide how many parties you want to use and initialize
- # them with a script call of:
- # setup_multiple_parties(number)
- # In theory, number can go as high as you want. Tested for 2, however.
- # Next, initialize each party with a scrip call of:
- # define_party(number, member1, member 2, ...)
- # The first number in this script call determines which party you're defining
- # (note that parties start at 0, not 1), while the following numbers are the
- # actor ids of the members of that party. Actor ids start at 1, not 0, and
- # should not have leading zeros.
- # Finally, when you want to swap parties, use this call:
- # swap_party(first_party, second_party)
- # first_party and second_party are the numbers of the two parties you want to
- # swap. first_party is the one you're swapping out and second_party is the one
- # you're swapping in.
- # This script goes below materials and above main. Since all the methods are
- # new, it should be highly unlikely to have compatibility issues.
- #==============================================================================
- # ■ Game_Party
- #==============================================================================
- class Game_Party < Game_Unit
- def setup_multiple_parties(number)
- @multiple_parties = []
- i = 0
- while i < number
- @multiple_parties[i] = []
- i += 1
- end
- end
- def multiple_parties(index, index2)
- return @multiple_parties[index][index2]
- end
- def swap_party(first_party, second_party)
- i = 0
- while i < @multiple_parties[first_party].length
- @multiple_parties[first_party][i] = $game_party.members[i].id
- i += 1
- end
- i = 0
- while i < @multiple_parties[first_party].length
- $game_party.remove_actor(@multiple_parties[first_party][i])
- i += 1
- end
- i = 0
- while i < @multiple_parties[second_party].length
- $game_party.add_actor(@multiple_parties[second_party][i])
- i += 1
- end
- end
- def party_clear(number)
- @multiple_parties[number] = []
- end
- def party_member_add(number, member)
- @multiple_parties[number].push(member)
- end
- end # Game_Party
- #==============================================================================
- # ■ Game_Interpreter
- #==============================================================================
- class Game_Interpreter
- def swap_party(first_party, second_party)
- $game_party.swap_party(first_party, second_party)
- end
- def define_party(number, *members)
- return if members.empty?
- $game_party.party_clear(number)
- for member in members
- $game_party.party_member_add(number, member)
- end
- end
- def setup_multiple_parties(number)
- $game_party.setup_multiple_parties(number)
- end
- end
Add Comment
Please, Sign In to add comment