Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
  • 0
deathmoverz24

Multiple Inventories for each Actor?

Question

i want to make a separate inventory for 2 actors actually bcoz theres a part in my game where you will control another guy but the inventory must not be the same. sad.png

Share this post


Link to post
Share on other sites

19 answers to this question

Recommended Posts

  • 0

ok so this is what ive done

 

407398_2223049554331_1790490872_1442145_1399528141_n.jpg

 

 

 

393777_2223049194322_1790490872_1442144_865606861_n.jpg

 

after that, ive copy the "red lines" on the script you gave me and i ignored the rest then i paste it on their classes. I am correct right?

 

but uhh what bothers me is how's this one work? how do i start erasing all items and sending them on a list or something?

Share this post


Link to post
Share on other sites
  • 0

I don't really think it is necessary to use a script for this. I believe it can be evented instead. Let me try, and if I succeed, you can have the event system.

Share this post


Link to post
Share on other sites
  • 0

kare3, there's only 3 files? i cant open it. its says "This project is from an old version of Rpg Maker and cannot be loaded?"

Share this post


Link to post
Share on other sites
  • 0

You have the RMXP rtp, right? The demo was made entirely with RTP graphics.. But now that I think of it, my RMXP is pretty old..

Share this post


Link to post
Share on other sites
  • 0

yes, ive copy pasted the entire rtp folders needed.

 

399419_2224879240072_1790490872_1442490_1595529055_n.jpg

 

i wonder whats wrong?

so uhmm anyway you made one for me? thanks in advance.wink.png

Share this post


Link to post
Share on other sites
  • 0

i think he menas step by step so he can recreate is since he cant load it :P and ya, she can evernt anything, and usually in 5 minutes...She is a Kange Approved Eventor*stamps my seal on her forehead*

Share this post


Link to post
Share on other sites
  • 0

There's no need for an event, sorry I was busy.

 

 

# Seperate Item Lists for Multiple Parties
# by RPG Advocate

#==============================================================================
# ** Game_ItemBag
#------------------------------------------------------------------------------
#  This class handles the item bags. It includes item list creation, merging &
#  other functions. Refer to "$game_itembag" for the instance of this class.
#==============================================================================
class Game_ItemBag
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 def initialize
@itembags = []
@itembags[0] = []
for j in 1..10
  @itembags[j] = []
end
@itembags[0][0] = -1
for j in 1..10
  @itembags[j][0] = -1
end
 end
 #--------------------------------------------------------------------------
 # * Item List Creation
 #	 id	 : id of item bag
 #--------------------------------------------------------------------------
 def create(id)
@itembags[id][0] = $game_party.gold
for weapon in $data_weapons
  number = weapon.id
  @itembags[id][number] = $game_party.weapon_number(number)
end
for armor in $data_armors
  number = armor.id
  @itembags[id][number + 1000] = $game_party.armor_number(number)
end
for item in $data_items
  number = item.id
  @itembags[id][number + 2000] = $game_party.item_number(number)
end
$game_party.lose_gold(9999999)
for weapon in 1..$data_weapons.size - 1
  $game_party.lose_weapon(weapon, 99)
end
for armor in 1..$data_armors.size - 1
  $game_party.lose_armor(armor, 99)
end
for item in 1..$data_items.size - 1
  $game_party.lose_item(item, 99)
end
 end
 #--------------------------------------------------------------------------
 # * Item List Replace
 #	 id		 : id of item bag
 #	 delete_bag : flag if deleting source bag
 #--------------------------------------------------------------------------
 def replace(id, delete_bag = true)
if @itembags[id][0] == -1
  print("Warning: This item bag does not exist.")
  return
end
$game_party.lose_gold(9999999)
$game_party.gain_gold(@itembags[id][0])
for weapon in 1..$data_weapons.size - 1
  $game_party.lose_weapon(weapon, 99)
end
for armor in 1..$data_armors.size - 1
  $game_party.lose_armor(armor, 99)
end
for item in 1..$data_items.size - 1
  $game_party.lose_item(item, 99)
end
for weapon in 1..$data_weapons.size - 1
  $game_party.gain_weapon(weapon, @itembags[id][weapon])
end
for armor in 1..$data_armors.size - 1
  $game_party.gain_armor(armor, @itembags[id][armor + 1000])
end
for item in 1..$data_items.size - 1
  $game_party.gain_item(item, @itembags[id][item + 2000])
end
if delete_bag
  delete(id)
end
 end
 #--------------------------------------------------------------------------
 # * Item List Merge
 #	 id1	: id of item bag #1
 #	 id2	: id of item bag #2
 #--------------------------------------------------------------------------
 def merge(id1, id2)
if id2 != -1 && @itembags[id1][0] == -1 && @itembags[id2][0] == -1
  print("Warning: Neither item bag to be merged exists.")
  return
end
if @itembags[id1][0] == -1
  print("Warning: The first item bag to be merged does not exist")
  return
end
if id2 != -1
  if @itembags[id2][0] == -1
	print("Warning: The second item bag to be merged does not exist")
	return
  end
end
if id2 == -1
  $game_party.gain_gold(@itembags[id1][0])
  for weapon in 1..$data_weapons.size - 1
	$game_party.gain_weapon(weapon, @itembags[id1][weapon])
  end
  for armor in 1..$data_armors.size - 1
	$game_party.gain_armor(armor, @itembags[id1][armor + 1000])
  end
  for item in 1..$data_items.size - 1
	$game_party.gain_item(item, @itembags[id1][item + 2000])
  end
  delete(id1)
