That's not a hack, that's a bug. Just do what I tried to explain
1) put a 2 hand sword in slot 1
2) put a shield in slot 2 (the shield must have HP on it lik lanoire/brenin/robi/crafted ones)
3) put another weaponf in Third slot
4) switch between these 3 weapons until your life is under 0
Then you'll be dead (no HP and MP recovery) but you'll be able to kill, gain XP and no one will be able to kill you (mostly because you're already dead xD)