Get a written contract in advance of doing anything. Mine requires prepayment of the initial appraisal and a deposit of $1,000 if court time is involved. That $1,000 is refreshed upon demand. You'll need to address out of pocket expenses too like court exhibits, copy fees, developing or printing of photos, etc. I do quite a bit of litigation work and have never had a collection problem. I get my fee in advance, and if not, I clearly let the client and attorney know that they don't want me to appear as an unpaid disgruntled expert.
You'll want to talk with the attorney to find out who your client should be. Sometimes the attorney will want to be the client because certain things in the attorney's file are privileged and not discoverable.
One more thing- in our area a lot of attorney's will order a verbal appraisal. If the value is to their advantage then they'll ultimately require it in writing. If it isn't to their advantage then they might order an appraisal from another appraiser. Now they have two appraisals and the first verbal appraisal is discoverable in court. However, that verbal appraisal (with required work file) isn't as useful for the opposing side as a written one would be. Also, if the verbal appraisal agrees with a value provided by the opposing side then they might have saved their client some money if it never is required to be in writing. I charge one fee for a verbal, and an additional fee for it in writing.