MV Dropping items on death.

So I want to be able to store my entire inventory / equipment into memory so that when the player dies, he loses all his equipment. This will drop a body and when returned to, interacting with the body will return all the items to the player's inventory.

So far I've figured out the script $gameActors.actor(1).equips(); used when assigning a variable. But don't know how to store items in the inventory into a variable.

I've discovered $gameActors.actor(1).clearEquipments(); will remove all equipment but not items.

And in the end I don't know how to return the equipment, or the items (if I figured out how to remove them).

So yeah, basically just need to figure out a way to save all items and equipment into memory, so that when I click on my body it restores them all to my inventory.

I've got it down so that when you die the body drops where you died etc, just need to figure out the inventory situation!

Sorry if this sounds convoluted! Thanks!!
Will you need the ability to drop multiple bodies each with their own inventory, or will dying again erase the corpse that existed before?
Will you need the ability to drop multiple bodies each with their own inventory, or will dying again erase the corpse that existed before?

I have absolutely no idea how I'd be able to make a new body for each time you died (which would be what I actually want but seems impossible with the restrictions that rpg maker has).

Since I really can't think of a way to drop your body each time on death it'd have to be erasing the corpse that existed before. If there was somehow an easy way to make it so you had multiple corpses that would be ideal, but the way that I was doing it, it seems like it would be impossible. Could possibly do it with a limit on 3 bodies or so before the 1st one dissapeared, that might work.


So whatever way you could figure out would be fine, but ideally yeah lets say 3 corpses. After the your 4th death the 1st one disappears and you lose everything in it and so on. That would be in a perfect world.
The only difference is storing one set of inventory or multiple, and the only difference there is using single values vs arrays.

So basically the way I'd do this would be to create an array on $gamePlayer, called something like _deathData or something similar. And in there I would store an array of objects consisting of a map ID, map X, map Y and inventory properties, where inventory is a copy of $gameParty.allItems().

Then I'd either create X corpse events per map, where X is the number of possible corpses, or use an event spawning plugin (of which there are a few) with a parallel process common event that checks whether the player has entered a map with an ID that's stored in the deathData, and if so spawns an event at the stored X and Y on that map, and if interacted with it'll add the inventory store to the party's inventory.

I'm aware that what I just said may well sound like Swahili to you; my main point is that this can be done and it's not very complicated either.
The only difference is storing one set of inventory or multiple, and the only difference there is using single values vs arrays.

So basically the way I'd do this would be to create an array on $gamePlayer, called something like _deathData or something similar. And in there I would store an array of objects consisting of a map ID, map X, map Y and inventory properties, where inventory is a copy of $gameParty.allItems().

Then I'd either create X corpse events per map, where X is the number of possible corpses, or use an event spawning plugin (of which there are a few) with a parallel process common event that checks whether the player has entered a map with an ID that's stored in the deathData, and if so spawns an event at the stored X and Y on that map, and if interacted with it'll add the inventory store to the party's inventory.

I'm aware that what I just said may well sound like Swahili to you; my main point is that this can be done and it's not very complicated either.


Well I'm glad that it could be done, but unfortunately I'm terrible at programming. I took 1 class of c++ in college lol. I found most of what I was trying to do at this page https://steamcommunity.com/app/363890/discussions/0/1730963192543176909/
but for what I'm trying to do it doesn't work. I don't even know how to save items or return those saved items. This seemed somewhat like what I wanted, and I was trying to go off there, but unfortunately I can't program, and that's why I use RPG maker lol.
I'm trying to think of a way I can explain to you how to implement this without straight-up just doing it for you (which I'm not going to do for free, as I'm sure you'll understand XD)
I'm trying to think of a way I can explain to you how to implement this without straight-up just doing it for you (which I'm not going to do for free, as I'm sure you'll understand XD)
Lol it's all good. I'm actually surprised that this isn't an integrated feature in rpg maker tbh. I find that in almost every rpg I play there is some point in the game where you're either thrown in jail, or get your weapons taken while speaking to a king or something and then they are returned later. This is basically the same thing that I'm doing here and it's in every rpg lol! Surprised it isn't integrated :0
The base engine doesn't really provide many of those kinds of features; I mean you could achieve all this with event commands, but it would be a pretty complicated set of events and without code would require a separate variable operation for every possible item the party might have.
I find that in almost every rpg I play there is some point in the game where you're either thrown in jail, or get your weapons taken while speaking to a king or something and then they are returned later...Surprised it isn't integrated
Revisit those parts of those games...most of the time it doesn't actually make a difference to the game. For example, off the top of my head I'm thinking of parts in Final Fantasy IV and Phantasy Star 3 when you're jailed and lose your stuff.

