//::///////////////////////////////////////////////
//:: Custom User Defined Event
//:: FileName
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*

*/
//:://////////////////////////////////////////////
//:: Created By:
//:: Created On:
//:://////////////////////////////////////////////

void main()
{
    int nUser = GetUserDefinedEventNumber();

    if(nUser == 1001) //HEARTBEAT
    {
        if (GetIsDay())
        {
            // Do a random animation sometimes
            if ((!IsInConversation(OBJECT_SELF)) && (!GetIsInCombat()) && (GetLocalInt(GetModule(), "nGoingToFarmDoorFlag") != 1))
            {
                ClearAllActions();
                switch (d6())
                {
                    case 1:
                        ActionPlayAnimation(ANIMATION_LOOPING_GET_LOW, 1.0f, IntToFloat(d6() + 4));
                    break;
                    case 2:
                        ActionPlayAnimation(ANIMATION_FIREFORGET_PAUSE_SCRATCH_HEAD);
                    break;
                    case 3:
                        ActionPlayAnimation(ANIMATION_LOOPING_LOOK_FAR, 1.0f, IntToFloat(d4() + 2));
                    break;
                    case 4:
                        if (d2() == 1)
                        {
                            SetFacing(GetFacing(OBJECT_SELF) + 30.0);
                            ActionPlayAnimation(ANIMATION_LOOPING_GET_LOW, 1.0f, IntToFloat(d4() + 2));
                        }
                        else
                        {
                            SetFacing(GetFacing(OBJECT_SELF) - 30.0);
                            ActionPlayAnimation(ANIMATION_LOOPING_GET_LOW, 1.0f, IntToFloat(d4() + 2));
                        }
                    break;
                    case 5:
                        if (d2() == 1)
                        {
                            SetFacing(GetFacing(OBJECT_SELF) + 50.0);
                            ActionPlayAnimation(ANIMATION_LOOPING_GET_LOW, 1.0f, IntToFloat(d4() + 2));
                        }
                        else
                        {
                            SetFacing(GetFacing(OBJECT_SELF) - 50.0);
                            ActionPlayAnimation(ANIMATION_LOOPING_GET_LOW, 1.0f, IntToFloat(d4() + 2));
                        }
                    break;
                    case 6:
                        if (d2() == 1)
                        {
                            SetFacing(GetFacing(OBJECT_SELF) + 90.0);
                            ActionPlayAnimation(ANIMATION_LOOPING_GET_LOW, 1.0f, IntToFloat(d4() + 2));
                        }
                        else
                        {
                            SetFacing(GetFacing(OBJECT_SELF) - 90.0);
                            ActionPlayAnimation(ANIMATION_LOOPING_GET_LOW, 1.0f, IntToFloat(d4() + 2));
                        }
                    break;
                }
            }
        }
    }
    else if(nUser == 1002) // PERCEIVE
    {
        // If last perceived is a PC, face them
    }
    else if(nUser == 1003) // END OF COMBAT
    {

    }
    else if(nUser == 1004) // ON DIALOGUE
    {

    }
    else if(nUser == 1005) // ATTACKED
    {

    }
    else if(nUser == 1006) // DAMAGED
    {

    }
    else if(nUser == 1007) // DEATH
    {
        DestroyObject(GetObjectByTag("jhr_ragan_battle"));
        DestroyObject(GetObjectByTag("Farmer01"));
    }
    else if(nUser == 1008) // DISTURBED
    {

    }

}

