Party Swap
Authors: Nathmatt
Version: 1.01
Type: Party Controller
Key Term: Misc Add-on
IntroductionThis script allows you have multiple parties and swap between the easily
Features
- Allows creating a new party and storing the current along with the players position in a $game_variable
- Allows swapping the current party and position of the player with a $game_variable
- Allows combining the parties inventory and gold stored in the $game_variable to the party
Screenshotsno screenshot
Demono demo
Script#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Party Swap by Nathmatt
# Version: 1.00
# Type: Party Controller
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# This work is protected by the following license:
# #----------------------------------------------------------------------------
# #
# # Creative Commons - Attribution-NonCommercial-ShareAlike 3.0 Unported
# # ( http://creativecommons.org/licenses/by-nc-sa/3.0/ )
# #
# # You are free:
# #
# # to Share - to copy, distribute and transmit the work
# # to Remix - to adapt the work
# #
# # Under the following conditions:
# #
# # Attribution. You must attribute the work in the manner specified by the
# # author or licensor (but not in any way that suggests that they endorse you
# # or your use of the work).
# #
# # Noncommercial. You may not use this work for commercial purposes.
# #
# # Share alike. If you alter, transform, or build upon this work, you may
# # distribute the resulting work only under the same or similar license to
# # this one.
# #
# # - For any reuse or distribution, you must make clear to others the license
# # terms of this work. The best way to do this is with a link to this web
# # page.
# #
# # - Any of the above conditions can be waived if you get permission from the
# # copyright holder.
# #
# # - Nothing in this license impairs or restricts the author's moral rights.
# #
# #----------------------------------------------------------------------------
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# Script Calls:
#
# Party.new_party(var_id) - This stores the current party and player postion
# in $game_varirables[var_id]
#
# Party.swap(var_id) - This will swap the current party and positon with
# the 1 stored in $game_varirables[var_id]
#
# Party.combine_party(var_id) - Adds money,gold,items,armor,and weapons from
# $game_varirables[var_id] to the party
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Party
#------------------------------------------------------------------------------
# This module controls the party.
#==============================================================================
module Party
def self.new_party(var_id)
$game_variables[var_id] = [$game_party,$game_map.map_id,
$game_player.x,$game_player.y,$game_player.direction]
$game_party = Game_Party.new
end
def self.swap(var_id)
par = [$game_party,$game_map.map_id,
$game_player.x,$game_player.y,$game_player.direction]
$game_party = $game_variables[var_id][0]
$game_player.refresh
$game_temp.player_transferring = true
$game_temp.player_new_map_id = $game_variables[var_id][1]
$game_temp.player_new_x = $game_variables[var_id][2]
$game_temp.player_new_y = $game_variables[var_id][3]
$game_temp.player_new_direction = $game_variables[var_id][4]
$game_variables[var_id] = par
end
def self.combine_party(var_id)
$game_variables[var_id][0].items.each_pair {| key, value |
$game_party.gain_item(key, value)}
$game_variables[var_id][0].weapons.each_pair {| key, value |
$game_party.gain_weapon(key, value)}
$game_variables[var_id][0].armors.each_pair {| key, value |
$game_party.gain_armor(key, value)}
$game_party.gain_gold($game_variables[var_id][0].gold)
end
end
#============================================================================
# Game_Party
#----------------------------------------------------------------------------
# This class was enhanced to support accessing the parties inventory
#============================================================================
class Game_Party
attr_reader :items
attr_reader :weapons
attr_reader :armors
end
Instructionsin the script
CompatibilityShould not have any compatibility issues
Credits and Thanks
- Nathmatt
- Blizzard for little tricks about party storing
- lonely_cubone for asking how to combine the stored inventory and gold to the party
Author's NotesIf you have any suggestions or problems with the instructions post here
Great script, exactly what I was looking for! *levels*
Nice system! I actually was thinking about making something like this too, but I didn't know that $game_party holds every data of a party (like gold and steps) :shy:, and, actually, I didn't even think of using $game_party for the players double:shy:... This could be perfectly used for RMX-OS as multiple file system (I think). That was my first intention for my idea anyway... But why are you using $game_variables[var_id].items in the beginning of method combine_party of module Party? What does it do anyway?
-SBR*
EDIT: Level up!
That was put there during testing and i forgot to remove it.
Yes but i added the reader to the items, weapons, and armor at the end of the script.
Ah, now I see!
Okay, I am something of a scripting noob, so this might be a really basic question. How do you create another party to switch to? I can see how these scripts let you save your current one, and switch from that one to another, but currently I can't figure out how to make that other one exist in the first place.
i forgot to add that this creates the new party
Okay! I got it to work. But after I switch to the other party, there's no actor or position information saved for it so I just get a blank square moving around from the same place the previous party was before the switch. How do I make content for the new party? Where do I put that information? (If I am asking questions that are answered elsewhere, I apologise.)
just use the event command add actor
Wow, I don't know why that didn't occur to me. Anyway, the script works beautifully and does exactly what I need it to, so thank you very much!
Sorry for the bump, but when I try to combine two parties I get an error, "undefined method 'items' for #<Array:0x29e61c8>
If I comment out the items line error I get the same thing but for 'weapons' for #<Array:0x29067c8>
Same for 'armors' for #<Array:0x2906dc8>
Same for gold for a different arry # basically the entire combine script doesn't work.
I'm running this out of a new project, so there are no edited or added scripts.
Replace these lines of code
def self.combine_party(var_id)
$game_variables[var_id].items.each_pair {| key, value |
$game_party.gain_item(key, value)}
$game_variables[var_id].weapons.each_pair {| key, value |
$game_party.gain_weapon(key, value)}
$game_variables[var_id].armors.each_pair {| key, value |
$game_party.gain_armor(key, value)}
$game_party.gain_gold($game_variables[var_id].gold)
end
With this.
def self.combine_party(var_id)
$game_variables[var_id][0].items.each_pair {| key, value |
$game_party.gain_item(key, value)}
$game_variables[var_id][0].weapons.each_pair {| key, value |
$game_party.gain_weapon(key, value)}
$game_variables[var_id][0].armors.each_pair {| key, value |
$game_party.gain_armor(key, value)}
$game_party.gain_gold($game_variables[var_id][0].gold)
end
See if that works.
yea that should work i thought i tested this when i made it i guess not fully
Works perfectly, thanks muchly!