void main()
{
object oPC;
object oHench = OBJECT_SELF;
object oTarget;
string oSelf = GetTag(OBJECT_SELF);
location lTarget;
effect eEffect;
int iGold;
int iGoldNow;
int iGoldTake;
int iRefund = GetLocalInt(oPC, "hench_deposit");
oPC = GetPCSpeaker();
ClearAllActions();
RemoveHenchman(oPC, OBJECT_SELF);
SetLocalString(oPC,"Henchman","");

iGold = GetLocalInt(oPC,"RestGold");
iGoldNow = GetGold(oPC);
SetLocalInt(oPC,"RestGold",iGoldNow);
if (iGoldNow>iGold)
    {
    iGoldTake = (iGoldNow-iGold)/10;
    if (iGoldTake>0)
        {
        AssignCommand(oHench, ActionSpeakString("I'll take my share of the spoils now. Good luck! If you need me, I'll be back at the church."));
        SendMessageToPC(oPC,"Starbright takes " + IntToString(iGoldTake) + " gold pieces as her share of the spoils.");
        //DelayCommand(0.1f,TakeGold(iGoldTake,oPC));
        DelayCommand(0.1f,AssignCommand(oPC,TakeGoldFromCreature(iGoldTake,oPC,TRUE)));
        }
     }
else
    {
     AssignCommand(oHench, ActionSpeakString("I believe we are square now. Good luck! If you need me, I'll be back at the church."));
    }
SetLocalInt(oPC, "a_hired", 0);
SetLocalInt(oPC, "starhere", 1);
oTarget = GetObjectByTag(oSelf);
SetLocalInt(GetPCSpeaker(), "leave1", 0);
AssignCommand(oTarget, ActionPlayAnimation(ANIMATION_FIREFORGET_GREETING));
AssignCommand(oTarget, ActionPlayAnimation(ANIMATION_FIREFORGET_BOW));
oTarget = GetWaypointByTag("starbright_home");
lTarget = GetLocation(oTarget);
DelayCommand(5.0,ApplyEffectToObject(DURATION_TYPE_PERMANENT,EffectDisappear(),oHench));
if (GetAreaFromLocation(lTarget)==OBJECT_INVALID) return;

AssignCommand(oPC, ClearAllActions());
DelayCommand(6.5, AssignCommand(oHench, ActionJumpToLocation(lTarget)));
}