Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Inventory Loss/Prison

In a lot of RPGs (and other games as well), you'll have a scene where you get arrested, stripped, and thrown in prison or some reasonable facsimile.  Eventually, while busting out of prison (sometimes instantaneously), you find all your equipment in a chest, locker, or something, and it's automatically re-applied to your character.  My question is does this need to be done by a script or can it exist within an event?  As you may have guessed, I'd like to add a scene where you're captured, thrown in a prison, you fight a few prisoners, subdue a few guards, then find your equipment and bust out.

I just really have no idea how to go about this.  HALP!!

Edit:  I almost forgot.  I'm using RPG Maker XP.
 
You can do all of this with an event. It's actually fairly simple. When your actor gets caught you have to remove his/her equipment and when they find their equipment just add it back into their inventory.
 
Well right, but is it stored in a variable?  I guess I'm not understanding how to go about taking all equipment, where and how to store it, then how to ensure it's all given back.

Edit:  I'm looking forward to how to do this with events, but I just thought of a clever way to conceive this.  How about it actually changes your character to an entirely different character that looks exactly the same?  About the only problem there is level, etc.
 
Souloux":xjf1zpc1 said:
You can do all of this with an event. It's actually fairly simple. When your actor gets caught you have to remove his/her equipment and when they find their equipment just add it back into their inventory.


What if it's a game that has shops and chests?

Your just going to assume what their equipment was?  No, there's no way to tell the exact layout of the player's equipment and how many items they've used, etc.



I'm actually interested in a way to do this too. 
 
Well, I'd really rather have some sort of algorithm, array, or something, but alternatively, what you could do is have a character that looks exactly like your character then switch to that character.  Then all you'd need is an event that copies your current stats and pastes them on the new guy.  When you find your equipment, take the stats from the doppelganger and plug them into the real hero, then switch back.  Should work, but it seems like there should be something easier.  Plus, that doesn't account for any items you had either technically.
 
Souloux":1w1tt4cn said:
You can do all of this with an event. It's actually fairly simple. When your actor gets caught you have to remove his/her equipment and when they find their equipment just add it back into their inventory.
That's impossible with events alone, unless the game maker magically knows what items and their exact amounts that the player will have in their possession.

gunsage":1w1tt4cn said:
Well, I'd really rather have some sort of algorithm, array, or something, but alternatively, what you could do is have a character that looks exactly like your character then switch to that character.  Then all you'd need is an event that copies your current stats and pastes them on the new guy.  When you find your equipment, take the stats from the doppelganger and plug them into the real hero, then switch back.  Should work, but it seems like there should be something easier.  Plus, that doesn't account for any items you had either technically.
The inventory follows the party, not the hero. It doesn't matter who you kick out of the party, the inventory will ALWAYS stay the same.

Here, you can use Trickster's script for multiple inventories. Set one inventory up to be the player's and one to be the empty one, and switch via call script commands in the events. I won't explain to you how to do this though, you'll have to figure it out for yourself :D

http://www.rmxp.org/forums/index.php?topic=25164.0
Here is an updated link to the demo: http://www.megaupload.com/?d=KQCH6PMD

;) Hopefully that will help ya
 
That's impossible with events alone, unless the game maker magically knows what items and their exact amounts that the player will have in their possession.


No its possible vennie it would just be a bit tedious.  Every time you have an action that gives an item or takes an item you simply store the increase and decrease of that item via a variable using the control variable command:

change item [potion] +1
control variable [potionamt] +1

then its a matter of simply subtracting items via the variable to rob the inventory

change item [potion] -[potionamt]

then increasing it by the variable amount when you recover. 

change item [potion] +[potionamt]

If you have a lot of game items this will be tedious to event.  But it certainly is possible.  If the variables are zero they shouldn't add any item.
 
Okay, I shouldn't have said impossible. However I absolutely SHUDDER to think of doing that with a typical database of items, weapons, and armor. Unless you did that like, in the beginning of the game or something :/
 
Theoretically, you could also set up an array, but I also don't know how to do that either. :P A multiple inventory system should solve it, except now I'm worried that if you get a number of items in the process of finding your inventory, how do you transfer everything from one inventory to another?  In any case, thank you very much for pointing me in the right direction.  I'm sure it will help. :smile:
 
One of the events in the demo is inventory mergers.
Assuming you switch from the default inventory(0) to inventory(1), then merging inventory 1 that was acquired in prison with inventory(0) should do.
No?
 
xephyr14":18olz8na said:
Souloux":18olz8na said:
You can do all of this with an event. It's actually fairly simple. When your actor gets caught you have to remove his/her equipment and when they find their equipment just add it back into their inventory.


What if it's a game that has shops and chests?

Your just going to assume what their equipment was?  No, there's no way to tell the exact layout of the player's equipment and how many items they've used, etc.

Yeah, when I read that post, I was thinking about telling the same.
The QUESTION was how to completely take and later give back the complete inventory. Then you answered, take everything, and then give it back. It was a retarded answer, Soulox  :lol:
 
You don't need to do it as a counting exercise throughout the game as Killface suggested.

It will still be tedious, but when your character gets arrested you simply add something like this to the event:

Code:
>Fork Condition: Hero Has Potion:
   >Change Variable: Var[xxxx:Potions Taken] = Set To Potion Hold Amount
   >Change Item Amount: Potion: Var[xxxx:Potions Taken] Drop
>End Fork Condition
>Fork Condition: Hero Has Sonic Doll:
   >Change Variable: Var[xxxx:Sonic Dolls Taken] = Set To Sonic Doll Hold Amount
   >Change Item Amount: Sonic Dolls: Var[xxxx:Sonic Dolls Taken] Drop
>End Fork Condition

Etc...

It would be quite a long event, but doing it like this saves changing a variable everytime you change the items held throughout the game. When you want to get all the items back just put:

Code:
>Change Item Amount: Potion: Var[xxxx:Potions Taken] Add
>Change Item Amount: Sonic Doll: Var[xxxx:Sonic Dolls Taken] Add

Etc...

Simple. Tedious, but simple.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top