//::///////////////////////////////////////////////
//:: User Defined Henchmen Script
//:: 69_hen_userdefined
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
    The most complicated script in the game.
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: March 18, 2002
//:://////////////////////////////////////////////

void main()
{
    // Make sure the were creature has a custom on spawn in with the line Custom User On Attacked being
    // commented in.  This becomes the Userdefined script.

    int nUser = GetUserDefinedEventNumber();
    int nChange = GetLocalInt(OBJECT_SELF,"NW_LYCANTHROPE");
    effect eShape;
    effect eVis = EffectVisualEffect(VFX_FNF_SUMMON_UNDEAD);
    if(nUser == 1005 && nChange == 0)
    {
        switch (Random(10))
        {
        case 1:
            eShape = EffectPolymorph(POLYMORPH_TYPE_WERECAT);
        break;
        case 2:
            eShape = EffectPolymorph(POLYMORPH_TYPE_GIANT_SPIDER);
        break;
        case 3:
            eShape = EffectPolymorph(POLYMORPH_TYPE_UMBER_HULK);
        break;
        case 4:
            eShape = EffectPolymorph(POLYMORPH_TYPE_DIRE_WOLF);
        break;
        case 5:
            eShape = EffectPolymorph(POLYMORPH_TYPE_DIRE_BROWN_BEAR);
        break;
        case 6:
            eShape = EffectPolymorph(POLYMORPH_TYPE_TROLL);
        break;
        case 7:
            eShape = EffectPolymorph(POLYMORPH_TYPE_PANTHER);
        break;
        case 8:
            eShape = EffectPolymorph(POLYMORPH_TYPE_YUANTI);
        break;
        case 9:
            eShape = EffectPolymorph(POLYMORPH_TYPE_DEATH_SLAAD);
        break;
        case 10:
            eShape = EffectPolymorph(POLYMORPH_TYPE_DIRE_BOAR);
        break;
        }
        DelayCommand(1.0, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eShape, OBJECT_SELF, 60.0));
        DelayCommand(1.0, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eVis, GetLocation(OBJECT_SELF)));
        SetLocalInt(OBJECT_SELF, "NW_LYCANTHROPE", 1);
    }
   if(nUser == 1003 && (!GetIsInCombat(OBJECT_SELF)))
   {
   SetLocalInt(OBJECT_SELF, "NW_LYCANTHROPE", 0);
   }
}
