Is there a way to take away all rewarded items?

What I mean is lets say the player accepts going into a bonus dungeon. The bonus dungeon always contain many items, whereas up to 3 are rare one time items. The catch is the player must complete this dungeon in order to keep all the items he has found, including gold and exp that is awarded throughout the dungeon. Reason on doing this is so I can challenge the player into finishing the dungeon without them bailing out after retrieving a rare item, exp, gold, etc. They must complete the dungeon in order to keep all the rewards that they have earned.


Sounds complicated, but it'll also prevent the scenario and purpose from being broken or misused. Thanks!
For the EXP and Money I would use a variable and dish out rewards like that, For example When you defeat a troop it adds one point to the variable. Then at the end of the dungeon you get 500exp and 200 gold for defeating ten troops. As for the rewards you can use conditional branches to check for the item and when they leave without completing the dungeon then run the conditional branch to check for the item and remove it.
You can do this with variables. Depending on how many items and such it could get a bit complicated, but as long as you keep track of it well, it should work. For example, in the Control Variable tab, there is an Operand option of Game Data, which allows you to set the variable equal to various things, including Gold and Items.


Personally, I would have an event just upon entering the dungeon that records all the current data you need into variables. Then at the end, have certain conditions to be met (whatever you deem as completing the dungeon) and if those conditions are not met, reset the value of the items back to what the original values were.


Hope that makes sense.
Now with the two ideas you guys shared: should this revolve around common events or just a regular event?
I personally would use regular events. I would set it up so at the entrance of the cave:

Spoiler
gUfr5SK.png



O0NLJgJ.png



(Page 2 is a blank page with a condition of Self-Switch A, so that the player doesn't accidentally trigger it twice.)


And then at the end of the cave I would have a similar event using conditional branches to check whatever conditions need to be met (for example, if they need to defeat a certain monster, after defeat trigger or switch to on or set a variable to 1). Or if the exit is the same as the entrance, you could set up an a similar event just outside the cave.

Original thread: https://forums.rpgmakerweb.com/threads/is-there-a-way-to-take-away-all-rewarded-items.62095/