class 1 lv3_monster : monster_parameter
{
parameter:
	int	LifeTime = 12;

handler:
	EventHandler CREATED()
	{
		if( myself.sm.param1 )
		{
			myself.c_ai0 = myself::GetCreatureFromIndex(myself.sm.param1);
			myself::AddAttackDesire(myself.c_ai0,1,200);
		}
		if( myself.sm.param3 )
		{
			myself.c_ai1 = myself.boss;
		}
		myself::AddTimerEx(3000,( ( 1000 * 60 ) * LifeTime ));
	}

	EventHandler ATTACKED(attacker,damage,npc0,c0,i0,f0)
	{
		c0 = attacker;
		if( c0.master )
		{
			c0 = c0.master;
		}
		if( c0.is_pc == 1 )
		{
			if( c0.dbid != myself.sm.param2 )
			{
				if( myself::IsNullCreature(myself.c_ai1) == 0 )
				{
					gg::SendScriptEvent(myself.c_ai1,1000,0);
				}
				npc0 = gg::GetNPCFromID(myself.sm.param3);
				npc0.i_quest0 = 0;
				myself::Despawn();
			}
			if( attacker.is_pc != 0 || myself::IsInCategory(11,attacker.npc_class_id) )
			{
				f0 = 0;
				if( SetHateGroup >= 0 )
				{
					if( myself::IsInCategory(SetHateGroup,attacker.occupation) )
					{
						f0 = ( f0 + SetHateGroupRatio );
					}
				}
				if( attacker.occupation == SetHateOccupation )
				{
					f0 = ( f0 + SetHateOccupationRatio );
				}
				if( SetHateRace == attacker.race )
				{
					f0 = ( f0 + SetHateRaceRatio );
				}
				f0 = ( ( ( 1.000000 * damage ) / ( myself.sm.level + 7 ) ) + ( ( f0 / 100 ) * ( ( 1.000000 * damage ) / ( myself.sm.level + 7 ) ) ) );
				myself::AddAttackDesire(attacker,1,( f0 * 100 ));
			}
		}
	}

	EventHandler TIMER_FIRED_EX(timer_id,npc0)
	{
		if( timer_id == 3000 )
		{
			npc0 = gg::GetNPCFromID(myself.sm.param3);
			npc0.i_quest0 = 0;
			myself::Despawn();
		}
	}

	EventHandler SEE_SPELL(speller,skill_name_id,target,npc0,c0)
	{
		c0 = speller;
		if( c0.master )
		{
			c0 = c0.master;
		}
		if( c0.is_pc == 1 )
		{
			if( c0.dbid != myself.sm.param2 )
			{
				if( myself::IsNullCreature(myself.c_ai1) == 0 )
				{
					gg::SendScriptEvent(myself.c_ai1,1000,0);
				}
				npc0 = gg::GetNPCFromID(myself.sm.param3);
				npc0.i_quest0 = 0;
				myself::Despawn();
			}
		}
	}

}