end
if id2 != -1
  @itembags[id1][0] += @itembags[id2][0]
  for weapon in 1..$data_weapons.size - 1
	@itembags[id1][weapon] += @itembags[id2][weapon]
  end
  for armor in 1..$data_armors.size - 1
	@itembags[id1][armor + 1000] += @itembags[id2][armor + 1000]
  end
  for item in 1..$data_items.size - 1
	@itembags[id1][item + 2000] += @itembags[id2][item + 2000]
  end
  delete(id2)
end
 end
 #--------------------------------------------------------------------------
 # * Merge all bags
 #	 mode   : mode of merging (1 = to party inventory /  2 = to all bags)
 #--------------------------------------------------------------------------
 def merge_all(mode)
if mode != 1 && mode != 2
  print("Merge All: Invalid mode.")
  return
end
flag = true
for j in 1..10
  if @itembags[j][0] != -1
	flag = false
  end
end
if flag
  print("Warning: No item bags to merge.")
  return
end
if mode == 1
  for j in 1..10
	print(j.to_s)
	if @itembags[j][0] == -1
	  next
	end
	$game_party.gain_gold(@itembags[j][0])
	for weapon in 1..$data_weapons.size - 1
	  $game_party.gain_weapon(weapon, @itembags[j][weapon])
	end
	for armor in 1..$data_armors.size - 1
	  $game_party.gain_armor(armor, @itembags[j][armor + 1000])
	end
	for item in 1..$data_items.size - 1
	  $game_party.gain_item(item, @itembags[j][item + 2000])
	end
	delete(j)
  end
end
if mode == 2
  if @itembags[1][0] == -1
	@itembags[1][0] = 0
  end
  for j in 2..10
	if @itembags[j][0] == -1
	  next
	end
	@itembags[id1][0] += @itembags[id2][0]
	for weapon in 1..$data_weapons.size - 1
	  @itembags[1][weapon] += @itembags[j][weapon]
	end
	for armor in 1..$data_armors.size - 1
	  @itembags[1][armor + 1000] += @itembags[j][armor + 1000]
	end
	for item in 1..$data_items.size - 1
	  @itembags[1][item + 2000] += @itembags[j][item + 2000]
	end
	delete(j)
  end
end
 end
 #--------------------------------------------------------------------------
 # * Item List Copy
 #	 source_id	   : id of source item bag
 #	 destination_id  : id of destination item bag
 #--------------------------------------------------------------------------
 def copy(source_id, destination_id)
@itembags[destination_id][0] = @itembags[source_id][0]
for j in 0..2999
  @itembags[destination_id][j] = @itembags[source_id][j]
end
 end
 #--------------------------------------------------------------------------
 # * Item List Deletion
 #	 id	 : id of item bag
 #--------------------------------------------------------------------------
 def delete(id)
for j in 0..2999
  @itembags[id][j] = 0
end
@itembags[id][0] = -1
 end
end

#==============================================================================
# ** Scene_Title
#------------------------------------------------------------------------------
#  This class performs title screen processing.
#==============================================================================
class Scene_Title
 #--------------------------------------------------------------------------
 # * Command: New Game
 #--------------------------------------------------------------------------
 alias silmp_cng command_new_game
 def command_new_game
# Perform the original call
silmp_cng
# Create the game bag
$game_itembag = Game_ItemBag.new
 end
end
#==============================================================================
# ** Scene_Save
#------------------------------------------------------------------------------
#  This class performs save screen processing.
#==============================================================================
class Scene_Save < Scene_File
 #--------------------------------------------------------------------------
 # * Write Save Data
 #	 file : write file object (opened)
 #--------------------------------------------------------------------------
 alias silmp_wsd write_save_data
 def write_save_data(file)
# Perform the original call
silmp_wsd(file)
# Save the game bag data
Marshal.dump($game_itembag, file)
 end
end


#==============================================================================
# ** Scene_Load
#------------------------------------------------------------------------------
#  This class performs load screen processing.
#==============================================================================
class Scene_Load < Scene_File
 #--------------------------------------------------------------------------
 # * Read Save Data
 #	 file : file object for reading (opened)
 #--------------------------------------------------------------------------
 alias silmp_rsd read_save_data
 def read_save_data(file)
# Perform the original call
silmp_rsd(file)
# Load the game bag data
$game_itembag = Marshal.load(file)
# Refresh party members
$game_party.refresh
 end
end

 

This is his script without having to change anything.

All you have to do is assign your current bag to itembag1:

$game_itembag.create(1)

And then everything that isn't equip will be stored in there.

To wipe everything the player has and replace it with whats in the Itembag 1 array.

$game_itembag.replace(1)

And to take the items in Itembag 1 array and return them to the player:

$game_itembag.merge(1, -1)

You can do the same for multiple bags, hope this helps.

 

I'll make a small demo later if you still don't get it.

Edited by bigace

Share this post


Link to post
Share on other sites
  • 0

I tried, and I succeeded. dragonhug.gif

 

 

I know this is a bit of a necro thread, but I can't access that image. I know that this CAN be done with eventing, but I was wondering if kare3 found a way to do it without having to set a variable for every single item. I'm fairly convinced there's no way to do this through eventing without it being long, convoluted, and ugly, but if there is a way, I'd love to see it!

Share this post


Link to post
Share on other sites
  • 0

Post #14 he explains how to do it with an already made script. In post #16 he has a demo link.

EDIT: With eventing you would have to have a separate variable to keep track of every item.

Share this post


Link to post
Share on other sites
  • 0

Thanks for the response. I decided to start learning ruby, anyway, so hopefully I will be able to write my own bank script before long. I know there's some excellent ones out there, but I want to do my own work.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...