But it doesn't actually matter because you don't get into fights during those times, so it's not like you have to be able to defeat enemies while getting back your stuff (which would be basically impossible because those games give most of your stats from your equipment, so being naked means you wouldn't be able to beat anything).

So it just tells you that you lost your stuff, and when you find the chest or get the helper who unlocks your cell or whatever, it pops up another message telling you that you got it back. Use event controls to turn off the player's ability to pull up the menu (and I'm not Googling it right now, but I think menu plugins such as Yanfly's main menu allow you to disable individual menu commands, such as Equip and Item during the game with plugin commands).

Also...unsolicited opinion here: reconsider what you're going for 🙂 I've played a lot of games in a lot of genres, and corpse runs are one of the suckiest mechanics ever. I don't know anyone who thinks dying, then having to travel back there and frantically dodge every dangerous thing and try not to die again just to get your stuff back is fun.

The only reason it exists is some half-baked nod to realism, which doesn't make any sense to begin with, because if you died and you've come back, obviously any supernatural power that can pull that off can bring your freaking stuff with you.
Revisit those parts of those games...most of the time it doesn't actually make a difference to the game. For example, off the top of my head I'm thinking of parts in Final Fantasy IV and Phantasy Star 3 when you're jailed and lose your stuff.

But it doesn't actually matter because you don't get into fights during those times, so it's not like you have to be able to defeat enemies while getting back your stuff (which would be basically impossible because those games give most of your stats from your equipment, so being naked means you wouldn't be able to beat anything).

So it just tells you that you lost your stuff, and when you find the chest or get the helper who unlocks your cell or whatever, it pops up another message telling you that you got it back. Use event controls to turn off the player's ability to pull up the menu (and I'm not Googling it right now, but I think menu plugins such as Yanfly's main menu allow you to disable individual menu commands, such as Equip and Item during the game with plugin commands).

Also...unsolicited opinion here: reconsider what you're going for 🙂 I've played a lot of games in a lot of genres, and corpse runs are one of the suckiest mechanics ever. I don't know anyone who thinks dying, then having to travel back there and frantically dodge every dangerous thing and try not to die again just to get your stuff back is fun.

The only reason it exists is some half-baked nod to realism, which doesn't make any sense to begin with, because if you died and you've come back, obviously any supernatural power that can pull that off can bring your freaking stuff with you.
The game that I'm working on is a survival type game with an ABS. So the dying part and losing your items and having to run back to get them is par for the course. I've actually managed to set up all the crafting and random resource spawns really easily with just the ingame tools and no programming. This has been the only part that has been difficult for me so far. In a normal rpg I'd agree with dropping your items, but this definitely isn't that.

Basically it's a kind of dungeon crawler with increasingly difficult levels giving better resources to make better gear so you can progress further etc. There is no saving, the game auto saves every 10 seconds. There is durability so you can't just cheese dungeons with weak items if you're really skilled because they will break faster on hard enemies. there is also a sanity meter that slowly depletes, and when it reaches 0 you are returned to the hub. I guess to say it's a cross between something like darkest dungeon, a survival game like valheim, and old school zelda. IMO the dropping items on death thing works out well for what the game is.

