You cannot prevent Amie from dying, but you can restore her afterwards.
Here is how I usually bring her back.
First you play up to the point just before you enter the mage fight sequence. While Amie is still alive I save the game under quicksave plus two other savegame entries (sounds like overkill I know, but it can make a difference).
Continue playing the game until Daeghun sends you to retrieve the shard. Once you are in the swamp with Bevil quicksave the game and exit.
From Windows copy the 0_amie.ros and Roster.rst from one of the other two savegame folders to the quicksave folder. You will need to confirm to overwrite Roster.rst - 0_amie.ros was already deleted by the game. Now that these two files have been replaced at the quicksave folder, relaunch the game and load the quicksave game.
Use the console givexp command to readjust Amie’s experience points to match yours. Now, VERY IMPORTANT, save the game to a new savegame entry. After that quicksave should work fine.
I have neglected to create the new savegame in the past just to have the game crash when I tried to save and delete my savegame folder.
This procedure will need to be repeated at two other points in the game:
After the Vigil at Solace Glade and After the combat with Lorne.
Probably just need to copy the the Roster.rst file at those two points in the game. 0_amie.ros should still be there.
You will need to be a little bit careful and understanding with her. She was really shaken up by her experience at West Harbor. If she get knocked unconscious, she can lose all of her gear.
I can usually recover her gear if I pick it up before she regains consciousness. Otherwise it tends to fall through an extra-planar portal. You can see where it went, but you cannot get to it. This only happens once or twice though (assuming she gets knocked unconscious).
She is worth it though. She also sticks really close and insists on going on every mission with me. Her security blanket I suppose as I was the one who resurrected her. But I would not have it any other way.
She is loyal and gentle and good-natured, and extremely competent.
This is an RPG after all, so play along ;).
A couple other tips. Apparently the Roster.rst file save experience points for other companions when they are not active in the party. At later points in the game I use gr_dm to make all current companions active just briefly so their ros files can be updated. It makes the process of updating experience points easier after the Vigil and Lorne. I would avoid bringing in companions you have not encountered yet, might cause problems later.
Magic man.... You've made the good list. Not only did you grant me a way to get Amie back into my party, but I also discovered I can also get Bevil into it, too! And I was ready to resign myself to the fact that I couldn't!
Unfortunately, I recently began replaying the game and got to a pretty far off point into it, when I got to Neverwinter and now have to choose Watch or Thieves, in fact. When I attempted your tip and loaded the save..... I only had Bevil and Amie in my party. And my other companions were in the Flagon still... but they all turned hostile. And when I went to go out the door before anybody died, I found out Bevil and Amie were stuck to me and I couldn't add the others into my party for some reason. Suffice to say, I saw the results of your hack being done too late.
Still, you just gave me a blessing. Hell, I think I'll just replay the game all over with your hack in mind! However, I'm curious, is there a way to remove Bevil and Amie from my party? Not that I really want to, but my story idea for my KC has it that Bevil and Amie go with him to Neverwinter and Amie sticks with him throughout the entire game up until the Vale Of Merdelain, where he gets her to stay at Crossroad Keep to hold the fort (no pun intended), and Bevil leaves my KC's company when the whole githyanki thing is done and they return to West Harbor to give the good news, and Bevil informs my KC he's staying at West Harbor now for good. O'course, he eventually leaves it and becomes a sergeant at the Keep anyway.
So yeah, I just wanna pretend that my playthrough is going exactly like how I envision it. Edit
: A development. I've done the hack after the attack on the village was over but before leaving to the swamp. Amie's here and it doesn't seem like there are any bugs. I tried doing it earlier right after she died, and she came back but she was forced into Puppet Mode, to put it simply. If I weren't commandeering her, she'd stay frozen and not act at all, not move or even attack any nearby enemies. Now though, she's moving just fine and I'm about to test her out into the swamp. If there's no edit in two days, assume that she's working perfectly.