Issue Gaining Items with Separate Actor Inventories Script

Started by CriticalHit, June 20, 2017, 01:54:23 pm

Previous topic - Next topic

CriticalHit

Hi,

I am using the Separate Actor Inventories script found here at Chaos Project with RMXP. The script works fine except that if the party members all have a full inventory and you try to add an item, nothing happens and the item is not gained. Is there a way to check if the party has enough empty inventory slots before adding items? This would also be an issue when gaining items after a battle.
Thanks to anyone who can help.

KK20

In the Author's Notes:
Quote
Check an actor has a full inventory:
if $game_party.type_number(ACTOR_ID) == $game_party.type_max(ACTOR_ID)


Or does this not suffice?

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

CriticalHit

No, that doesn't quite work unless you can check the current actors in the party. So if actor 1 has one slot empty and actor 2 has 2 slots empty, and there are only two actors in the party, the total available inventory slots would be three. If there are four different items in a chest, how would this work? How would I do it so there is still that last item in the chest?
The best I can come up with would be something like this:


a=0
if actor 1 is in the party
a+= $game_party.type_number(1)

if actor 2 is in the party
a+= $game_party.type_number(2)


if actor 3 is in the party
a+= $game_party.type_number(3)




this would repeat for however many actors there are

then I would use 'a' to determine if all the items would fit in the party's inventory.
Also, this wouldn't work for gaining items after battles, would it? This would go in every event that items are gained like a chest.
Any idea what would work best?


KK20

There are a couple ways I would do this, both having to be completely new scripts.

1. Have a global inventory so all gained items go there. Then you use a separate scene to actually equip items to actors.
2. Every time there is an instance where an item is gained, it does an item management scene.

I don't like the way this script handles new items gained. It's too automatic and clunky in design.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

CriticalHit

Yes, I don't like how adding new items is handled, or more specifically not handled in this script. It is too bad because otherwise it is a great script I wish I could use. Your suggestion about a global inventory system is beyond my scripting capabilities though. I am also experimenting with the Drago inventory system. It brings up a loot screen when the party inventory is full which is great but my problem with it is the max slots per actor is static, it would be great if it grew dynamically with actor strength like it does in Actor Separate Inventories script.

KK20

Quote
To resize the inventory call with script call
Script : $game_party.resize_inventory(new_size)
or
Script : resize_inventory(new_size)

You just have to handle when the inventory size should change yourself through a common event.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!