//This is the default header for most items converted to the new
//tagbased system.
//Remember to create 2 scripts, one using the template, and name this
//script ac_"tagnameofitemgoeshere"  (without the "")

#include "x2_inc_switches"
void main()
{
    // Check if we have the correct event firing the script
    if (GetUserDefinedItemEventNumber() != X2_ITEM_EVENT_ACTIVATE) return;

//Define Variables

effect eEffect;
object oTarget;

object oPC;

if (!GetIsPC(GetItemActivatedTarget())
){

SendMessageToPC(GetItemActivator(), "Improper use of item!");
return;}

oPC = GetItemActivator();

FloatingTextStringOnCreature("You spin the toy and something magical happens!!!", oPC);

int nInt;
nInt = d6();
if (nInt==1)
   {
   DelayCommand(1.0, SendMessageToPC(oPC, "You have been polymorphed into a Doom Knight!!!"));

   oTarget = oPC;

   eEffect = EffectPolymorph(POLYMORPH_TYPE_DOOM_KNIGHT);

   eEffect = SupernaturalEffect(eEffect);

   ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEffect, oTarget, 5000000.0f);

   }
else if (nInt==2)
   {
   DelayCommand(1.0, SendMessageToPC(oPC, "You have been polymorphed into a Penguin!!!"));

   oTarget = oPC;

   eEffect = EffectPolymorph(POLYMORPH_TYPE_PENGUIN);

   eEffect = SupernaturalEffect(eEffect);

   ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEffect, oTarget, 5000000.0f);

   }
else if (nInt==3)
   {
   DelayCommand(1.0, SendMessageToPC(oPC, "You have been polymorphed into a Pixie!!!"));

   oTarget = oPC;

   eEffect = EffectPolymorph(POLYMORPH_TYPE_PIXIE);

   eEffect = SupernaturalEffect(eEffect);

   ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEffect, oTarget, 500000.0f);

   }
else if (nInt==4)
   {
   DelayCommand(1.0, SendMessageToPC(oPC, "You have been polymorphed into a Balor!!!"));

   oTarget = oPC;

   eEffect = EffectPolymorph(POLYMORPH_TYPE_BALOR);

   eEffect = SupernaturalEffect(eEffect);

   ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEffect, oTarget, 500000.0f);

   }
else if (nInt==5)
   {
   DelayCommand(1.0, FloatingTextStringOnCreature("You have been polymorphed into a Succubus!!!!", oPC));

   oTarget = oPC;

   eEffect = EffectPolymorph(POLYMORPH_TYPE_SUCCUBUS);

   eEffect = SupernaturalEffect(eEffect);

   ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEffect, oTarget, 500000.0f);

   }
else if (nInt==6)
   {
   DelayCommand(1.0, FloatingTextStringOnCreature("You have been polymorphed into a Zombie!!!", oPC));

   oTarget = oPC;

   eEffect = EffectPolymorph(POLYMORPH_TYPE_ZOMBIE);

   eEffect = SupernaturalEffect(eEffect);

   ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEffect, oTarget, 500000.0f);

   }

}