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

*/
//:://////////////////////////////////////////////
//:: Created By:
//:: Created On:
//:://////////////////////////////////////////////
#include "NW_I0_GENERIC"
void main()
{
	ExecuteScript("prc_npc_userdef", OBJECT_SELF);
	
	int nRandom;
	object oObject;

    int nUser = GetUserDefinedEventNumber();

    if(nUser == 1001) //HEARTBEAT
    {
 if (!IsInConversation(OBJECT_SELF)&&!GetIsInCombat(OBJECT_SELF))
{
    object oMyOre=GetLocalObject(OBJECT_SELF,"oMy_ore");
    if (!GetIsObjectValid(oMyOre))
    {
      int nRandom=Random(3);
      oMyOre=GetObjectByTag("jw_ore_seam",nRandom);
     SetLocalObject(OBJECT_SELF,"oMy_ore",oMyOre);

    }

    // check to see if he's going to a new bit of ore
     if (Random(24)==1)
     {
      int nRandom=Random(3);
      oObject=GetObjectByTag("jw_ore_seam",nRandom);

         if (GetIsObjectValid(oObject))
        {
        SetLocalObject(OBJECT_SELF,"oMy_ore",oObject);
        ActionMoveToObject(oObject);
        }
      // finish the moving part
     }

     // now do what happens if he is not moving to a new bit of ore

     else

     {
       if (GetDistanceToObject(oMyOre)<5.0)
       {
      DoPlaceableObjectAction(oMyOre,PLACEABLE_ACTION_BASH);
      PlaySound("as_cv_minepick1");
       }
      else
      {
       ActionMoveToObject(oMyOre);
      }
    // AssignCommand(GetLocalObject(OBJECT_SELF,"oWulgar_ore"),DelayCommand(1.3,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_COM_SPARKS_PARRY),OBJECT_SELF)));
     }

     }
    }
    else if(nUser == 1002) // PERCEIVE
    {

    }
    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
    {

    }
    else if(nUser == 1008) // DISTURBED
    {

    }

}