Simplest solution is to not physically defeat the player. You instead make a virtual "defeat". Basically a dialog which closly emulates the defeat one but instead is just a normal dialog. If you click the leave game option, it boots you. You also add to it a "restart" button.
Restarting is an entirly different problem. It can also be substantially more complex. You, not the game, have to make a system that lets you reset large areas of your map and manage progress saving. This includes respawning units/bosses, reviving all player units and reseting quest statuses.
The concept of progress saving is that your team's status is captured roughly so it can be recreated at a later time (whether it be continuing from a previous game with state parameters in a bank or just rolling back due to a virtual defeat). Snapshot the progress of the heroes and the progress still remaining. You then make accompanying systems that allow you to respawn units and to reset quest states. Reseting quest states just requires you to clear all quest attributes (all the values the quest use get set to inital values) and reset all the trigger logic used (turning off and on appropiate triggers for the quest to be as good as never done).
Both datatables and banks can be useful when you need to save a lot of data dynamically. Do remember than persiting banks have a size restriction.