Jump to content
Beefy Kasplant

Find the amount of free inventory spaces

Recommended Posts

Ever made an event where you give multiple items? Ever thought about how it would break horribly if the person has free inventory spaces, but not enough to receive all items?

 

Well, do I have the SOLUTION for you! Just check how many free inventory spaces the guy has bro! 

 

First, create an invisible item: InvCheck (Can be any name of course)

 

Player Variables: 

FreeSpaces

InvCheckItemHeld

 

Common Event:

 

Set PV FreeSpaces to 0 
Set PV InvCheckItemHeld to 0 -> These two first lines are to reset the system

Label: StartLoop  -> This is the start of the loop to check how many free spaces the person has

Give Item: InvCheck

SUCCESS: 

Add PV FreeSpaces +1

Add PV InvCheckItemHeld +1

Go to label: StartLoop -> If it succeeds, this means there is a free inventory slot, it goes to the start of the loop to try again until it fails.

FAIL:

Show text: You have \pv {FreeSpaces} free inventory slots 

Label: TakeInvCheckItem -> This is the loop to take the inventory checker items until they are all gone.

Take Item: InvCheck

SUCCESS:

Go to label: TakeInvCheckItem -> This will keep going until all InvCheck items are gone

 

 

You can put this common event before any event that gives multiple items, and just add a conditional branch in which you check if PV FreeSpaces is high enough to continue giving the actual items.

 

 

NOTE ALERT NOTE ALERT: I did this without an editor and without checking, so please let me know if there are ways to improve or bugs in this event! 

 

 

 

Share this post


Link to post
Share on other sites
3 minutes ago, Joyce said:

Would it not be easier to get a Condition to check for this? 

 

A condition to check for amount of free inventory spaces would be easier yeah haha. 

 

But this is a way to do it with events, in case you are like me, and you can't do it with code.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...