If I could only figure out how to do it lol. Been scouring the internet but still only found this one article so far: https://steamcommunity.com/app/363890/discussions/0/1730963192543176909/
Okay, let's take this one step at a time. Do you have access to Yanfly's Buffs & States Core and event spawning plugins?
Okay, let's take this one step at a time. Do you have access to Yanfly's Buffs & States Core and event spawning plugins?
I do have it for future use to make regeneration spells, but currently not using it for anything.
Is this a single-character game? Like you only ever have the one with nobody else in the party?
Is this a single-character game? Like you only ever have the one with nobody else in the party?
Yup, just single player game. I'm using the Alpha ABS combat system. Found Here
So a lot of combat related things are kind of impossible to do. I worked on all the crafting and dungeon stuff first, that's why I just now ran into this problem of trying to figure out deaths.
It still applies the KO/Death state from the database when you die though, right?
It still applies the KO/Death state from the database when you die though, right?
I'm not exactly sure how it works. In the plugin options you have 3 options. On death you can have it say game over and return to the main menu, "game over common event, and "after death common event".
So unless you choose to have it just game over and main menu it will run a common event and teleport you to a specified location on a specified map.
Common event is fine for this, even better actually since you don't need another plugin besides an event spawner.

Okay, so the thing about Javascript is that pretty much everything in MV is objects and properties. Everything. The enemies, the actors, the weapons, the armours...and once you know that, you know the magic spell that'll open up pretty much anything you want to do: those properties didn't exist before the engine created them, and there's nothing stopping you from creating your own.

So in the common event that runs on death, if you add a script command with

Code:
$gameParty._deathData = $gameParty._deathData || [];
$gameParty._deathData.push([$gamePlayer.mapId(), $gamePlayer.x, $gamePlayer.y, $gameParty.allItems()])

If you later refer to $gameParty._deathData[0] for example, you'll get the map ID, X coordinate, Y coordinate and set of all items from your first death. You'd have to link your spawnable event to the appropriate death data index somehow (the specific implementation would depend on what event spawner you're using) and then when you get the _deathData for the death corresponding to that location, you can loop through the items (index 3) and have an if/else that checks what the item type is and then adds that item back to the party's inventory.
Common event is fine for this, even better actually since you don't need another plugin besides an event spawner.

Okay, so the thing about Javascript is that pretty much everything in MV is objects and properties. Everything. The enemies, the actors, the weapons, the armours...and once you know that, you know the magic spell that'll open up pretty much anything you want to do: those properties didn't exist before the engine created them, and there's nothing stopping you from creating your own.

So in the common event that runs on death, if you add a script command with

Code:
$gameParty._deathData = $gameParty._deathData || [];
$gameParty._deathData.push([$gamePlayer.mapId(), $gamePlayer.x, $gamePlayer.y, $gameParty.allItems()])

If you later refer to $gameParty._deathData[0] for example, you'll get the map ID, X coordinate, Y coordinate and set of all items from your first death. You'd have to link your spawnable event to the appropriate death data index somehow (the specific implementation would depend on what event spawner you're using) and then when you get the _deathData for the death corresponding to that location, you can loop through the items (index 3) and have an if/else that checks what the item type is and then adds that item back to the party's inventory.
Alright, this is making some sense to me. It's just been 10 years since I've done any programming and that was just for 2 classes lol. Seems I need to do some learning on all the syntax for rpg maker and learn the syntax for javascript. I see you have some tutorials in your signature, I'll check those out and open the wiki lol. I definitely get the basic ideas of what your saying and I can think of it in like a programmer's eye, hopefully I can figure it out 😅

Thanks for the help! There are going to be 2 things in a few months I def won't be able to do on my own, and will hit you up on your shop then. I wish I would have stuck more to programming side of things rather than art and writing in times like these haha
Funny, sometimes I wish I'd stuck to art rather than programming. 😛
For a while there, I thought you were making a Wizardy type game where when you get TPKed, you have to create a whole new party. If you happen to come across the location of your deceased party's final resting place, you could loot your old stuff back. But I have to agree with @ATT_Turan on that one. It was a sucky mechanic because your new party had to be of similar strength to your old one in order to retrieve their stuff without getting TPKed themselves and by that time, you didn't really need the loot back anymore.

Original thread: https://forums.rpgmakerweb.com/threads/dropping-items-on-death.134978/